• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
theme.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_THEME_H
21#define PLASMA_THEME_H
22
23#include <QtCore/QObject>
24#include <QtGui/QFont>
25#include <QtGui/QFontMetrics>
26
27#include <kplugininfo.h>
28#include <ksharedconfig.h>
29
30#include <plasma/plasma_export.h>
31#include <plasma/packagestructure.h>
32
33namespace Plasma
34{
35
36class ThemePrivate;
37
56class PLASMA_EXPORT Theme : public QObject
57{
58 Q_OBJECT
59 Q_PROPERTY(QString themeName READ themeName)
60
61 public:
62 enum ColorRole {
63 TextColor = 0,
64 HighlightColor = 1,
66 BackgroundColor = 2,
67 ButtonTextColor = 4,
68 ButtonBackgroundColor = 8,
69 LinkColor = 16,
70 VisitedLinkColor = 32,
71 ButtonHoverColor = 64,
72 ButtonFocusColor = 128,
73 ViewTextColor = 256,
74 ViewBackgroundColor = 512,
75 ViewHoverColor = 1024,
76 ViewFocusColor = 2048
77 };
78
79 enum FontRole {
80 DefaultFont = 0,
81 DesktopFont,
82 SmallestFont
83 };
84
88 static Theme *defaultTheme();
89
95 explicit Theme(QObject *parent = 0);
96
104 explicit Theme(const QString &themeName, QObject *parent = 0);
105
106 ~Theme();
107
111 static PackageStructure::Ptr packageStructure();
112
117 static KPluginInfo::List listThemeInfo();
118
122 void setThemeName(const QString &themeName);
123
127 QString themeName() const;
128
136 Q_INVOKABLE QString imagePath(const QString &name) const;
137
145 Q_INVOKABLE QString animationPath(const QString &name) const;
146
154 Q_INVOKABLE QString wallpaperPath(const QSize &size = QSize()) const;
155
163 Q_INVOKABLE bool currentThemeHasImage(const QString &name) const;
164
170 Q_INVOKABLE KSharedConfigPtr colorScheme() const;
171
177 Q_INVOKABLE QColor color(ColorRole role) const;
178
186 Q_INVOKABLE void setFont(const QFont &font, FontRole role = DefaultFont);
187
193 Q_INVOKABLE QFont font(FontRole role) const;
194
198 Q_INVOKABLE QFontMetrics fontMetrics() const;
199
203 Q_INVOKABLE bool windowTranslucencyEnabled() const;
204
211 void setUseGlobalSettings(bool useGlobal);
212
217 bool useGlobalSettings() const;
218
223 bool useNativeWidgetStyle() const;
224
262 Q_INVOKABLE QString styleSheet(const QString &css = QString()) const;
263
264
273 bool findInCache(const QString &key, QPixmap &pix);
274
287 bool findInCache(const QString &key, QPixmap &pix, unsigned int lastModified);
288
297 void insertIntoCache(const QString& key, const QPixmap& pix);
298
317 void insertIntoCache(const QString& key, const QPixmap& pix, const QString& id);
318
327 void setCacheLimit(int kbytes);
328
338 bool findInRectsCache(const QString &image, const QString &element, QRectF &rect) const;
339
349 QStringList listCachedRectKeys(const QString &image) const;
350
358 void insertIntoRectsCache(const QString& image, const QString &element, const QRectF &rect);
359
365 void invalidateRectsCache(const QString &image);
366
374 void releaseRectsCache(const QString &image);
375
380 KUrl homepage() const;
381
385 int toolTipDelay() const;
386
387 Q_SIGNALS:
396 void themeChanged();
397
398 public Q_SLOTS:
403 void settingsChanged();
404
405 private:
406 friend class ThemeSingleton;
407 friend class ThemePrivate;
408 ThemePrivate *const d;
409
410 Q_PRIVATE_SLOT(d, void compositingChanged(bool))
411 Q_PRIVATE_SLOT(d, void colorsChanged())
412 Q_PRIVATE_SLOT(d, void blurBehindChanged(bool blur))
413 Q_PRIVATE_SLOT(d, void settingsFileChanged(const QString &))
414 Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
415 Q_PRIVATE_SLOT(d, void onAppExitCleanup())
416 Q_PRIVATE_SLOT(d, void notifyOfChanged())
417};
418
419} // Plasma namespace
420
421#endif // multiple inclusion guard
422
Plasma::PackageStructure::Ptr
KSharedPtr< PackageStructure > Ptr
Definition: packagestructure.h:77
Plasma::Theme
Interface to the Plasma theme.
Definition: theme.h:57
Plasma::Theme::themeChanged
void themeChanged()
Emitted when the user changes the theme.
Plasma::Theme::FontRole
FontRole
Definition: theme.h:79
Plasma::Theme::DesktopFont
@ DesktopFont
The standard text font.
Definition: theme.h:81
Plasma::Theme::ColorRole
ColorRole
Definition: theme.h:62
QObject
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
Plasma::packageStructure
PackageStructure::Ptr packageStructure(const QString &language, ComponentType type)
Loads an appropriate PackageStructure for the given language and type.
Definition: scriptengine.cpp:274
packagestructure.h
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal