Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/declarative-plugin/previewbutton.h
Show All 15 Lines | |||||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | #ifndef KDECOARTIONS_PREVIEW_BUTTON_ITEM_H | 20 | #ifndef KDECOARTIONS_PREVIEW_BUTTON_ITEM_H | ||
21 | #define KDECOARTIONS_PREVIEW_BUTTON_ITEM_H | 21 | #define KDECOARTIONS_PREVIEW_BUTTON_ITEM_H | ||
22 | 22 | | |||
23 | #include <QQuickPaintedItem> | 23 | #include <QQuickPaintedItem> | ||
24 | #include <QColor> | ||||
24 | #include <QPointer> | 25 | #include <QPointer> | ||
25 | #include <KDecoration2/DecorationButton> | 26 | #include <KDecoration2/DecorationButton> | ||
26 | 27 | | |||
27 | namespace KDecoration2 | 28 | namespace KDecoration2 | ||
28 | { | 29 | { | ||
29 | class Decoration; | 30 | class Decoration; | ||
30 | 31 | | |||
31 | namespace Preview | 32 | namespace Preview | ||
32 | { | 33 | { | ||
33 | class PreviewBridge; | 34 | class PreviewBridge; | ||
34 | class Settings; | 35 | class Settings; | ||
35 | 36 | | |||
36 | class PreviewButtonItem : public QQuickPaintedItem | 37 | class PreviewButtonItem : public QQuickPaintedItem | ||
37 | { | 38 | { | ||
38 | Q_OBJECT | 39 | Q_OBJECT | ||
39 | Q_PROPERTY(KDecoration2::Preview::PreviewBridge *bridge READ bridge WRITE setBridge NOTIFY bridgeChanged) | 40 | Q_PROPERTY(KDecoration2::Preview::PreviewBridge *bridge READ bridge WRITE setBridge NOTIFY bridgeChanged) | ||
40 | Q_PROPERTY(KDecoration2::Preview::Settings *settings READ settings WRITE setSettings NOTIFY settingsChanged) | 41 | Q_PROPERTY(KDecoration2::Preview::Settings *settings READ settings WRITE setSettings NOTIFY settingsChanged) | ||
41 | Q_PROPERTY(int type READ typeAsInt WRITE setType NOTIFY typeChanged) | 42 | Q_PROPERTY(int type READ typeAsInt WRITE setType NOTIFY typeChanged) | ||
43 | Q_PROPERTY(QColor color READ color WRITE setColor) | ||||
42 | 44 | | |||
43 | public: | 45 | public: | ||
44 | explicit PreviewButtonItem(QQuickItem *parent = nullptr); | 46 | explicit PreviewButtonItem(QQuickItem *parent = nullptr); | ||
45 | virtual ~PreviewButtonItem(); | 47 | virtual ~PreviewButtonItem(); | ||
46 | void paint(QPainter *painter) override; | 48 | void paint(QPainter *painter) override; | ||
47 | 49 | | |||
48 | PreviewBridge *bridge() const; | 50 | PreviewBridge *bridge() const; | ||
49 | void setBridge(PreviewBridge *bridge); | 51 | void setBridge(PreviewBridge *bridge); | ||
50 | 52 | | |||
51 | Settings *settings() const; | 53 | Settings *settings() const; | ||
52 | void setSettings(Settings *settings); | 54 | void setSettings(Settings *settings); | ||
53 | 55 | | |||
54 | KDecoration2::DecorationButtonType type() const; | 56 | KDecoration2::DecorationButtonType type() const; | ||
55 | int typeAsInt() const; | 57 | int typeAsInt() const; | ||
56 | void setType(KDecoration2::DecorationButtonType type); | 58 | void setType(KDecoration2::DecorationButtonType type); | ||
57 | void setType(int type); | 59 | void setType(int type); | ||
58 | 60 | | |||
61 | const QColor &color() const { return m_color; } | ||||
62 | void setColor(const QColor color); | ||||
zzag: const QColor &color | |||||
zzag: This isn't done. | |||||
63 | | ||||
59 | Q_SIGNALS: | 64 | Q_SIGNALS: | ||
60 | void bridgeChanged(); | 65 | void bridgeChanged(); | ||
61 | void typeChanged(); | 66 | void typeChanged(); | ||
62 | void settingsChanged(); | 67 | void settingsChanged(); | ||
63 | 68 | | |||
64 | protected: | 69 | protected: | ||
65 | void componentComplete() override; | 70 | void componentComplete() override; | ||
66 | 71 | | |||
67 | private: | 72 | private: | ||
68 | void createButton(); | 73 | void createButton(); | ||
69 | void syncGeometry(); | 74 | void syncGeometry(); | ||
75 | QColor m_color; | ||||
70 | QPointer<KDecoration2::Preview::PreviewBridge> m_bridge; | 76 | QPointer<KDecoration2::Preview::PreviewBridge> m_bridge; | ||
71 | QPointer<KDecoration2::Preview::Settings> m_settings; | 77 | QPointer<KDecoration2::Preview::Settings> m_settings; | ||
72 | KDecoration2::Decoration *m_decoration = nullptr; | 78 | KDecoration2::Decoration *m_decoration = nullptr; | ||
73 | KDecoration2::DecorationButton *m_button = nullptr; | 79 | KDecoration2::DecorationButton *m_button = nullptr; | ||
74 | KDecoration2::DecorationButtonType m_type = KDecoration2::DecorationButtonType::Custom; | 80 | KDecoration2::DecorationButtonType m_type = KDecoration2::DecorationButtonType::Custom; | ||
75 | 81 | | |||
76 | }; | 82 | }; | ||
77 | 83 | | |||
78 | } // Preview | 84 | } // Preview | ||
79 | } // KDecoration2 | 85 | } // KDecoration2 | ||
80 | 86 | | |||
81 | #endif | 87 | #endif |
const QColor &color