• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

Plasma::Theme

Plasma::Theme Class Reference

#include <theme.h>

Inheritance diagram for Plasma::Theme:

Inheritance graph
[legend]

List of all members.


Detailed Description

Interface to the Plasma theme.

Accessed via Plasma::Theme::defaultTheme() e.g:

 QString imagePath = Plasma::Theme::defaultTheme()->imagePath("widgets/clock")

Plasma::Theme provides access to a common and standardized set of graphic elements stored in SVG format. This allows artists to create single packages of SVGs that will affect the look and feel of all workspace components.

Plasma::Svg uses Plasma::Theme internally to locate and load the appropriate SVG data. Alternatively, Plasma::Theme can be used directly to retrieve file system paths to SVGs by name.

Definition at line 53 of file theme.h.


Public Types

enum  ColorRole { TextColor = 0, HighlightColor = 1, BackgroundColor = 2 }
enum  FontRole { DefaultFont = 0 }

Public Slots

void settingsChanged ()

Signals

void themeChanged ()

Public Member Functions

Q_INVOKABLE QColor color (ColorRole role) const
Q_INVOKABLE KSharedConfigPtr colorScheme () const
Q_INVOKABLE bool currentThemeHasImage (const QString &name) const
Q_INVOKABLE QFont font (FontRole role) const
Q_INVOKABLE QFontMetrics fontMetrics () const
Q_INVOKABLE QString imagePath (const QString &name) const
Q_INVOKABLE void setFont (const QFont &font, FontRole role=DefaultFont)
void setThemeName (const QString &themeName)
void setUseGlobalSettings (bool useGlobal)
 Theme (QObject *parent=0)
QString themeName () const
bool useGlobalSettings () const
Q_INVOKABLE QString wallpaperPath (const QSize &size=QSize()) const
Q_INVOKABLE bool windowTranslucencyEnabled () const
 ~Theme ()

Static Public Member Functions

static Theme * defaultTheme ()
static PackageStructure::Ptr packageStructure ()

Properties

QString themeName

Member Enumeration Documentation

enum Plasma::Theme::ColorRole

Enumerator:
TextColor  the text color to be used by items resting on the background
HighlightColor  the text higlight color to be used by items resting on the background
BackgroundColor  the default background color

Definition at line 59 of file theme.h.

enum Plasma::Theme::FontRole

Enumerator:
DefaultFont  The standard text font.

Definition at line 66 of file theme.h.


Constructor & Destructor Documentation

Plasma::Theme::Theme ( QObject *  parent = 0  )  [explicit]

Default constructor.

Usually you want to use the singleton instead.

Definition at line 167 of file theme.cpp.

Plasma::Theme::~Theme (  ) 

Definition at line 188 of file theme.cpp.


Member Function Documentation

QColor Plasma::Theme::color ( ColorRole  role  )  const

Returns the text color to be used by items resting on the background.

  • role which role (usage pattern) to get the color for

Definition at line 358 of file theme.cpp.

KSharedConfigPtr Plasma::Theme::colorScheme (  )  const

Returns the color scheme configurationthat goes along this theme.

This can be used with KStatefulBrush and KColorScheme to determine the proper colours to use along with the visual elements in this theme.

Definition at line 353 of file theme.cpp.

bool Plasma::Theme::currentThemeHasImage ( const QString &  name  )  const

Checks if this theme has an image named in a certain way.

  • name the name of the file in the theme directory (without the ".svg" part or a leading slash)
    Returns:
    true if the image exists for this theme

Definition at line 348 of file theme.cpp.

Theme * Plasma::Theme::defaultTheme (  )  [static]

Singleton pattern accessor.

Definition at line 162 of file theme.cpp.

QFont Plasma::Theme::font ( FontRole  role  )  const

Returns the font to be used by themed items.

  • role which role (usage pattern) to get the font for

Definition at line 385 of file theme.cpp.

QFontMetrics Plasma::Theme::fontMetrics (  )  const

Returns the font metrics for the font to be used by themed items.

Definition at line 391 of file theme.cpp.

QString Plasma::Theme::imagePath ( const QString &  name  )  const

Retrieve the path for an SVG image in the current theme.

  • name the name of the file in the theme directory (without the ".svg" part or a leading slash)
    Returns:
    the full path to the requested file for the current theme

Definition at line 283 of file theme.cpp.

PackageStructure::Ptr Plasma::Theme::packageStructure (  )  [static]

Returns:
a package structure representing a Theme

Definition at line 193 of file theme.cpp.

void Plasma::Theme::setFont ( const QFont &  font,
FontRole  role = DefaultFont 
)

Sets the default font to be used with themed items.

Defaults to the application wide default font.

  • font the new font
  • role which role (usage pattern) to set the font for

Definition at line 379 of file theme.cpp.

void Plasma::Theme::setThemeName ( const QString &  themeName  ) 

Sets the current theme being used.

Definition at line 207 of file theme.cpp.

void Plasma::Theme::settingsChanged (  )  [slot]

Notifies the Theme object that the theme settings have changed and should be read from the config file.

Definition at line 202 of file theme.cpp.

void Plasma::Theme::setUseGlobalSettings ( bool  useGlobal  ) 

Tells the theme whether to follow the global settings or use application specific settings.

  • useGlobal pass in true to follow the global settings

Definition at line 402 of file theme.cpp.

void Plasma::Theme::themeChanged (  )  [signal]

Emitted when the user changes the theme.

SVGs should be reloaded at that point

QString Plasma::Theme::themeName (  )  const

Returns:
the name of the theme.

bool Plasma::Theme::useGlobalSettings (  )  const

Returns:
true if the global settings are followed, false if application specific settings are used.

Definition at line 414 of file theme.cpp.

QString Plasma::Theme::wallpaperPath ( const QSize &  size = QSize()  )  const

Retreives the default wallpaper associated with this theme.

  • size the target height and width of the wallpaper; if an invalid size is passed in, then a default size will be provided instead.
    Returns:
    the full path to the wallpaper image

Definition at line 298 of file theme.cpp.

bool Plasma::Theme::windowTranslucencyEnabled (  )  const

Returns if the window manager effects (e.g.

translucency, compositing) is active or not

Definition at line 397 of file theme.cpp.


Property Documentation

QString Plasma::Theme::themeName [read]

Definition at line 56 of file theme.h.


The documentation for this class was generated from the following files:
  • theme.h
  • theme.cpp

libplasma

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

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal