Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/declarative-plugin/previewbutton.h
Show All 34 Lines | |||||
35 | class Settings; | 35 | class Settings; | ||
36 | 36 | | |||
37 | class PreviewButtonItem : public QQuickPaintedItem | 37 | class PreviewButtonItem : public QQuickPaintedItem | ||
38 | { | 38 | { | ||
39 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | 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) | ||
41 | 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) | ||
42 | 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) | | |||
44 | 43 | | |||
45 | public: | 44 | public: | ||
46 | explicit PreviewButtonItem(QQuickItem *parent = nullptr); | 45 | explicit PreviewButtonItem(QQuickItem *parent = nullptr); | ||
47 | virtual ~PreviewButtonItem(); | 46 | virtual ~PreviewButtonItem(); | ||
48 | void paint(QPainter *painter) override; | 47 | void paint(QPainter *painter) override; | ||
49 | 48 | | |||
50 | PreviewBridge *bridge() const; | 49 | PreviewBridge *bridge() const; | ||
51 | void setBridge(PreviewBridge *bridge); | 50 | void setBridge(PreviewBridge *bridge); | ||
52 | 51 | | |||
53 | Settings *settings() const; | 52 | Settings *settings() const; | ||
54 | void setSettings(Settings *settings); | 53 | void setSettings(Settings *settings); | ||
55 | 54 | | |||
56 | KDecoration2::DecorationButtonType type() const; | 55 | KDecoration2::DecorationButtonType type() const; | ||
57 | int typeAsInt() const; | 56 | int typeAsInt() const; | ||
58 | void setType(KDecoration2::DecorationButtonType type); | 57 | void setType(KDecoration2::DecorationButtonType type); | ||
59 | void setType(int type); | 58 | void setType(int type); | ||
60 | 59 | | |||
61 | const QColor &color() const { return m_color; } | | |||
62 | void setColor(const QColor color); | | |||
63 | | ||||
64 | Q_SIGNALS: | 60 | Q_SIGNALS: | ||
65 | void bridgeChanged(); | 61 | void bridgeChanged(); | ||
66 | void typeChanged(); | 62 | void typeChanged(); | ||
67 | void settingsChanged(); | 63 | void settingsChanged(); | ||
68 | 64 | | |||
69 | protected: | 65 | protected: | ||
70 | void componentComplete() override; | 66 | void componentComplete() override; | ||
71 | 67 | | |||
72 | private: | 68 | private: | ||
73 | void createButton(); | 69 | void createButton(); | ||
74 | void syncGeometry(); | 70 | void syncGeometry(); | ||
75 | QColor m_color; | | |||
76 | QPointer<KDecoration2::Preview::PreviewBridge> m_bridge; | 71 | QPointer<KDecoration2::Preview::PreviewBridge> m_bridge; | ||
77 | QPointer<KDecoration2::Preview::Settings> m_settings; | 72 | QPointer<KDecoration2::Preview::Settings> m_settings; | ||
78 | KDecoration2::Decoration *m_decoration = nullptr; | 73 | KDecoration2::Decoration *m_decoration = nullptr; | ||
79 | KDecoration2::DecorationButton *m_button = nullptr; | 74 | KDecoration2::DecorationButton *m_button = nullptr; | ||
80 | KDecoration2::DecorationButtonType m_type = KDecoration2::DecorationButtonType::Custom; | 75 | KDecoration2::DecorationButtonType m_type = KDecoration2::DecorationButtonType::Custom; | ||
81 | | ||||
82 | }; | 76 | }; | ||
83 | 77 | | |||
84 | } // Preview | 78 | } // Preview | ||
85 | } // KDecoration2 | 79 | } // KDecoration2 | ||
86 | 80 | | |||
87 | #endif | 81 | #endif |