Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezehelper.h
Show All 19 Lines | |||||
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 "config-breeze.h" | 26 | #include "config-breeze.h" | ||
27 | 27 | | |||
28 | #include <KColorUtils> | ||||
28 | #include <KColorScheme> | 29 | #include <KColorScheme> | ||
29 | #include <KSharedConfig> | 30 | #include <KSharedConfig> | ||
30 | 31 | | |||
31 | #include <QPainterPath> | 32 | #include <QPainterPath> | ||
32 | #include <QWidget> | 33 | #include <QWidget> | ||
33 | 34 | | |||
34 | namespace Breeze | 35 | namespace Breeze | ||
35 | { | 36 | { | ||
Show All 18 Lines | 41 | { | |||
54 | KSharedConfig::Ptr config() const; | 55 | KSharedConfig::Ptr config() const; | ||
55 | 56 | | |||
56 | //*@name color utilities | 57 | //*@name color utilities | ||
57 | //@{ | 58 | //@{ | ||
58 | 59 | | |||
59 | //* add alpha channel multiplier to color | 60 | //* add alpha channel multiplier to color | ||
60 | QColor alphaColor( QColor color, qreal alpha ) const; | 61 | QColor alphaColor( QColor color, qreal alpha ) const; | ||
61 | 62 | | |||
62 | //* mouse over color | | |||
63 | QColor hoverColor( const QPalette& palette ) const | | |||
64 | { return _viewHoverBrush.brush( palette ).color(); } | | |||
65 | | ||||
66 | //* focus color | 63 | //* focus color | ||
67 | QColor focusColor( const QPalette& palette ) const | 64 | QColor focusColor( const QPalette& palette ) const | ||
68 | { return _viewFocusBrush.brush( palette ).color(); } | 65 | { return palette.color( QPalette::Active, QPalette::Highlight ); } | ||
66 | | ||||
67 | //* focus/selection background color | ||||
68 | QColor focusBackgroundColor( const QPalette& palette ) const | ||||
69 | { return palette.color( QPalette::Inactive, QPalette::Highlight ); } | ||||
70 | | ||||
71 | //* button alternate background color | ||||
72 | QColor buttonAltBackgroundColor( const QPalette& palette ) const | ||||
73 | { return _buttonAltBackgroundBrush.brush( palette ).color(); } | ||||
74 | | ||||
75 | //* mouse over color | ||||
76 | QColor hoverColor( const QPalette& palette, const QColor& color = nullptr ) const | ||||
77 | { | ||||
78 | return KColorUtils::tint( color.isValid() ? color : separatorColor( palette ), | ||||
79 | focusColor( palette ), 0.5 ); | ||||
80 | } | ||||
81 | | ||||
82 | //* mouse over background color | ||||
83 | QColor hoverBackgroundColor( const QPalette& palette, const QColor& color = nullptr ) const | ||||
84 | { | ||||
85 | return KColorUtils::mix( color.isValid() ? color : palette.color( QPalette::Button ), | ||||
86 | buttonAltBackgroundColor( palette ), 0.5 ); | ||||
87 | } | ||||
69 | 88 | | |||
70 | //* negative text color (used for close button) | 89 | //* negative text color (used for close button) | ||
71 | QColor negativeText( const QPalette& palette ) const | 90 | QColor negativeText( const QPalette& palette ) const | ||
72 | { return _viewNegativeTextBrush.brush( palette ).color(); } | 91 | { return _viewNegativeTextBrush.brush( palette ).color(); } | ||
73 | 92 | | |||
74 | //* shadow | 93 | //* shadow | ||
75 | QColor shadowColor( const QPalette& palette ) const | 94 | QColor shadowColor( const QPalette& palette ) const | ||
76 | { return alphaColor( palette.color( QPalette::Shadow ), 0.15 ); } | 95 | { return alphaColor( palette.color( QPalette::Shadow ), 0.15 ); } | ||
▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Line(s) | |||||
305 | 324 | | |||
306 | private: | 325 | private: | ||
307 | 326 | | |||
308 | //* configuration | 327 | //* configuration | ||
309 | KSharedConfig::Ptr _config; | 328 | KSharedConfig::Ptr _config; | ||
310 | 329 | | |||
311 | //*@name brushes | 330 | //*@name brushes | ||
312 | //@{ | 331 | //@{ | ||
313 | KStatefulBrush _viewFocusBrush; | | |||
314 | KStatefulBrush _viewHoverBrush; | | |||
315 | KStatefulBrush _viewNegativeTextBrush; | 332 | KStatefulBrush _viewNegativeTextBrush; | ||
333 | KStatefulBrush _buttonAltBackgroundBrush; | ||||
316 | //@} | 334 | //@} | ||
317 | 335 | | |||
318 | //*@name windeco colors | 336 | //*@name windeco colors | ||
319 | //@{ | 337 | //@{ | ||
320 | QColor _activeTitleBarColor; | 338 | QColor _activeTitleBarColor; | ||
321 | QColor _activeTitleBarTextColor; | 339 | QColor _activeTitleBarTextColor; | ||
322 | QColor _inactiveTitleBarColor; | 340 | QColor _inactiveTitleBarColor; | ||
323 | QColor _inactiveTitleBarTextColor; | 341 | QColor _inactiveTitleBarTextColor; | ||
324 | //@} | 342 | //@} | ||
325 | 343 | | |||
326 | }; | 344 | }; | ||
327 | 345 | | |||
328 | } | 346 | } | ||
329 | 347 | | |||
330 | #endif | 348 | #endif |