UiFileTheme Class Reference
[User interface]

A theme-class, which loads its data from a text based file. More...

#include <uifiletheme.h>

Inheritance diagram for UiFileTheme:

Inheritance graph
[legend]
Collaboration diagram for UiFileTheme:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC UiFileTheme (const char *fn, const char *name=0)
virtual DECLSPEC const char * getString (const char *usage, int *length=0)
virtual DECLSPEC Uint32 getUint32 (const char *usage, bool *found=0)
virtual DECLSPEC bool getBool (const char *usage, bool *found=0)
virtual DECLSPEC SDL_Rect getRect (const char *usage)
virtual DECLSPEC const char * translate (const char *text)

Protected Member Functions

virtual DECLSPEC Uint32 onLoad (bool hidden)
virtual DECLSPEC Uint32 onActivate ()
virtual DECLSPEC Uint32 onDeactivate ()
virtual bool isLoaded ()

Classes

struct  FONTINFO
struct  INFO

Detailed Description

A theme-class, which loads its data from a text based file.

This class makes it very easy to use and edit themes, because it loads the data for look and feel from a text based file. This can easily be configured with any text editor.
Also translating text is done by a text based file, using UiFileTranslator.

Todo:
create an UiXMLTheme class for reading themes from an XML based format.
See also:
ThemeManager, UiTranslator, UiFileTranslator


Constructor & Destructor Documentation

UiFileTheme::UiFileTheme ( const char *  fn,
const char *  name = 0 
)

Constructor.

Parameters:
fn the filename of the theme's configuration data
name the theme's name
See also:
UiTheme::UiTheme( const char * )


Member Function Documentation

const char * UiFileTheme::getString ( const char *  usage,
int *  length = 0 
) [virtual]

Get a theme-specific string.

Parameters:
usage a string that says what for the result is needed.
length if not NULL, the length of the string will be copied there or zero, if the usage-string is invalid
Returns:
a string with the data or NULL, if the usage-string could not be found

Implements UiTheme.

Uint32 UiFileTheme::getUint32 ( const char *  usage,
bool *  found = 0 
) [virtual]

Get a theme-specific number.

Parameters:
usage a string that says what for the result is needed.
found if not NULL, it's content will become true, if the "usage" could be found and false, if it could not be found
Returns:
the corresponding number to "usage" and zero, if "usage" was not found

Implements UiTheme.

bool UiFileTheme::getBool ( const char *  usage,
bool *  found = 0 
) [virtual]

Get a theme-specific boolean value.

Parameters:
usage a string that says what for the result is needed.
found if not NULL, it's content will become true, if the "usage" could be found and false, if it could not be found
Returns:
the corresponding value to "usage" and always false, if "usage" was not found

Implements UiTheme.

SDL_Rect UiFileTheme::getRect ( const char *  usage  )  [virtual]

Get a theme-specific rect.

Parameters:
usage a string that says what for the result is needed.
Returns:
the corresponding rect to "usage", or an empty rect, if "usage" was not found

Implements UiTheme.

const char * UiFileTheme::translate ( const char *  text  )  [virtual]

Translates a text-string to the theme's language.

Parameters:
text the string to translate (NULL not allowed!)
Returns:
the translated string or text, if it could not be translated. Never returns NULL!
See also:
UiTranslator

Implements UiTheme.

Uint32 UiFileTheme::onLoad ( bool  hidden  )  [protected, virtual]

This event will be called, when the theme should load it's data.

Parameters:
hidden if true, the screen is not used to display a progressbar/...; if false the progress may be shown by the loading theme
Returns:
zero, if everything could be loaded successfully, and anything else, if it failed

Implements UiTheme.

Uint32 UiFileTheme::onActivate (  )  [protected, virtual]

This event will be called, before the theme becomes active.

Returns:
zero, if it can be used now, and anything else, if not

Implements UiTheme.

Uint32 UiFileTheme::onDeactivate (  )  [protected, virtual]

This event will be called, when the theme becomes inactive.

Returns:
zero (recommended), but the result is currently not used

Implements UiTheme.

virtual bool UiFileTheme::isLoaded (  )  [inline, protected, virtual]

Returns:
true, if the theme's data is loaded, false if not

Implements UiTheme.


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:36 2007 for netrinjo by  doxygen 1.5.1