From 430b406e5e8249983fc030aa0f867372f5da74d2 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Thu, 20 Jun 2019 13:00:58 +0000 Subject: tdf#105884 Qt5 implement TabControl theming Drawing a QTabWidget is a really complex procedure. The main problems I had were the adjustment of the frame, which I totally missed in the Qt code for a long time. Then there is the frame gap, which Qt draws by simply overlapping the items a bit with the frame. And all the calculations need the tabs together with the pane. None of it really fits very good into the way VCL handles drawing the TabControl and since I needed a way back from the plugin into VCL for the nOverlap value, there is this hack using a static. I hope nOverlap never changes. Change-Id: I8fe6eb12d39a2ac7f6fb89424586cac76e12545b Reviewed-on: https://gerrit.libreoffice.org/74480 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- include/vcl/salnativewidgets.hxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include/vcl/salnativewidgets.hxx') diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx index 03d9a0eee00e..2a67ceb47b24 100644 --- a/include/vcl/salnativewidgets.hxx +++ b/include/vcl/salnativewidgets.hxx @@ -181,6 +181,9 @@ enum class ControlPart // hardcoded 2 pixel overlap between adjacent tabs TabsDrawRtl = 3000, +// Qt doesn't have a separate header to draw + TabPaneWithHeader = 3001, + // For themes that do not want to have the focus // rectangle part drawn by VCL but take care of the // whole inner control part by themselves @@ -340,6 +343,29 @@ class VCL_DLLPUBLIC SliderValue : public ImplControlValue SliderValue & operator =(SliderValue &&) = delete; // due to ImplControlValue }; +class VCL_DLLPUBLIC TabPaneValue : public ImplControlValue +{ +public: + tools::Rectangle m_aTabHeaderRect; + tools::Rectangle m_aSelectedTabRect; + // increased tab size, so it'll overlab the frame rect when draing + // static value, as there is currently no sane way to return additional data + static int m_nOverlap; + + TabPaneValue(const tools::Rectangle &rTabHeaderRect, const tools::Rectangle &rSelectedTabRect) + : ImplControlValue(ControlType::TabPane, 0) + , m_aTabHeaderRect(rTabHeaderRect) + , m_aSelectedTabRect(rSelectedTabRect) + { + } + TabPaneValue* clone() const override; + + TabPaneValue(TabPaneValue const &) = default; + TabPaneValue(TabPaneValue &&) = default; + TabPaneValue & operator =(TabPaneValue const &) = delete; + TabPaneValue & operator =(TabPaneValue &&) = delete; +}; + /* TabitemValue: * * Value container for tabitems. -- cgit