Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezehelper.h
Show All 17 Lines | |||||
18 | * along with this program; if not, write to the * | 18 | * along with this program; if not, write to the * | ||
19 | * Free Software Foundation, Inc., * | 19 | * Free Software Foundation, Inc., * | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
21 | *************************************************************************/ | 21 | *************************************************************************/ | ||
22 | 22 | | |||
23 | 23 | | |||
24 | #include "breeze.h" | 24 | #include "breeze.h" | ||
25 | #include "breezeanimationdata.h" | 25 | #include "breezeanimationdata.h" | ||
26 | #include "breezesettings.h" | ||||
26 | #include "config-breeze.h" | 27 | #include "config-breeze.h" | ||
27 | 28 | | |||
28 | #include <KColorScheme> | 29 | #include <KColorScheme> | ||
29 | #include <KSharedConfig> | 30 | #include <KSharedConfig> | ||
31 | #include <KConfigWatcher> | ||||
30 | 32 | | |||
33 | #include <QToolBar> | ||||
hpereiradacosta: Not needed as far as I can tell (none of your changes in this file require QToolbar) | |||||
cblack: This is necessary to compile. | |||||
31 | #include <QPainterPath> | 34 | #include <QPainterPath> | ||
32 | #include <QWidget> | 35 | #include <QWidget> | ||
33 | 36 | | |||
34 | namespace Breeze | 37 | namespace Breeze | ||
35 | { | 38 | { | ||
36 | 39 | | |||
37 | //* breeze style helper class. | 40 | //* breeze style helper class. | ||
38 | /** contains utility functions used at multiple places in both breeze style and breeze window decoration */ | 41 | /** contains utility functions used at multiple places in both breeze style and breeze window decoration */ | ||
39 | class Helper | 42 | class Helper : public QObject | ||
40 | { | 43 | { | ||
44 | Q_OBJECT | ||||
45 | | ||||
41 | public: | 46 | public: | ||
42 | 47 | | |||
43 | //* constructor | 48 | //* constructor | ||
44 | explicit Helper( KSharedConfig::Ptr ); | 49 | explicit Helper( KSharedConfig::Ptr, QObject *parent = nullptr ); | ||
45 | 50 | | |||
46 | //* destructor | 51 | //* destructor | ||
47 | virtual ~Helper() | 52 | virtual ~Helper() | ||
48 | {} | 53 | {} | ||
49 | 54 | | |||
50 | //* load configuration | 55 | //* load configuration | ||
51 | virtual void loadConfig(); | 56 | virtual void loadConfig(); | ||
52 | 57 | | |||
53 | //* pointer to shared config | 58 | //* pointer to shared config | ||
54 | KSharedConfig::Ptr config() const; | 59 | KSharedConfig::Ptr config() const; | ||
55 | 60 | | |||
61 | //* pointer to kdecoration config | ||||
62 | QSharedPointer<InternalSettings> decorationConfig() const; | ||||
63 | | ||||
56 | //*@name color utilities | 64 | //*@name color utilities | ||
57 | //@{ | 65 | //@{ | ||
58 | 66 | | |||
59 | //* add alpha channel multiplier to color | 67 | //* add alpha channel multiplier to color | ||
60 | QColor alphaColor( QColor color, qreal alpha ) const; | 68 | QColor alphaColor( QColor color, qreal alpha ) const; | ||
61 | 69 | | |||
62 | //* mouse over color | 70 | //* mouse over color | ||
63 | QColor hoverColor( const QPalette& palette ) const | 71 | QColor hoverColor( const QPalette& palette ) const | ||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Line(s) | |||||
241 | void renderDecorationButton( QPainter*, const QRect&, const QColor&, ButtonType, bool inverted ) const; | 249 | void renderDecorationButton( QPainter*, const QRect&, const QColor&, ButtonType, bool inverted ) const; | ||
242 | 250 | | |||
243 | //* generic shadow for rounded rectangles | 251 | //* generic shadow for rounded rectangles | ||
244 | void renderRoundedRectShadow ( QPainter*, const QRectF&, const QColor&, qreal radius = Metrics::Frame_FrameRadius - 0.5 ) const; | 252 | void renderRoundedRectShadow ( QPainter*, const QRectF&, const QColor&, qreal radius = Metrics::Frame_FrameRadius - 0.5 ) const; | ||
245 | 253 | | |||
246 | //* generic shadow for ellipses | 254 | //* generic shadow for ellipses | ||
247 | void renderEllipseShadow( QPainter*, const QRectF&, const QColor& ) const; | 255 | void renderEllipseShadow( QPainter*, const QRectF&, const QColor& ) const; | ||
248 | 256 | | |||
257 | //* draw the tools area border | ||||
258 | void renderToolsAreaBorder ( QPainter*, const QWidget*, bool menubar = false ) const; | ||||
259 | | ||||
249 | //@} | 260 | //@} | ||
250 | 261 | | |||
251 | //*@name compositing utilities | 262 | //*@name compositing utilities | ||
252 | //@{ | 263 | //@{ | ||
253 | 264 | | |||
254 | //* true if style was compiled for and is running on X11 | 265 | //* true if style was compiled for and is running on X11 | ||
255 | static bool isX11(); | 266 | static bool isX11(); | ||
256 | 267 | | |||
257 | //* true if running on platform Wayland | 268 | //* true if running on platform Wayland | ||
258 | static bool isWayland(); | 269 | static bool isWayland(); | ||
259 | 270 | | |||
260 | //* returns true if compositing is active | 271 | //* returns true if compositing is active | ||
261 | bool compositingActive() const; | 272 | bool compositingActive() const; | ||
262 | 273 | | |||
263 | //* returns true if a given widget supports alpha channel | 274 | //* returns true if a given widget supports alpha channel | ||
264 | bool hasAlphaChannel( const QWidget* ) const; | 275 | bool hasAlphaChannel( const QWidget* ) const; | ||
265 | 276 | | |||
277 | //* returns true if widget is in the tools area | ||||
278 | bool isInToolsArea( const QWidget* ) const; | ||||
279 | | ||||
280 | //* returns false if tools area is empty | ||||
281 | bool toolsAreaHasContents ( const QWidget* ) const; | ||||
282 | | ||||
283 | //* returns true if tools area has a toolbar | ||||
284 | bool toolsAreaHasToolBar ( const QWidget* ) const; | ||||
285 | | ||||
286 | //* returns true if the tools area should be drawn | ||||
287 | bool shouldDrawToolsArea ( const QWidget* ) const; | ||||
288 | | ||||
289 | //* returns the tools area border color | ||||
290 | QColor toolsAreaBorderColor ( const QWidget* ) const; | ||||
291 | | ||||
292 | //* returns the united rectangle of all toolbars in the tools area | ||||
293 | QRect toolsAreaToolbarsRect (const QWidget* widget) const; | ||||
294 | | ||||
295 | QToolBar* grabToolBarForToolsArea ( const QWidget* ) const; | ||||
296 | | ||||
297 | void setToolsAreaEnabled(bool enabled) | ||||
298 | { _toolsAreaEnabled = enabled; }; | ||||
299 | | ||||
266 | //@} | 300 | //@} | ||
267 | 301 | | |||
268 | //@name high dpi utility functions | 302 | //@name high dpi utility functions | ||
269 | //@{ | 303 | //@{ | ||
270 | 304 | | |||
271 | //* return dpi-aware pixmap of given size | 305 | //* return dpi-aware pixmap of given size | ||
272 | virtual QPixmap highDpiPixmap( const QSize& size ) const | 306 | virtual QPixmap highDpiPixmap( const QSize& size ) const | ||
273 | { return highDpiPixmap( size.width(), size.height() ); } | 307 | { return highDpiPixmap( size.width(), size.height() ); } | ||
Show All 29 Lines | |||||
303 | //* return rounded path in a given rect, with only selected corners rounded, and for a given radius | 337 | //* return rounded path in a given rect, with only selected corners rounded, and for a given radius | ||
304 | QPainterPath roundedPath( const QRectF&, Corners, qreal ) const; | 338 | QPainterPath roundedPath( const QRectF&, Corners, qreal ) const; | ||
305 | 339 | | |||
306 | private: | 340 | private: | ||
307 | 341 | | |||
308 | //* configuration | 342 | //* configuration | ||
309 | KSharedConfig::Ptr _config; | 343 | KSharedConfig::Ptr _config; | ||
310 | 344 | | |||
345 | //* KWin configuration | ||||
346 | KSharedConfig::Ptr _kwinConfig; | ||||
347 | | ||||
348 | //* decoration configuration | ||||
349 | QSharedPointer<InternalSettings> _decorationConfig; | ||||
350 | | ||||
311 | //*@name brushes | 351 | //*@name brushes | ||
312 | //@{ | 352 | //@{ | ||
313 | KStatefulBrush _viewFocusBrush; | 353 | KStatefulBrush _viewFocusBrush; | ||
314 | KStatefulBrush _viewHoverBrush; | 354 | KStatefulBrush _viewHoverBrush; | ||
315 | KStatefulBrush _viewNegativeTextBrush; | 355 | KStatefulBrush _viewNegativeTextBrush; | ||
316 | //@} | 356 | //@} | ||
317 | 357 | | |||
318 | //*@name windeco colors | 358 | //*@name windeco colors | ||
319 | //@{ | 359 | //@{ | ||
320 | QColor _activeTitleBarColor; | 360 | QColor _activeTitleBarColor; | ||
321 | QColor _activeTitleBarTextColor; | 361 | QColor _activeTitleBarTextColor; | ||
322 | QColor _inactiveTitleBarColor; | 362 | QColor _inactiveTitleBarColor; | ||
323 | QColor _inactiveTitleBarTextColor; | 363 | QColor _inactiveTitleBarTextColor; | ||
324 | //@} | 364 | //@} | ||
325 | 365 | | |||
366 | bool _toolsAreaEnabled; | ||||
367 | | ||||
326 | }; | 368 | }; | ||
327 | 369 | | |||
328 | } | 370 | } | ||
329 | 371 | | |||
330 | #endif | 372 | #endif |
Not needed as far as I can tell (none of your changes in this file require QToolbar)