MCPcopy Create free account
hub / github.com/SOUI2/soui / LoadSkinFormXml

Function LoadSkinFormXml

demo/MainDlg.cpp:132–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132void LoadSkinFormXml(SDemoSkin *skin, SkinType *skinType, SkinLoadInf *skininf)
133{
134 SStringT strSkinConfigPath = SApplication::getSingleton().GetAppDir() + _T("\\themes\\skin_config.xml");
135
136 pugi::xml_document docLoad;
137 pugi::xml_parse_result result = docLoad.load_file(strSkinConfigPath);
138 if (result)
139 {
140 pugi::xml_node skinInf = docLoad.child(L"DEMO_SKIN_CONFIG").child(L"skinInf");
141 *skinType = (SkinType)skinInf.attribute(L"type").as_int();
142 switch (*skinType)
143 {
144 //纯色只有SkinSaveInf的color有效
145 case color:
146 skininf->color = skinInf.attribute(L"color").as_int();
147 break;
148 //此处为系统皮肤,只需要给文件路径和margin
149 case sys:
150 skininf->filepath = skinInf.attribute(L"skin_path").as_string();
151 int v1 = 0, v2 = 0, v3 = 0, v4 = 0;
152 swscanf(skinInf.attribute(L"skin_margin").as_string(), L"%d,%d,%d,%d", &v1, &v2, &v3, &v4);
153 skininf->margin.left = v1;
154 skininf->margin.top = v2;
155 skininf->margin.right = v3;
156 skininf->margin.bottom = v4;
157 break;
158 }
159 }
160}
161bool CMainDlg::LoadSkin()
162{
163 SDemoSkin *skin = (SDemoSkin *)GETSKIN(L"demoskinbk",GetScale());

Callers 1

LoadSkinMethod · 0.85

Calls 6

GetAppDirMethod · 0.80
load_fileMethod · 0.45
childMethod · 0.45
as_intMethod · 0.45
attributeMethod · 0.45
as_stringMethod · 0.45

Tested by

no test coverage detected