soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SSkinPool Class Reference

Manages the mapping of skin names to ISkinObj objects. More...

#include <SSkinPool.h>

Inheritance diagram for SSkinPool:
TObjRefImpl< ISkinPool > SCmnMap< SSkinPtr, SkinKey >

Public Member Functions

 SSkinPool (BOOL bAutoScale=TRUE)
 Constructor.
 
virtual ~SSkinPool ()
 Destructor.
 
ISkinObjGetSkin (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.
 
- Public Member Functions inherited from TObjRefImpl< ISkinPool >
 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.
 
- Protected Member Functions inherited from SCmnMap< SSkinPtr, SkinKey >
 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.
 
SSkinPtrGetKeyObject (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
 
- Protected Attributes inherited from TObjRefImpl< ISkinPool >
LONG m_cRef
 Reference count.
 
- Protected Attributes inherited from SCmnMap< SSkinPtr, SkinKey >
void(* m_pFunOnKeyRemoved )(const SSkinPtr &obj)
 
SMap< SkinKey, SSkinPtr > * m_mapNamedObj
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SSkinPool()

SNSBEGIN SSkinPool::SSkinPool ( BOOL bAutoScale = TRUE)

Constructor.

Parameters
bAutoScaleTRUE if automatic scaling is enabled, FALSE otherwise.

Definition at line 12 of file SSkinPool.cpp.

◆ ~SSkinPool()

SSkinPool::~SSkinPool ( )
virtual

Destructor.

Definition at line 18 of file SSkinPool.cpp.

Member Function Documentation

◆ _LoadSkin()

ISkinObj * SSkinPool::_LoadSkin ( SXmlNode xmlNode,
int nScale )
protected

Loads a single skin from an XML node.

Parameters
xmlNodeXML node containing the skin definition.
nScaleScale factor for the skin.
Returns
Pointer to the loaded ISkinObj object, or nullptr if loading fails.

Definition at line 36 of file SSkinPool.cpp.

◆ _LoadSkins()

int SSkinPool::_LoadSkins ( SXmlNode xmlNode)
protected

Loads skins from an XML node.

Parameters
xmlNodeXML node containing the skin definitions.
Returns
Number of skins loaded.

Definition at line 70 of file SSkinPool.cpp.

◆ AddSkin()

BOOL SSkinPool::AddSkin ( ISkinObj * skin)

Adds a skin object to the pool.

Parameters
skinPointer to the skin object to add.
Returns
TRUE if the skin is successfully added, FALSE otherwise.

Definition at line 106 of file SSkinPool.cpp.

◆ GetSkin()

ISkinObj * SSkinPool::GetSkin ( LPCWSTR strSkinName,
int nScale )

Retrieves a skin object by name and scale.

Parameters
strSkinNameName of the skin.
nScaleScale factor for the skin.
Returns
Pointer to the ISkinObj object, or nullptr if not found.

Definition at line 122 of file SSkinPool.cpp.

◆ LoadSkins()

int SSkinPool::LoadSkins ( IXmlNode * xmlNode)

Loads skins from an XML node.

Parameters
xmlNodeXML node containing the skin definitions.
Returns
Number of skins loaded.

Definition at line 95 of file SSkinPool.cpp.

◆ OnKeyRemoved()

void SSkinPool::OnKeyRemoved ( const SSkinPtr & obj)
staticprotected

Callback function called when a skin object is removed from the pool.

Parameters
objPointer to the removed skin object.

Definition at line 185 of file SSkinPool.cpp.

◆ RemoveAll()

void SSkinPool::RemoveAll ( )

Removes all skin objects from the pool.

Definition at line 190 of file SSkinPool.cpp.

◆ RemoveSkin()

BOOL SSkinPool::RemoveSkin ( ISkinObj * skin)

Removes a skin object from the pool.

Parameters
skinPointer to the skin object to remove.
Returns
TRUE if the skin is successfully removed, FALSE otherwise.

Definition at line 116 of file SSkinPool.cpp.

Member Data Documentation

◆ m_bAutoScale

BOOL SSkinPool::m_bAutoScale
protected

Definition at line 209 of file SSkinPool.h.


The documentation for this class was generated from the following files: