libplasma
theme.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_THEME_H
00021 #define PLASMA_THEME_H
00022
00023 #include <QtCore/QObject>
00024 #include <QtGui/QFont>
00025 #include <QtGui/QFontMetrics>
00026
00027 #include <KDE/KSharedConfig>
00028
00029 #include <plasma/plasma_export.h>
00030 #include <plasma/packagestructure.h>
00031
00032 namespace Plasma
00033 {
00034
00035 class ThemePrivate;
00036
00053 class PLASMA_EXPORT Theme : public QObject
00054 {
00055 Q_OBJECT
00056 Q_PROPERTY( QString themeName READ themeName )
00057
00058 public:
00059 enum ColorRole
00060 {
00061 TextColor = 0 ,
00062 HighlightColor = 1 ,
00063 BackgroundColor = 2
00064 };
00065
00066 enum FontRole
00067 {
00068 DefaultFont = 0
00069 };
00070
00074 static Theme* defaultTheme();
00075
00079 explicit Theme( QObject* parent = 0 );
00080 ~Theme();
00081
00085 static PackageStructure::Ptr packageStructure();
00086
00090 void setThemeName(const QString &themeName);
00091
00095 QString themeName() const;
00096
00104 Q_INVOKABLE QString imagePath(const QString& name) const;
00105
00113 Q_INVOKABLE QString wallpaperPath(const QSize &size = QSize()) const;
00114
00122 Q_INVOKABLE bool currentThemeHasImage(const QString& name) const;
00123
00129 Q_INVOKABLE KSharedConfigPtr colorScheme() const;
00130
00136 Q_INVOKABLE QColor color(ColorRole role) const;
00137
00145 Q_INVOKABLE void setFont(const QFont &font, FontRole role = DefaultFont);
00146
00152 Q_INVOKABLE QFont font(FontRole role) const;
00153
00157 Q_INVOKABLE QFontMetrics fontMetrics() const;
00158
00162 Q_INVOKABLE bool windowTranslucencyEnabled() const;
00163
00170 void setUseGlobalSettings(bool useGlobal);
00171
00176 bool useGlobalSettings() const;
00177
00178 Q_SIGNALS:
00183 void themeChanged();
00184
00185 public Q_SLOTS:
00190 void settingsChanged();
00191
00192 private:
00193 friend class ThemeSingleton;
00194 friend class ThemePrivate;
00195 ThemePrivate* const d;
00196
00197 Q_PRIVATE_SLOT(d, void compositingChanged())
00198 };
00199
00200 }
00201
00202 #endif // multiple inclusion guard
00203