ThemeManager Class Reference

The graphics theme manager. More...

#include <thememanager.h>

List of all members.

Public Member Functions

 ThemeManager (QString themefile, QObject *parent, int initialSize=1)
 Constructor for the theme manager.
const QPixmap getPixmap (QString svgid, QSize size)
 Load a pixmap from the SVG theme file.
const QPixmap getPixmap (QString svgid, double width)
 Load a pixmap from the SVG theme file.
const QPixmap getPixmap (QString svgid, QString svgref, double refwidth)
 Load a pixmap from the SVG theme file.
double getScale ()
 Retreive the current scale of the theme.
KConfigGroup config (QString id)
 Retrieve the current theme configuration object.
void registerTheme (Themable *ob)
 Register an object with the theme manager.
void unregisterTheme (Themable *ob)
 Unregister an object with the theme manager.
void updateTheme (Themable *ob)
 Forces an update to a theme objects.
void updateTheme (QString themefile)
 Forces an update to all theme objects.
void rescale (int scale)
 Change the scale of the theme and update all registered theme objects.


Detailed Description

The graphics theme manager.

The theme manager holds a list of all Themable objects and notifies them in the event of a theme change so that the objects can then redraw. It also allows access to the theme configuration file and reads pixmaps from an SVG file given a certain size or scale. The pixmaps are cached so that the same pixmap is retrieved from the cache on not rendered again.

Definition at line 105 of file thememanager.h.


Constructor & Destructor Documentation

ThemeManager::ThemeManager QString  themefile,
QObject *  parent,
int  initialSize = 1
 

Constructor for the theme manager.

Parameters:
themefile The theme configuration file
parent The parent object
initialSize Initial theme size, can be arbitrary.

Definition at line 39 of file thememanager.cpp.

References updateTheme().

Here is the call graph for this function:


Member Function Documentation

KConfigGroup ThemeManager::config QString  id  ) 
 

Retrieve the current theme configuration object.

Returns:
The configuration object.

Definition at line 130 of file thememanager.cpp.

Referenced by ScoreSprite::changeTheme(), PixmapSprite::changeTheme(), DisplayGame::changeTheme(), DisplayGame::displayHint(), DisplayGame::displayPiece(), DisplayGame::displayStar(), PixmapSprite::getDoubleValue(), ScoreSprite::setTurn(), DisplayGame::start(), and updateTheme().

const QPixmap ThemeManager::getPixmap QString  svgid,
QString  svgref,
double  refwidth
 

Load a pixmap from the SVG theme file.

Its filename is given in the "general" section of the theme file as "svgfile". The pixmap is scaled with reference to another SVG item. This allows to generate a set of pixmaps with related sizes.

Parameters:
svgid The ID of the SVG item to be rendered as pixmap
svgref The ID of the SVG item used as width reference
refwidth The width of the resulting pixmap in relation to the reference item
Returns:
The new pixmap.

Definition at line 183 of file thememanager.cpp.

References getPixmap().

Here is the call graph for this function:

const QPixmap ThemeManager::getPixmap QString  svgid,
double  width
 

Load a pixmap from the SVG theme file.

Its filename is given in the "general" section of the theme file as "svgfile". The pixmap is scaled to the given width. The height is relative to the width as given in the SVG file.

Parameters:
svgid The ID of the SVG item to be rendered as pixmap
width The width of the resulting pixmap
Returns:
The new pixmap.

Definition at line 172 of file thememanager.cpp.

References getPixmap().

Here is the call graph for this function:

const QPixmap ThemeManager::getPixmap QString  svgid,
QSize  size
 

Load a pixmap from the SVG theme file.

Its filename is given in the "general" section of the theme file as "svgfile". The pixmap is scaled to the given size.

Parameters:
svgid The ID of the SVG item to be rendered as pixmap
size The size of the resulting pixmap
Returns:
The new pixmap.

Definition at line 138 of file thememanager.cpp.

Referenced by DisplayGame::changeTheme(), and getPixmap().

double ThemeManager::getScale  ) 
 

Retreive the current scale of the theme.

Returns:
The scale.

Definition at line 123 of file thememanager.cpp.

Referenced by PixmapSprite::changeTheme().

void ThemeManager::registerTheme Themable ob  ) 
 

Register an object with the theme manager.

Parameters:
ob The object to be registered.

Definition at line 48 of file thememanager.cpp.

Referenced by Themable::Themable().

void ThemeManager::rescale int  scale  ) 
 

Change the scale of the theme and update all registered theme objects.

If the scale did not change no action is performed!

Parameters:
scale The new scale (maximum extension)

Definition at line 106 of file thememanager.cpp.

References Themable::changeTheme().

Referenced by KWin4View::KWin4View(), and KWin4View::resizeEvent().

Here is the call graph for this function:

void ThemeManager::unregisterTheme Themable ob  ) 
 

Unregister an object with the theme manager.

Parameters:
ob The object to be unregistered.

Definition at line 55 of file thememanager.cpp.

Referenced by Themable::~Themable().

void ThemeManager::updateTheme QString  themefile  ) 
 

Forces an update to all theme objects.

That is their changeTheme() method is called. Before this a (new) theme file is loaded and all cached pixmaps deleted. This is used to really change one theme over to another one.

Parameters:
themefile The theme file to load

Definition at line 70 of file thememanager.cpp.

References Themable::changeTheme(), and config().

Here is the call graph for this function:

void ThemeManager::updateTheme Themable ob  ) 
 

Forces an update to a theme objects.

That is its changeTheme() method is called.

Parameters:
ob The object to be updated.

Definition at line 62 of file thememanager.cpp.

References Themable::changeTheme().

Referenced by KWin4App::changeTheme(), IntroSprite::IntroSprite(), PieceSprite::PieceSprite(), PixmapSprite::PixmapSprite(), and ThemeManager().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Sun Mar 4 10:56:43 2007 for KWin4 by  doxygen 1.4.6