3#include "res.mgr/SObjDefAttr.h"
4#include "res.mgr/SUiDef.h"
8SObjectInfo
ObjInfo_New(LPCWSTR name,
int type, LPCWSTR alise)
13 SASSERT(strName.
GetLength() < MAX_OBJNAME);
14 wcscpy(ret.szName, strName.
c_str());
22 return pObjInfo->nType >= Undef && pObjInfo->szName[0] != 0;
40 if (
HasKey(objFactory->GetObjectInfo()))
46 SObjectInfo objInfo = objFactory->GetObjectInfo();
50 SStringWList aliseList;
51 SplitString(
SStringW(objInfo.szAlise), L
'|', aliseList);
52 for (
size_t i = 0; i < aliseList.GetCount(); i++)
54 SObjectInfo objInfoAlise =
ObjInfo_New(aliseList[i], objInfo.nType);
99 if (strBaseClass == objInfo.szName)
100 return SObjectInfo();
107 LPCWSTR pszClassName = pObject->GetObjectClass();
109 if (pObject->GetObjectType() != Window)
114 SObjDefAttr *pDefObjAttr = GETUIDEF->GetUiDef()->GetObjDefAttr();
125 pObject->SetAttribute(attrClass.
name(), attrClass.
value(), TRUE);
129 if (
attr.get_userdata())
131 pObject->SetAttribute(
attr.name(),
attr.value(), TRUE);
142 SSLOGD() <<
"Warning: no object " << objInfo.szName <<
"of type:" << objInfo.nType <<
"in SOUI !!";
Object Factory Management.
SOUI_EXP BOOL ObjInfo_IsValid(const SObjectInfo *pObjInfo)
Checks if the object information is valid.
SNSBEGIN SOUI_EXP SObjectInfo ObjInfo_New(LPCWSTR name, int type, LPCWSTR alise=NULL)
Creates a new object information structure.
bool GetKeyObject(const SObjectInfo &key, SObjectFactoryPtr &obj) const
bool AddKeyObject(const SObjectInfo &key, const SObjectFactoryPtr &obj)
bool RemoveKeyObject(const SObjectInfo &key)
bool HasKey(const SObjectInfo &key) const
void(* m_pFunOnKeyRemoved)(const SObjectFactoryPtr &obj)
Class for managing default attributes of objects.
SXmlNode GetDefAttribute(LPCWSTR pszClassName)
Retrieves the default attributes for a specific class.
SObjectFactoryMgr(void)
Constructor for SObjectFactoryMgr.
BOOL UnregisterFactory(const SObjectInfo &objInfo)
Unregisters an object factory.
virtual IObject * CreateObject(const SObjectInfo &objInfo) const
Creates an object based on the given object information.
virtual IObject * OnCreateUnknownObject(const SObjectInfo &objInfo) const
Handles the creation of an unknown object.
BOOL RegisterFactory(const IObjectFactory *objFactory, BOOL bReplace=false)
Registers an object factory.
static void OnFactoryRemoved(const SObjectFactoryPtr &obj)
Static callback for when a factory is removed.
SObjectInfo BaseObjectInfoFromObjectInfo(const SObjectInfo &objInfo)
Gets the base object information from a given object information.
void SetSwndDefAttr(IObject *pObject) const
Sets default attributes for a given object.
A class representing an ASCII string.
const wchar_t * c_str() SCONST
Retrieves a C-style string representation of the string.
SStringW & MakeLower()
Converts the string to lowercase.
int GetLength() SCONST
Retrieves the length of the string.
Class representing an XML attribute.
BOOL set_userdata(int data) OVERRIDE
Sets user data for the attribute.
const wchar_t * name() const
Gets the attribute name.
const wchar_t * value() const
Gets the attribute value.
Class representing an XML node.
SXmlAttr first_attribute() const
Gets the first attribute of the node.
SXmlAttr attribute(const wchar_t *name, bool bCaseSensitive=false) const
Gets the attribute with the specified name.
Bitfield structure for font style attributes.