Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZSkin Class Reference

Implements the application skin. More...

#include <ZSkin.h>

Inheritance diagram for ZSkin::

ZResReader List of all members.

Public Methods

virtual bool exists (const QString &ID) const
virtual QPixmap getQPixmap (const QString &ID) const
 get a QPixmap associated with a resource ID. More...

virtual QImage getQImage (const QString &ID) const
 get a QImage associated with a resource ID. More...

virtual QBitmap getQBitmap (const QString &ID) const
 get a QBitmap associated with a resource ID. More...

virtual QMovie getQMovie (const QString &ID) const
 get a QMovie associated with a resource ID. More...

virtual bool get (const QString &ID, unsigned char **ppOutData, int *pOutLength) const
 get the data associated with a resource ID. More...


Static Public Methods

const ZSkin& skin ()
 get a reference to the application's skin. More...

void reloadSkin ()
 reload the default skin. More...


Protected Methods

 ZSkin ()
virtual ~ZSkin ()
 ZSkin (const QString &systemBaseName, const QString &systemSkinName, const QString &applicationBaseName, const QString &applicationSkinName)
void init (const QString &systemBaseName, const QString &systemSkinName, const QString &applicationBaseName, const QString &applicationSkinName)

Protected Attributes

ZResFileReadersystemBase
ZResFileReadersystemSkin
ZResFileReaderappBase
ZResFileReaderappSkin

Static Protected Attributes

ZSkin* defaultSkin

Detailed Description

Implements the application skin.

The application skin is a stack of between zero and four resource files, the application skin, the applicaiton base, the system skin, and the system base.

 void myClass::myFunc(...)
 {
     // skin is const (read-only)
     const ZSkin& skin = ZSkin::skin();   
     
     QPixmap pm = skin.getPixmap("CST_Back_O.g");
     // pm now contains the pixmap for the 'back' button overlay.

     void *data;
     int length;

     if (skin.get("somedata.dat", &data, &length))
     {
          printf("somedata.dat is located at 0x%08x and is of length %d",
                 data, length);
     }
     else
     {
          printf("somedata.dat could not be found");
     }
 }


Constructor & Destructor Documentation

ZSkin::ZSkin ( ) [protected]
 

ZSkin::~ZSkin ( ) [protected, virtual]
 

ZSkin::ZSkin ( const QString & systemBaseName,
const QString & systemSkinName,
const QString & applicationBaseName,
const QString & applicationSkinName ) [protected]
 


Member Function Documentation

bool ZSkin::exists ( const QString & ID ) const [virtual]
 

Returns:
bool indicating whether or not a resource exists

Reimplemented from ZResReader.

bool ZSkin::get ( const QString & ID,
unsigned char ** ppOutData,
int * pOutLength ) const [virtual]
 

get the data associated with a resource ID.

Note:
Do not delete/de-allocate the pointer returned from this function.

Reimplemented from ZResReader.

QBitmap ZSkin::getQBitmap ( const QString & ID ) const [virtual]
 

get a QBitmap associated with a resource ID.

Parameters:
ID   is the resource ID of the pixmap ("name.bmp")

QImage ZSkin::getQImage ( const QString & ID ) const [virtual]
 

get a QImage associated with a resource ID.

Parameters:
ID   is the resource ID of the pixmap ("name.g")

Note:
resource IDs for graphics do not maintain the file-extension of the file stored on disk (.gif, .jpg, etc.). When put into the resource file, the all are changed to .g

QMovie ZSkin::getQMovie ( const QString & ID ) const [virtual]
 

get a QMovie associated with a resource ID.

Parameters:
ID   is the resource ID of the pixmap ("name.swf")

QPixmap ZSkin::getQPixmap ( const QString & ID ) const [virtual]
 

get a QPixmap associated with a resource ID.

Parameters:
ID   is the resource ID of the pixmap ("name.g")

Note:
resource IDs for graphics do not maintain the file-extension of the file stored on disk (.gif, .jpg, etc.). When put into the resource file, the all are changed to .g

void ZSkin::init ( const QString & systemBaseName,
const QString & systemSkinName,
const QString & applicationBaseName,
const QString & applicationSkinName ) [protected]
 

void ZSkin::reloadSkin ( ) [static]
 

reload the default skin.

For internal use only.

const ZSkin & ZSkin::skin ( ) [static]
 

get a reference to the application's skin.


Member Data Documentation

ZResFileReader * ZSkin::appBase [protected]
 

ZResFileReader * ZSkin::appSkin [protected]
 

ZSkin * ZSkin::defaultSkin [static, protected]
 

ZResFileReader * ZSkin::systemBase [protected]
 

ZResFileReader * ZSkin::systemSkin [protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Mar 3 13:23:12 2004 by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001