Manages the mapping of skin names to ISkinObj objects. More...
#include <SSkinPool.h>
Public Member Functions | |
SSkinPool (BOOL bAutoScale=TRUE) | |
Constructor. | |
virtual | ~SSkinPool () |
Destructor. | |
ISkinObj * | GetSkin (LPCWSTR strSkinName, int nScale) OVERRIDE |
Retrieves a skin object by name and scale. | |
int | LoadSkins (IXmlNode *xmlNode) OVERRIDE |
Loads skins from an XML node. | |
BOOL | AddSkin (ISkinObj *skin) OVERRIDE |
Adds a skin object to the pool. | |
BOOL | RemoveSkin (ISkinObj *skin) OVERRIDE |
Removes a skin object from the pool. | |
void | RemoveAll () OVERRIDE |
Removes all skin objects from the pool. | |
![]() | |
TObjRefImpl () | |
Constructor that initializes the reference count to 1. | |
virtual | ~TObjRefImpl () |
Virtual destructor. | |
long | AddRef () override |
Increments the reference count. | |
long | Release () override |
Decrements the reference count and deletes the object if the count reaches zero. | |
void | OnFinalRelease () override |
Deletes the object. | |
Protected Member Functions | |
int | _LoadSkins (SXmlNode xmlNode) |
Loads skins from an XML node. | |
ISkinObj * | _LoadSkin (SXmlNode xmlNode, int nScale) |
Loads a single skin from an XML node. | |
![]() | |
SCmnMap (void(*funOnKeyRemoved)(const SSkinPtr &)=NULL) | |
Constructor. | |
virtual | ~SCmnMap () |
Destructor. | |
bool | HasKey (const SkinKey &key) const |
Checks if a key exists in the map. | |
bool | GetKeyObject (const SkinKey &key, SSkinPtr &obj) const |
Retrieves an object associated with a key. | |
SSkinPtr & | GetKeyObject (const SkinKey &key) const |
Retrieves an object associated with a key. | |
bool | AddKeyObject (const SkinKey &key, const SSkinPtr &obj) |
Adds a key-object pair to the map. | |
void | SetKeyObject (const SkinKey &key, const SSkinPtr &obj) |
Sets an object for a key, replacing any existing object. | |
bool | RemoveKeyObject (const SkinKey &key) |
Removes a key-object pair from the map. | |
void | RemoveAll () |
Removes all key-object pairs from the map. | |
size_t | GetCount () |
Gets the number of key-object pairs in the map. | |
Static Protected Member Functions | |
static void | OnKeyRemoved (const SSkinPtr &obj) |
Callback function called when a skin object is removed from the pool. | |
Protected Attributes | |
BOOL | m_bAutoScale |
![]() | |
LONG | m_cRef |
Reference count. | |
![]() | |
void(* | m_pFunOnKeyRemoved )(const SSkinPtr &obj) |
SMap< SkinKey, SSkinPtr > * | m_mapNamedObj |
Manages the mapping of skin names to ISkinObj objects.
This class provides functionality to load, retrieve, and manage skin objects. It supports automatic scaling and maintains a pool of skin objects for efficient reuse.
Definition at line 133 of file SSkinPool.h.
SNSBEGIN SSkinPool::SSkinPool | ( | BOOL | bAutoScale = TRUE | ) |
Constructor.
bAutoScale | TRUE if automatic scaling is enabled, FALSE otherwise. |
Definition at line 12 of file SSkinPool.cpp.
|
virtual |
Destructor.
Definition at line 18 of file SSkinPool.cpp.
Loads a single skin from an XML node.
xmlNode | XML node containing the skin definition. |
nScale | Scale factor for the skin. |
Definition at line 36 of file SSkinPool.cpp.
|
protected |
Loads skins from an XML node.
xmlNode | XML node containing the skin definitions. |
Definition at line 70 of file SSkinPool.cpp.
BOOL SSkinPool::AddSkin | ( | ISkinObj * | skin | ) |
Adds a skin object to the pool.
skin | Pointer to the skin object to add. |
Definition at line 106 of file SSkinPool.cpp.
ISkinObj * SSkinPool::GetSkin | ( | LPCWSTR | strSkinName, |
int | nScale ) |
Retrieves a skin object by name and scale.
strSkinName | Name of the skin. |
nScale | Scale factor for the skin. |
Definition at line 122 of file SSkinPool.cpp.
int SSkinPool::LoadSkins | ( | IXmlNode * | xmlNode | ) |
Loads skins from an XML node.
xmlNode | XML node containing the skin definitions. |
Definition at line 95 of file SSkinPool.cpp.
|
staticprotected |
Callback function called when a skin object is removed from the pool.
obj | Pointer to the removed skin object. |
Definition at line 185 of file SSkinPool.cpp.
void SSkinPool::RemoveAll | ( | ) |
Removes all skin objects from the pool.
Definition at line 190 of file SSkinPool.cpp.
BOOL SSkinPool::RemoveSkin | ( | ISkinObj * | skin | ) |
Removes a skin object from the pool.
skin | Pointer to the skin object to remove. |
Definition at line 116 of file SSkinPool.cpp.
|
protected |
Definition at line 209 of file SSkinPool.h.