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:
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.
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().
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: