Manages UI definitions, including skins, styles, templates, gradients, and named values. More...
#include <SUiDef.h>
Public Member Functions | |
SUiDef (IRenderFactory *fac) | |
Constructor. | |
~SUiDef (void) | |
Destructor. | |
BOOL | InitDefUiDef (IResProvider *pResProvider, LPCTSTR pszUiDef) |
Initializes the default UI definition. | |
IUiDefInfo * | GetUiDef () |
Retrieves the default UI definition. | |
void | SetUiDef (IUiDefInfo *pUiDefInfo, bool bUpdateDefFont) |
Sets the default UI definition. | |
void | PushUiDefInfo (IUiDefInfo *pUiDefInfo, BOOL bPreivate=FALSE) |
Pushes a new UI definition information object onto the stack. | |
BOOL | PopUiDefInfo (IUiDefInfo *pUiDefInfo, BOOL bPreivate=FALSE) |
Pops a UI definition information object from the stack. | |
void | PushSkinPool (ISkinPool *pSkinPool) |
Pushes a new skin pool onto the stack. | |
BOOL | PopSkinPool (ISkinPool *pSkinPool) |
Pops a skin pool from the stack. | |
ISkinObj * | GetSkin (const SStringW &strSkinName, int nScale) |
Retrieves a skin object by name and scale. | |
ISkinObj * | GetBuiltinSkin (SYS_SKIN uID, int nScale) |
Retrieves a built-in skin object by ID and scale. | |
ISkinPool * | GetBuiltinSkinPool () |
Retrieves the built-in skin pool. | |
SXmlNode | GetStyle (const SStringW &strName) |
Retrieves a style XML node by name. | |
SStringW | GetTemplateString (const SStringW &strName) |
Retrieves a template string by name. | |
IGradient * | GetGradient (const SStringW &strName) |
Retrieves a gradient object by name. | |
COLORREF | GetColor (const SStringW &strColor) |
Retrieves a color value from a string. | |
COLORREF | GetColor (int idx) |
Retrieves a color value by index from the default resource package. | |
SStringW | GetString (const SStringW &strString) |
Retrieves a string value from a string name. | |
SStringW | GetString (int idx) |
Retrieves a string value by index from the default resource package. | |
SLayoutSize | GetLayoutSize (const SStringW &strSize) |
Retrieves a layout size from a string name. | |
SLayoutSize | GetLayoutSize (int idx) |
Retrieves a layout size by index from the default resource package. | |
SStringW | GetFontDesc (const SStringW &strFont) |
Retrieves a font description from a string name. | |
SStringW | GetFontDesc (int idx) |
Retrieves a font description by index from the default resource package. | |
IFontPtr | GetFont (const SStringW &strFont, int scale) |
Retrieves a font object by description and scale. | |
void | SetDefFontInfo (const SStringW &strFontInfo) |
Sets the default font information. | |
FontInfo | GetDefFontInfo () const |
Retrieves the default font information. | |
![]() | |
SSingleton2 (void) | |
Constructor for SSingleton2. | |
virtual | ~SSingleton2 (void) |
Destructor for SSingleton2. | |
![]() | |
SCmnMap (void(*funOnKeyRemoved)(const IFontPtr &)=NULL) | |
Constructor. | |
virtual | ~SCmnMap () |
Destructor. | |
bool | HasKey (const FontInfo &key) const |
Checks if a key exists in the map. | |
bool | GetKeyObject (const FontInfo &key, IFontPtr &obj) const |
Retrieves an object associated with a key. | |
IFontPtr & | GetKeyObject (const FontInfo &key) const |
Retrieves an object associated with a key. | |
bool | AddKeyObject (const FontInfo &key, const IFontPtr &obj) |
Adds a key-object pair to the map. | |
void | SetKeyObject (const FontInfo &key, const IFontPtr &obj) |
Sets an object for a key, replacing any existing object. | |
bool | RemoveKeyObject (const FontInfo &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 Public Member Functions | |
static IUiDefInfo * | CreateUiDefInfo () |
Creates a new UI definition information object. | |
static ISkinPool * | CreateSkinPool (BOOL bAutoScale=TRUE) |
Creates a new skin pool. | |
![]() | |
static SUiDef & | getSingleton (void) |
Gets the singleton instance. | |
static SUiDef * | getSingletonPtr (void) |
Gets the pointer to the singleton instance. | |
![]() | |
static void | SetFontChecker (FunFontCheck fontCheck) |
Set the callback function for checking fonts. | |
static BOOL | CheckFont (const SStringW &strFontName) |
Check if a font is valid. | |
static FontInfo | FontInfoFromString (const SStringW &strFontInfo, const FontInfo &defFontInfo) |
Convert font description to FontInfo. | |
static SStringW | FontInfoToString (const FontInfo &fi) |
Convert FontInfo to font description. | |
static IFontPtr | GetFont (const SStringW &strFont, int scale) |
Get IFontPtr corresponding to the specified description string. | |
static void | SetDefFontInfo (const SStringW &strFontInfo) |
Set default font. | |
static FontInfo | GetDefFontInfo () |
Get default font information. | |
Protected Attributes | |
SAutoRefPtr< IUiDefInfo > | m_defUiDefInfo |
SList< IUiDefInfo * > | m_lstUiDefInfo |
SList< ISkinPool * > | m_lstSkinPools |
SAutoRefPtr< ISkinPool > | m_bulitinSkinPool |
SCriticalSection | m_cs |
![]() | |
SAutoRefPtr< IRenderFactory > | m_RenderFactory |
FontInfo | m_defFontInfo |
![]() | |
void(* | m_pFunOnKeyRemoved )(const IFontPtr &obj) |
SMap< FontInfo, IFontPtr > * | m_mapNamedObj |
Additional Inherited Members | |
![]() | |
SFontPool (IRenderFactory *fac) | |
Constructor. | |
const FontInfo & | _GetDefFontInfo () const |
Get constant reference to default font information. | |
void | SetRenderFactory (IRenderFactory *fac) |
Set render factory object. | |
IFontPtr | _GetFont (const SStringW &strFont, int scale) |
Get IFontPtr corresponding to the specified description string. | |
void | _SetDefFontInfo (const SStringW &strFontInfo) |
Set default font description string. | |
IFontPtr | _CreateFont (const FontInfo &fontInfo) |
Create font object corresponding to FontInfo. | |
void | _SetDefFontInfo (const FontInfo &fontInfo) |
Set default font information. | |
![]() | |
static void | OnKeyRemoved (const IFontPtr &obj) |
Callback function when FontInfo is removed. | |
![]() | |
static FunFontCheck | s_funFontCheck = DefFontCheck |
Manages UI definitions, including skins, styles, templates, gradients, and named values.
This class provides functionality to manage and retrieve various UI resources such as skins, styles, templates, gradients, and named values. It also handles the initialization and management of default UI definitions.
SUiDef::SUiDef | ( | IRenderFactory * | fac | ) |
Constructor.
fac | Pointer to the render factory. |
Definition at line 331 of file SUiDef.cpp.
SUiDef::~SUiDef | ( | void | ) |
Destructor.
Definition at line 344 of file SUiDef.cpp.
|
static |
Creates a new skin pool.
bAutoScale | TRUE if automatic scaling is enabled, FALSE otherwise. |
Definition at line 654 of file SUiDef.cpp.
|
static |
Creates a new UI definition information object.
Definition at line 649 of file SUiDef.cpp.
ISkinObj * SUiDef::GetBuiltinSkin | ( | SYS_SKIN | uID, |
int | nScale ) |
Retrieves a built-in skin object by ID and scale.
uID | ID of the built-in skin. |
nScale | Scale factor for the skin. |
Definition at line 504 of file SUiDef.cpp.
ISkinPool * SUiDef::GetBuiltinSkinPool | ( | ) |
Retrieves the built-in skin pool.
Definition at line 510 of file SUiDef.cpp.
COLORREF SUiDef::GetColor | ( | const SStringW & | strColor | ) |
Retrieves a color value from a string.
strColor | Color string (e.g., @color/red, rgba(r,g,b,a), rgb(r,g,b), #ff0000). |
Definition at line 567 of file SUiDef.cpp.
COLORREF SUiDef::GetColor | ( | int | idx | ) |
Retrieves a color value by index from the default resource package.
idx | Index of the color. |
Definition at line 581 of file SUiDef.cpp.
FontInfo SUiDef::GetDefFontInfo | ( | ) | const |
Retrieves the default font information.
Definition at line 671 of file SUiDef.cpp.
Retrieves a font object by description and scale.
strFont | Font description string. |
scale | Scale factor for the font. |
Description string format example: face:宋体,bold:0,italic:1,underline:1,strike:1,adding:10
Definition at line 659 of file SUiDef.cpp.
Retrieves a font description from a string name.
strFont | String name (e.g., @font/fontname). |
Definition at line 628 of file SUiDef.cpp.
SStringW SUiDef::GetFontDesc | ( | int | idx | ) |
Retrieves a font description by index from the default resource package.
idx | Index of the font description. |
Definition at line 643 of file SUiDef.cpp.
IGradient * SUiDef::GetGradient | ( | const SStringW & | strName | ) |
Retrieves a gradient object by name.
strName | Name of the gradient. |
Definition at line 550 of file SUiDef.cpp.
SLayoutSize SUiDef::GetLayoutSize | ( | const SStringW & | strSize | ) |
Retrieves a layout size from a string name.
strSize | String name (e.g., @dim/dimname). |
Definition at line 608 of file SUiDef.cpp.
SLayoutSize SUiDef::GetLayoutSize | ( | int | idx | ) |
Retrieves a layout size by index from the default resource package.
idx | Index of the layout size. |
Definition at line 622 of file SUiDef.cpp.
Retrieves a skin object by name and scale.
strSkinName | Name of the skin. |
nScale | Scale factor for the skin. |
Definition at line 464 of file SUiDef.cpp.
Retrieves a string value from a string name.
strString | String name (e.g., @string/title). |
Definition at line 587 of file SUiDef.cpp.
SStringW SUiDef::GetString | ( | int | idx | ) |
Retrieves a string value by index from the default resource package.
idx | Index of the string. |
Definition at line 602 of file SUiDef.cpp.
Retrieves a style XML node by name.
strName | Name of the style. |
Definition at line 516 of file SUiDef.cpp.
Retrieves a template string by name.
strName | Name of the template. |
Definition at line 533 of file SUiDef.cpp.
IUiDefInfo * SUiDef::GetUiDef | ( | ) |
Retrieves the default UI definition.
Definition at line 383 of file SUiDef.cpp.
BOOL SUiDef::InitDefUiDef | ( | IResProvider * | pResProvider, |
LPCTSTR | pszUiDef ) |
Initializes the default UI definition.
pResProvider | Pointer to the resource provider. |
pszUiDef | UI definition resource ID. |
Definition at line 369 of file SUiDef.cpp.
BOOL SUiDef::PopSkinPool | ( | ISkinPool * | pSkinPool | ) |
Pops a skin pool from the stack.
pSkinPool | Pointer to the skin pool to pop. |
Definition at line 450 of file SUiDef.cpp.
BOOL SUiDef::PopUiDefInfo | ( | IUiDefInfo * | pUiDefInfo, |
BOOL | bPreivate = FALSE ) |
Pops a UI definition information object from the stack.
pUiDefInfo | Pointer to the UI definition information object to pop. If NULL, pops the last object. |
bPreivate | TRUE if the UI definition is private, FALSE otherwise. |
Definition at line 417 of file SUiDef.cpp.
void SUiDef::PushSkinPool | ( | ISkinPool * | pSkinPool | ) |
Pushes a new skin pool onto the stack.
pSkinPool | Pointer to the skin pool. |
Definition at line 441 of file SUiDef.cpp.
void SUiDef::PushUiDefInfo | ( | IUiDefInfo * | pUiDefInfo, |
BOOL | bPreivate = FALSE ) |
Pushes a new UI definition information object onto the stack.
pUiDefInfo | Pointer to the UI definition information object. |
bPreivate | TRUE if the UI definition is private, FALSE otherwise. |
Definition at line 408 of file SUiDef.cpp.
void SUiDef::SetDefFontInfo | ( | const SStringW & | strFontInfo | ) |
Sets the default font information.
strFontInfo | Default font description. |
Definition at line 665 of file SUiDef.cpp.
void SUiDef::SetUiDef | ( | IUiDefInfo * | pUiDefInfo, |
bool | bUpdateDefFont ) |
Sets the default UI definition.
pUiDefInfo | Pointer to the UI definition information object. |
bUpdateDefFont | TRUE if the default font should be updated, FALSE otherwise. |
Definition at line 389 of file SUiDef.cpp.
|
protected |
|
mutableprotected |
|
protected |
|
protected |