diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-20 13:00:58 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-21 16:48:37 +0200 |
commit | 430b406e5e8249983fc030aa0f867372f5da74d2 (patch) | |
tree | fb5e326d134821ad60354fa8ca7344c95907fbf9 /include/vcl/salnativewidgets.hxx | |
parent | 6540912ae1a570fd8c2318f77b757e07b87c0707 (diff) |
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 <glogow@fbihome.de>
Diffstat (limited to 'include/vcl/salnativewidgets.hxx')
-rw-r--r-- | include/vcl/salnativewidgets.hxx | 26 |
1 files changed, 26 insertions, 0 deletions
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. |