add hover and focus colors for view elements to Plasma::Theme::color()

svn path=/trunk/KDE/kdelibs/; revision=1184285
This commit is contained in:
Manuel Mommertz 2010-10-09 18:14:11 +00:00
parent 86a15c25a0
commit 8bab6af5ff
2 changed files with 15 additions and 1 deletions

View File

@ -330,6 +330,8 @@ const QString ThemePrivate::processStyleSheet(const QString &css)
stylesheet += skel.arg("ViewText","%viewtextcolor"); stylesheet += skel.arg("ViewText","%viewtextcolor");
stylesheet += skel.arg("ViewBackground","%viewbackgroundcolor"); stylesheet += skel.arg("ViewBackground","%viewbackgroundcolor");
stylesheet += skel.arg("ViewHover","%viewhovercolor");
stylesheet += skel.arg("ViewFocus","%viewfocuscolor");
stylesheet = processStyleSheet(stylesheet); stylesheet = processStyleSheet(stylesheet);
} }
@ -364,6 +366,10 @@ const QString ThemePrivate::processStyleSheet(const QString &css)
Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewTextColor).name(); Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewTextColor).name();
elements["%viewbackgroundcolor"] = elements["%viewbackgroundcolor"] =
Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewBackgroundColor).name(); Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewBackgroundColor).name();
elements["%viewhovercolor"] =
Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewHoverColor).name();
elements["%viewfocuscolor"] =
Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewFocusColor).name();
elements["%smallfontsize"] = elements["%smallfontsize"] =
QString("%1pt").arg(KGlobalSettings::smallestReadableFont().pointSize()); QString("%1pt").arg(KGlobalSettings::smallestReadableFont().pointSize());
@ -796,6 +802,12 @@ QColor Theme::color(ColorRole role) const
case ViewBackgroundColor: case ViewBackgroundColor:
return d->viewColorScheme.background(KColorScheme::NormalBackground).color(); return d->viewColorScheme.background(KColorScheme::NormalBackground).color();
case ViewHoverColor:
return d->viewColorScheme.decoration(KColorScheme::HoverColor).color();
case ViewFocusColor:
return d->viewColorScheme.decoration(KColorScheme::FocusColor).color();
case LinkColor: case LinkColor:
return d->viewColorScheme.foreground(KColorScheme::LinkText).color(); return d->viewColorScheme.foreground(KColorScheme::LinkText).color();

View File

@ -71,7 +71,9 @@ class PLASMA_EXPORT Theme : public QObject
ButtonHoverColor = 64, /** color for hover effect on buttons */ ButtonHoverColor = 64, /** color for hover effect on buttons */
ButtonFocusColor = 128, /** color for focus effect on buttons */ ButtonFocusColor = 128, /** color for focus effect on buttons */
ViewTextColor = 256, /** text color for views */ ViewTextColor = 256, /** text color for views */
ViewBackgroundColor = 512 /** background color for views */ ViewBackgroundColor = 512, /** background color for views */
ViewHoverColor = 1024, /** color for hover effect on view */
ViewFocusColor = 2048 /** color for focus effect on view */
}; };
enum FontRole { enum FontRole {