Changeset View
Changeset View
Standalone View
Standalone View
outline.h
Show All 14 Lines | |||||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
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 | 20 | | |||
21 | #ifndef KWIN_OUTLINE_H | 21 | #ifndef KWIN_OUTLINE_H | ||
22 | #define KWIN_OUTLINE_H | 22 | #define KWIN_OUTLINE_H | ||
23 | #include "xcbutils.h" | | |||
24 | #include <kwinglobals.h> | 23 | #include <kwinglobals.h> | ||
25 | #include <QRect> | 24 | #include <QRect> | ||
26 | #include <QWidget> | 25 | #include <QObject> | ||
26 | | ||||
27 | #include <kwin_export.h> | ||||
27 | 28 | | |||
28 | class QQmlContext; | 29 | class QQmlContext; | ||
29 | class QQmlComponent; | 30 | class QQmlComponent; | ||
30 | 31 | | |||
31 | namespace KWin { | 32 | namespace KWin { | ||
32 | class OutlineVisual; | 33 | class OutlineVisual; | ||
33 | 34 | | |||
34 | /** | 35 | /** | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 120 | private: | |||
120 | void createHelper(); | 121 | void createHelper(); | ||
121 | QScopedPointer<OutlineVisual> m_visual; | 122 | QScopedPointer<OutlineVisual> m_visual; | ||
122 | QRect m_outlineGeometry; | 123 | QRect m_outlineGeometry; | ||
123 | QRect m_visualParentGeometry; | 124 | QRect m_visualParentGeometry; | ||
124 | bool m_active; | 125 | bool m_active; | ||
125 | KWIN_SINGLETON(Outline) | 126 | KWIN_SINGLETON(Outline) | ||
126 | }; | 127 | }; | ||
127 | 128 | | |||
128 | class OutlineVisual | 129 | class KWIN_EXPORT OutlineVisual | ||
129 | { | 130 | { | ||
130 | public: | 131 | public: | ||
131 | OutlineVisual(Outline *outline); | 132 | OutlineVisual(Outline *outline); | ||
132 | virtual ~OutlineVisual(); | 133 | virtual ~OutlineVisual(); | ||
133 | virtual void show() = 0; | 134 | virtual void show() = 0; | ||
134 | virtual void hide() = 0; | 135 | virtual void hide() = 0; | ||
135 | protected: | 136 | protected: | ||
136 | Outline *outline(); | 137 | Outline *outline(); | ||
Show All 10 Lines | 145 | public: | |||
147 | virtual void show(); | 148 | virtual void show(); | ||
148 | virtual void hide(); | 149 | virtual void hide(); | ||
149 | private: | 150 | private: | ||
150 | QScopedPointer<QQmlContext> m_qmlContext; | 151 | QScopedPointer<QQmlContext> m_qmlContext; | ||
151 | QScopedPointer<QQmlComponent> m_qmlComponent; | 152 | QScopedPointer<QQmlComponent> m_qmlComponent; | ||
152 | QScopedPointer<QObject> m_mainItem; | 153 | QScopedPointer<QObject> m_mainItem; | ||
153 | }; | 154 | }; | ||
154 | 155 | | |||
155 | class NonCompositedOutlineVisual : public OutlineVisual | | |||
156 | { | | |||
157 | public: | | |||
158 | NonCompositedOutlineVisual(Outline *outline); | | |||
159 | virtual ~NonCompositedOutlineVisual(); | | |||
160 | virtual void show(); | | |||
161 | virtual void hide(); | | |||
162 | | ||||
163 | private: | | |||
164 | // TODO: variadic template arguments for adding method arguments | | |||
165 | template <typename T> | | |||
166 | void forEachWindow(T method); | | |||
167 | bool m_initialized; | | |||
168 | Xcb::Window m_topOutline; | | |||
169 | Xcb::Window m_rightOutline; | | |||
170 | Xcb::Window m_bottomOutline; | | |||
171 | Xcb::Window m_leftOutline; | | |||
172 | }; | | |||
173 | | ||||
174 | inline | 156 | inline | ||
175 | bool Outline::isActive() const | 157 | bool Outline::isActive() const | ||
176 | { | 158 | { | ||
177 | return m_active; | 159 | return m_active; | ||
178 | } | 160 | } | ||
179 | 161 | | |||
180 | inline | 162 | inline | ||
181 | const QRect &Outline::geometry() const | 163 | const QRect &Outline::geometry() const | ||
Show All 14 Lines | |||||
196 | } | 178 | } | ||
197 | 179 | | |||
198 | inline | 180 | inline | ||
199 | const Outline *OutlineVisual::outline() const | 181 | const Outline *OutlineVisual::outline() const | ||
200 | { | 182 | { | ||
201 | return m_outline; | 183 | return m_outline; | ||
202 | } | 184 | } | ||
203 | 185 | | |||
204 | template <typename T> | | |||
205 | inline | | |||
206 | void NonCompositedOutlineVisual::forEachWindow(T method) | | |||
207 | { | | |||
208 | (m_topOutline.*method)(); | | |||
209 | (m_rightOutline.*method)(); | | |||
210 | (m_bottomOutline.*method)(); | | |||
211 | (m_leftOutline.*method)(); | | |||
212 | } | | |||
213 | | ||||
214 | inline | 186 | inline | ||
215 | Outline *outline() | 187 | Outline *outline() | ||
216 | { | 188 | { | ||
217 | return Outline::self(); | 189 | return Outline::self(); | ||
218 | } | 190 | } | ||
219 | 191 | | |||
220 | } | 192 | } | ||
221 | 193 | | |||
222 | #endif | 194 | #endif |