csSkinSlice Class Reference
[Skin support]
A `skin slice' is responsible for managing the external view of a certain component.
More...
#include <csws/csskin.h>
Inheritance diagram for csSkinSlice:

Public Member Functions | |
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. | |
virtual void | Deinitialize () |
This method is called from application's destructor. | |
virtual const char * | GetName () const =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. | |
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.
Definition at line 72 of file csskin.h.
Constructor & Destructor Documentation
|
Destroy this skin slice.
Definition at line 76 of file csskin.h. References Deinitialize(). |
Member Function Documentation
|
Initialize the object we are responsible for: called once we set the skin.
|
|
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. Definition at line 97 of file csskin.h. Referenced by ~csSkinSlice(). |
|
Draw the component we are responsible for.
Implemented in csDefaultButtonSkin, csDefaultWindowSkin, csDefaultDialogSkin, csDefaultTitlebarSkin, csDefaultListBoxSkin, csDefaultListBoxItemSkin, and csDefaultScrollBarSkin. |
|
Get the identifier of the component this skin slice is for.
Implemented in csButtonSkin, csWindowSkin, csDialogSkin, csTitlebarSkin, csListBoxSkin, csListBoxItemSkin, and csScrollBarSkin. |
|
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. |
|
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-0, 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:
- csws/csskin.h
Generated for Crystal Space by doxygen 1.3.9.1