BOOL SApplication::Init( LPCTSTR pszName ,LPCTSTR pszType) { SASSERT(m_RenderFactory); pugi::xml_document xmlDoc; if(!LOADXML(xmlDoc,pszName,pszType)) return FALSE; pugi::xml_node root=xmlDoc.child(L"UIDEF"); if(!root) return FALSE; //set default font pugi::xml_node xmlFont; xmlFont=root.child(L"font"); if(xmlFont) { int nSize=xmlFont.attribute(L"size").as_int(12); BYTE byCharset=(BYTE)xmlFont.attribute(L"charset").as_int(DEFAULT_CHARSET); SFontPool::getSingleton().SetDefaultFont(S_CW2T(xmlFont.attribute(L"face").value()),nSize,byCharset); } SStringPool::getSingleton().Init(root.child(L"string")); SNamedID::getSingleton().Init(root.child(L"id")); SSkinPool *pSkinPool = new SSkinPool; pSkinPool->LoadSkins(root.child(L"skin")); SSkinPoolMgr::getSingletonPtr()->PushSkinPool(pSkinPool); pSkinPool->Release(); SStylePool *pStylePool = new SStylePool; pStylePool->Init(root.child(L"style")); SStylePoolMgr::getSingleton().PushStylePool(pStylePool); pStylePool->Release(); SObjDefAttr::getSingleton().Init(root.child(L"objattr")); return TRUE; }
SStylePoolMgr::~SStylePoolMgr() { SPOSITION pos=m_lstStylePools.GetHeadPosition(); while(pos) { SStylePool *p = m_lstStylePools.GetNext(pos); p->Release(); } m_lstStylePools.RemoveAll(); }