diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-08-06 17:22:29 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-08-07 16:43:53 +0200 |
commit | 192af752c8111abbf8c7504231c8f7cb98deec43 (patch) | |
tree | 68222753ecc8708c1b8972880ebee006883a42ba /vcl/inc/qt5 | |
parent | b9a6760a371f00d49614732790782c9a456f4e86 (diff) |
Qt5 move native control handing from kde5
The native painting code in the kde5 backend is Qt based only.
To prevent multiple inheritance, it's moved into an extra class
and just leaves the backend specific QImage blitting in the
specific SalGraphics implementation.
Change-Id: I3d5f58f42a37966794541fe1214c1b9557376a98
Reviewed-on: https://gerrit.libreoffice.org/58652
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/inc/qt5')
-rw-r--r-- | vcl/inc/qt5/Qt5Graphics.hxx | 35 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Graphics_Controls.hxx | 61 |
2 files changed, 94 insertions, 2 deletions
diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx index b1ba6ce85d98..2819d0bea5a4 100644 --- a/vcl/inc/qt5/Qt5Graphics.hxx +++ b/vcl/inc/qt5/Qt5Graphics.hxx @@ -27,18 +27,23 @@ #include <QtGui/QPainterPath> #include <QtGui/QRegion> +#include <Qt5Graphics_Controls.hxx> + +class PhysicalFontCollection; +class QImage; +class QPushButton; class Qt5Font; class Qt5FontFace; class Qt5Frame; class Qt5Painter; -class PhysicalFontCollection; -class QImage; class Qt5Graphics : public SalGraphics { friend class Qt5Bitmap; friend class Qt5Painter; + Qt5Graphics_Controls m_aControl; + Qt5Frame* m_pFrame; QImage* m_pQImage; QRegion m_aClipRegion; @@ -50,6 +55,9 @@ class Qt5Graphics : public SalGraphics PhysicalFontCollection* m_pFontCollection; rtl::Reference<Qt5Font> m_pTextStyle[MAX_FALLBACK]; Color m_aTextColor; + std::unique_ptr<QPushButton> m_focusedButton; + std::unique_ptr<QImage> m_image; + QRect m_lastPopupRect; Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage); @@ -206,4 +214,27 @@ public: tools::Rectangle& rNativeContentRegion) override; }; +inline bool Qt5Graphics::IsNativeControlSupported(ControlType nType, ControlPart nPart) +{ + return m_aControl.IsNativeControlSupported(nType, nPart); +} + +inline bool Qt5Graphics::hitTestNativeControl(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, + const Point& aPos, bool& rIsInside) +{ + return m_aControl.hitTestNativeControl(nType, nPart, rControlRegion, aPos, rIsInside); +} + +inline bool Qt5Graphics::getNativeControlRegion(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const OUString& aCaption, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion) +{ + return m_aControl.getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, aCaption, + rNativeBoundingRegion, rNativeContentRegion); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx b/vcl/inc/qt5/Qt5Graphics_Controls.hxx new file mode 100644 index 000000000000..e888a1cd587b --- /dev/null +++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vclpluginapi.h> +#include <salgdi.hxx> + +#include <memory> + +#include <QtGui/QPainter> +#include <QtGui/QRegion> + +class QImage; +class QPushButton; + +// Native control support +class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls +{ + std::unique_ptr<QPushButton> m_focusedButton; + std::unique_ptr<QImage> m_image; + QRect m_lastPopupRect; + + void initStyles(); + +public: + Qt5Graphics_Controls(); + + QImage& getImage() { return *m_image; } + + bool IsNativeControlSupported(ControlType nType, ControlPart nPart); + bool hitTestNativeControl(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, const Point& aPos, + bool& rIsInside); + bool drawNativeControl(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const OUString& aCaption); + bool getNativeControlRegion(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const OUString& aCaption, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |