Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csSkinSlice Class Reference

A `skin slice' is responsible for managing the external view of a certain component. More...

#include <csskin.h>

Inheritance diagram for csSkinSlice:

csButtonSkin csDialogSkin csListBoxItemSkin csListBoxSkin csScrollBarSkin csTitlebarSkin csWindowSkin csDefaultButtonSkin csDefaultDialogSkin csDefaultListBoxItemSkin csDefaultListBoxSkin csDefaultScrollBarSkin csDefaultTitlebarSkin csDefaultWindowSkin List of all members.

Public Methods

virtual ~csSkinSlice ()
 Destroy this skin slice.

virtual void Initialize (csApp *, csSkin *)
 Initialize the skin slice, if desired, by querying any information you want from given application object. More...

virtual void Deinitialize ()
 This method is called from application's destructor. More...

virtual const char* GetName ()=0
 Get the identifier of the component this skin slice is for.

virtual void Apply (csComponent &This)
 Initialize the object we are responsible for: called once we set the skin.

virtual void Reset (csComponent &This)
 Reset a component to its "default" state. More...

virtual void Draw (csComponent &This)=0
 Draw the component we are responsible for.


Detailed Description

A `skin slice' is responsible for managing the external view of a certain component.

Every `skin slice' is designed to take care of some specific component type; you should be careful to provide all `slices' for all used types of components, otherwise the windowing system will print a error message and abort the program. Every csComponent has a pointer to a csSkinSlice object inside, which points to the respective object responsible for his exterior.

This is an abstract class, meant to be uses as a common parent for all derived classes. Since some derived objects will implement additional functionality over the basic csSkinSlice functionality, it is recommended to define a SKIN macro at the top of every file with the implementation of the respective component like this:

define SKIN ((csDefaultButtonSkin *)skinslice)

Then you can use the SKIN macro as if it was a member variable. Note that the safety of the typecast is guaranteed by the uniquity of the string returned by the csSkinSlice::GetName() method.

Also note that most skin slices don't have a constructor. This is because skin slices are usually created before the application, thus you don't have any place to gather initialization information from. If you need to query some data from the application (e.g. some textures and so on) you will have to overload the Initialize() virtual method.


Member Function Documentation

void csSkinSlice::Deinitialize ( ) [inline, virtual]
 

This method is called from application's destructor.

The skin should free any resources allocated in Initialize() here, because later (at destructor time) some plugins (e.g. the texture manager) may be unloaded already. It is legal to call Deinitialize() multiple times; if the resources were already freed, the method should do nothing.

Reimplemented in csDefaultWindowSkin, csDefaultDialogSkin, and csDefaultTitlebarSkin.

void csSkinSlice::Initialize ( csApp * iApp,
csSkin * Parent ) [inline, virtual]
 

Initialize the skin slice, if desired, by querying any information you want from given application object.

At the time this routine is called, the application is fully initialized, configuration file is opened, textures are loaded and so on. This method is called once from csApp::Initialize() method and also every time you call csApp::SetSkin().

Reimplemented in csDefaultWindowSkin, csDefaultDialogSkin, and csDefaultTitlebarSkin.

void csSkinSlice::Reset ( csComponent & This ) [virtual]
 

Reset a component to its "default" state.

This removes the custom palette if any, resets component size etc. This is usually called by skin slices inside Apply() method before applying any changes to the component. If the component has the `skinslice' non-NULL, the Initialize() method calls this method of the old skin slice so that it will restore the component to the initial state.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000