diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-16 14:19:09 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-18 20:27:49 +0200 |
commit | 4a478227f5af8322164ecce66fd056e9bf2eac89 (patch) | |
tree | 718e3049e6a8e6d8c2c14c329d48832d78c1cdd8 /vcl/qt5/Qt5Graphics.cxx | |
parent | 17c91a53d25c0b82524e04a0c108f8e0abc76685 (diff) |
VCL cleanup WidgetDrawInterface
I don't understand why WidgetDrawInterface, which is basically a
copy of the SalGraphics native controls interface, duplicated it,
instead of cleaning things up.
The whole commit message of commit 8fcfa3853a81, which added this
code, is just: "custom widgets: Custom Widget Themes". That's it.
So this patch does, what the original one skipped: replacing the
SalGraphics interface with the WidgetDrawInterface. One result is
the addition of handleDamage to SalGraphics to correctly handle
the damage done by a custom widget theme to the underlying
SalGraphics implementation.
Change-Id: I5fda1a64b28e6560fb3c62e02b6dcda827f698e2
Reviewed-on: https://gerrit.libreoffice.org/74118
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5/Qt5Graphics.cxx')
-rw-r--r-- | vcl/qt5/Qt5Graphics.cxx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx index fbf7ae05bf6b..5192f0b42416 100644 --- a/vcl/qt5/Qt5Graphics.cxx +++ b/vcl/qt5/Qt5Graphics.cxx @@ -21,6 +21,7 @@ #include <Qt5Font.hxx> #include <Qt5Frame.hxx> +#include <Qt5Graphics_Controls.hxx> #include <Qt5Painter.hxx> #include <QtGui/QImage> @@ -39,6 +40,8 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage ) , m_aTextColor( 0x00, 0x00, 0x00 ) { ResetClipRegion(); + if (!Qt5Data::noNativeControls()) + m_pWidgetDraw.reset(new Qt5Graphics_Controls()); } Qt5Graphics::~Qt5Graphics() @@ -110,20 +113,16 @@ SystemFontData Qt5Graphics::GetSysFontData(int /*nFallbacklevel*/) const #endif -bool Qt5Graphics::drawNativeControl(ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, ControlState nState, - const ImplControlValue& aValue, const OUString& aCaption) +void Qt5Graphics::handleDamage(const tools::Rectangle& rDamagedRegion) { - bool bHandled - = m_aControl.drawNativeControl(nType, nPart, rControlRegion, nState, aValue, aCaption); - if (bHandled) - { - Qt5Painter aPainter(*this); - aPainter.drawImage(QPoint(rControlRegion.getX(), rControlRegion.getY()), - m_aControl.getImage()); - aPainter.update(toQRect(rControlRegion)); - } - return bHandled; + assert(m_pWidgetDraw); + assert(dynamic_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get())); + assert(!rDamagedRegion.IsEmpty()); + + QImage* pImage = static_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get())->getImage(); + Qt5Painter aPainter(*this); + aPainter.drawImage(QPoint(rDamagedRegion.getX(), rDamagedRegion.getY()), *pImage); + aPainter.update(toQRect(rDamagedRegion)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |