RTSkin.cpp
上传用户:qhonly
上传日期:2013-06-10
资源大小:487k
文件大小:25k
源码类别:

界面编程

开发平台:

Visual C++

  1. #include "StdAfx.h"
  2. #include "RTSkin.h"
  3. #include "RTXmlFile.h"
  4. #include "RTDraw.h"
  5. #include "RTDialog.h"
  6. #include "RTButton.h"
  7. #include "RTStatic.h"
  8. #include "RTTreeCtrl.h"
  9. #include "RTTabCtrl.h"
  10. #include "RTStatusBar.h"
  11. #include "RTSplitterWnd.h"
  12. #include "RTListCtrl.h"
  13. #include "RTScrollBar.h"
  14. #include "RTEdit.h"
  15. #include "RTRichEdit.h"
  16. #include "RTFrameWnd.h"
  17. #include "RTToolBar.h"
  18. #include "RTMenu.h"
  19. #include "RTCheckBox.h"
  20. CRTSkin::CRTSkin(void)
  21. {
  22. for(int i = 0; i < 5; i++)
  23. {
  24. m_SplitterWndBitmap[i] = NULL;
  25. m_TitleBarBitmap[i] = NULL;
  26. m_MenuBarBitmap[i] = NULL;
  27. m_MaximizeButtonBitmap[i] = NULL;
  28. m_MinimizeButtonBitmap[i] = NULL;
  29. m_RestoreButtonBitmap[i] = NULL;
  30. m_ExitButtonBitmap[i] = NULL;
  31. m_ToolBarBitmap[i] = NULL;
  32. m_ListCtrlBitmap[i] = NULL;
  33. m_TreeCtrlBitmap[i] = NULL;
  34. m_ButtonBitmap[i] = NULL;
  35. m_StatusBarBitmap[i] = NULL;
  36. m_HeaderCtrlBitmap[i] = NULL;
  37. m_ListCtrlBitmap[i] = NULL;
  38. m_ScrollBarVerticalBitmap[i] = NULL;
  39. m_ScrollBarHorizontalBitmap[i] = NULL;
  40. m_ScrollBarUpArrowBitmap[i] = NULL;
  41. m_ScrollBarLeftArrowBitmap[i] = NULL;
  42. m_ScrollBarDownArrowBitmap[i] = NULL;
  43. m_ScrollBarRightArrowBitmap[i] = NULL;
  44. m_TitleBarBitmapDrawMode[i] = 0;
  45. m_MenuBarBitmapDrawMode[i] =  0;
  46. m_MaximizeButtonBitmapDrawMode[i] = 0;
  47. m_MinimizeButtonBitmapDrawMode[i] = 0;
  48. m_ExitButtonBitmapDrawMode[i] = 0;
  49. m_RestoreButtonBitmapDrawMode[i] = 0;
  50. m_ToolBarBitmapDrawMode[i] = 0;
  51. m_ButtonBitmapDrawMode[i] = 0;
  52. m_TreeCtrlBitmapDrawMode[i] = 0;
  53. m_StatusBarBitmapDrawMode[i] = 0;
  54. m_BorderColor[i] = 0;
  55. m_ListCtrlBitmapDrawMode[i] = 0;
  56. }
  57. }
  58. CRTSkin::~CRTSkin(void)
  59. {
  60. Clear();
  61. }
  62. void CRTSkin::Clear()
  63. {
  64. for(int i = 0; i < 5; i ++)
  65. {
  66. if(m_SplitterWndBitmap[i] != NULL)
  67. {
  68. m_SplitterWndBitmap[i]->DeleteObject();
  69. delete m_SplitterWndBitmap[i];
  70. m_SplitterWndBitmap[i] = NULL;
  71. }
  72. if(m_TitleBarBitmap[i] != NULL)
  73. {
  74. m_TitleBarBitmap[i]->DeleteObject();
  75. delete m_TitleBarBitmap[i];
  76. m_TitleBarBitmap[i] = NULL;
  77. }
  78. if(m_MenuBarBitmap[i] != NULL)
  79. {
  80. m_MenuBarBitmap[i]->DeleteObject();
  81. delete m_MenuBarBitmap[i];
  82. m_MenuBarBitmap[i] = NULL;
  83. }
  84. if(m_MaximizeButtonBitmap[i] != NULL)
  85. {
  86. m_MaximizeButtonBitmap[i]->DeleteObject();
  87. delete m_MaximizeButtonBitmap[i];
  88. m_MaximizeButtonBitmap[i] = NULL;
  89. }
  90. if(m_MinimizeButtonBitmap[i] != NULL)
  91. {
  92. m_MinimizeButtonBitmap[i]->DeleteObject();
  93. delete m_MinimizeButtonBitmap[i];
  94. m_MinimizeButtonBitmap[i] = NULL;
  95. }
  96. if(m_RestoreButtonBitmap[i] != NULL)
  97. {
  98. m_RestoreButtonBitmap[i]->DeleteObject();
  99. delete m_RestoreButtonBitmap[i];
  100. m_RestoreButtonBitmap[i] = NULL;
  101. }
  102. if(m_ExitButtonBitmap[i] != NULL)
  103. {
  104. m_ExitButtonBitmap[i]->DeleteObject();
  105. delete m_ExitButtonBitmap[i];
  106. m_ExitButtonBitmap[i] = NULL;
  107. }
  108. if(m_ToolBarBitmap[i] != NULL)
  109. {
  110. m_ToolBarBitmap[i]->DeleteObject();
  111. delete m_ToolBarBitmap[i];
  112. m_ToolBarBitmap[i] = NULL;
  113. }if(m_ButtonBitmap[i] != NULL)
  114. {
  115. m_ButtonBitmap[i]->DeleteObject();
  116. delete m_ButtonBitmap[i];
  117. m_ButtonBitmap[i] = NULL;
  118. }
  119. if(m_TreeCtrlBitmap[i] != NULL)
  120. {
  121. m_TreeCtrlBitmap[i]->DeleteObject();
  122. delete m_TreeCtrlBitmap[i];
  123. m_TreeCtrlBitmap[i] = NULL;
  124. }
  125. if(m_StatusBarBitmap[i] != NULL)
  126. {
  127. m_StatusBarBitmap[i]->DeleteObject();
  128. delete m_StatusBarBitmap[i];
  129. m_StatusBarBitmap[i] = NULL;
  130. }
  131. if(m_HeaderCtrlBitmap[i] != NULL)
  132. {
  133. m_HeaderCtrlBitmap[i]->DeleteObject();
  134. delete m_HeaderCtrlBitmap[i];
  135. m_HeaderCtrlBitmap[i] = NULL;
  136. }
  137. //
  138. if(m_ScrollBarVerticalBitmap[i] != NULL)
  139. {
  140. m_ScrollBarVerticalBitmap[i]->DeleteObject();
  141. delete m_ScrollBarVerticalBitmap[i];
  142. m_ScrollBarVerticalBitmap[i] = NULL;
  143. }
  144. if(m_ScrollBarHorizontalBitmap[i] != NULL)
  145. {
  146. m_ScrollBarHorizontalBitmap[i]->DeleteObject();
  147. delete m_ScrollBarHorizontalBitmap[i];
  148. m_ScrollBarHorizontalBitmap[i] = NULL;
  149. }
  150. if(m_ScrollBarUpArrowBitmap[i] != NULL)
  151. {
  152. m_ScrollBarUpArrowBitmap[i]->DeleteObject();
  153. delete m_ScrollBarUpArrowBitmap[i];
  154. m_ScrollBarUpArrowBitmap[i] = NULL;
  155. }
  156. if(m_ScrollBarLeftArrowBitmap[i] != NULL)
  157. {
  158. m_ScrollBarLeftArrowBitmap[i]->DeleteObject();
  159. delete m_ScrollBarLeftArrowBitmap[i];
  160. m_ScrollBarLeftArrowBitmap[i] = NULL;
  161. }
  162. if(m_ScrollBarDownArrowBitmap[i] != NULL)
  163. {
  164. m_ScrollBarDownArrowBitmap[i]->DeleteObject();
  165. delete m_ScrollBarDownArrowBitmap[i];
  166. m_ScrollBarDownArrowBitmap[i] = NULL;
  167. }
  168. if(m_ScrollBarRightArrowBitmap[i] != NULL)
  169. {
  170. m_ScrollBarRightArrowBitmap[i]->DeleteObject();
  171. delete m_ScrollBarRightArrowBitmap[i];
  172. m_ScrollBarRightArrowBitmap[i] = NULL;
  173. }
  174. if(m_ListCtrlBitmap[i] != NULL)
  175. {
  176. m_ListCtrlBitmap[i]->DeleteObject();
  177. delete m_ListCtrlBitmap[i];
  178. m_ListCtrlBitmap[i] = NULL;
  179. }
  180. }
  181. }
  182. CBitmap* CRTSkin::LoadBitmap(LPCTSTR lpRelativeFileName)
  183. {
  184. if(lpRelativeFileName == NULL)return NULL;
  185. char StyleFileName[MAX_PATH];
  186. ZeroMemory(StyleFileName,MAX_PATH);
  187. strcpy(StyleFileName,m_BasePath);
  188. strcat(StyleFileName,lpRelativeFileName);
  189. HANDLE hHandle = LoadImage(NULL,StyleFileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_DEFAULTCOLOR);
  190. if(hHandle == NULL)return NULL;
  191. CBitmap* pBitmap = new CBitmap();
  192. if(!pBitmap->Attach(hHandle))
  193. {
  194. DeleteObject(hHandle);
  195. return NULL;
  196. }
  197. return pBitmap;
  198. }
  199. BOOL CRTSkin::Load(LPCTSTR lpStyleFileName)
  200. {
  201. CRTXmlFile cf;
  202. if(!cf.Open(lpStyleFileName))
  203. return FALSE;
  204. char StyleFileName[MAX_PATH];
  205. strcpy(StyleFileName,lpStyleFileName);
  206. int nlen = (int)strlen(lpStyleFileName);
  207. while(nlen > 0)
  208. {
  209. if(StyleFileName[nlen - 1] == '\')
  210. {
  211. StyleFileName[nlen] = NULL;
  212. break;
  213. }
  214. nlen --;
  215. }
  216. if(nlen == 0)return FALSE;
  217. strcpy(m_BasePath,StyleFileName);
  218. Clear();
  219. CRTXmlItem *pItem = NULL;
  220. pItem = cf.GetItem("ScrollBarHorizontal");
  221. if(pItem != NULL)
  222. {
  223. m_ScrollBarHorizontalBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  224. m_ScrollBarHorizontalBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  225. m_ScrollBarHorizontalBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  226. m_ScrollBarHorizontalBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  227. m_ScrollBarHorizontalBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  228. m_ScrollBarHorizontalBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  229. m_ScrollBarHorizontalBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  230. m_ScrollBarHorizontalBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  231. m_ScrollBarHorizontalBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  232. m_ScrollBarHorizontalBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  233. }
  234. pItem = cf.GetItem("MenuItem");
  235. if(pItem != NULL)
  236. {
  237. m_MenuItemBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  238. m_MenuItemBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  239. m_MenuItemBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  240. m_MenuItemBitmap[BMP_SLIDER] = LoadBitmap(pItem->GetKeyValue("Slider"));
  241. m_MenuItemBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  242. m_MenuItemBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  243. m_MenuItemBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  244. m_MenuItemBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  245. m_MenuItemBitmapDrawMode[BMP_SLIDER] = StrToUINT(pItem->GetKeyValue("SliderDrawMode"));
  246. m_MenuItemBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  247. }
  248. pItem = cf.GetItem("ScrollBarVertical");
  249. if(pItem != NULL)
  250. {
  251. m_ScrollBarVerticalBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  252. m_ScrollBarVerticalBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  253. m_ScrollBarVerticalBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  254. m_ScrollBarVerticalBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  255. m_ScrollBarVerticalBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  256. m_ScrollBarVerticalBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  257. m_ScrollBarVerticalBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  258. m_ScrollBarVerticalBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  259. m_ScrollBarVerticalBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  260. m_ScrollBarVerticalBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  261. }
  262. pItem = cf.GetItem("ScrollBarLeftArrow");
  263. if(pItem != NULL)
  264. {
  265. m_ScrollBarLeftArrowBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  266. m_ScrollBarLeftArrowBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  267. m_ScrollBarLeftArrowBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  268. m_ScrollBarLeftArrowBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  269. m_ScrollBarLeftArrowBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  270. m_ScrollBarLeftArrowBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  271. m_ScrollBarLeftArrowBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  272. m_ScrollBarLeftArrowBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  273. m_ScrollBarLeftArrowBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  274. m_ScrollBarLeftArrowBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  275. }
  276. pItem = cf.GetItem("ScrollBarRightArrow");
  277. if(pItem != NULL)
  278. {
  279. m_ScrollBarRightArrowBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  280. m_ScrollBarRightArrowBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  281. m_ScrollBarRightArrowBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  282. m_ScrollBarRightArrowBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  283. m_ScrollBarRightArrowBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  284. m_ScrollBarRightArrowBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  285. m_ScrollBarRightArrowBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  286. m_ScrollBarRightArrowBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  287. m_ScrollBarRightArrowBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  288. m_ScrollBarRightArrowBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  289. }
  290. pItem = cf.GetItem("ScrollBarUpArrow");
  291. if(pItem != NULL)
  292. {
  293. m_ScrollBarUpArrowBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  294. m_ScrollBarUpArrowBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  295. m_ScrollBarUpArrowBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  296. m_ScrollBarUpArrowBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  297. m_ScrollBarUpArrowBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  298. m_ScrollBarUpArrowBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  299. m_ScrollBarUpArrowBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  300. m_ScrollBarUpArrowBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  301. m_ScrollBarUpArrowBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  302. m_ScrollBarUpArrowBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  303. }
  304. pItem = cf.GetItem("ScrollBarDownArrow");
  305. if(pItem != NULL)
  306. {
  307. m_ScrollBarDownArrowBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  308. m_ScrollBarDownArrowBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  309. m_ScrollBarDownArrowBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  310. m_ScrollBarDownArrowBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  311. m_ScrollBarDownArrowBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  312. m_ScrollBarDownArrowBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  313. m_ScrollBarDownArrowBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  314. m_ScrollBarDownArrowBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  315. m_ScrollBarDownArrowBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  316. m_ScrollBarDownArrowBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  317. }
  318. pItem = cf.GetItem("TitleBar");
  319. if(pItem != NULL)
  320. {
  321. m_TitleBarBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  322. m_TitleBarBitmap[BMP_ACTIVE] = LoadBitmap(pItem->GetKeyValue("Active"));
  323. m_TitleBarBitmap[BMP_INACTIVE] = LoadBitmap(pItem->GetKeyValue("InActive"));
  324. m_TitleBarBitmapDrawMode[BMP_ACTIVE] = StrToUINT(pItem->GetKeyValue("ActiveDrawMode"));
  325. m_TitleBarBitmapDrawMode[BMP_INACTIVE] = StrToUINT(pItem->GetKeyValue("InActiveDrawMode"));
  326. m_TitleBarBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  327. }
  328. pItem = cf.GetItem("HeaderCtrl");
  329. if(pItem != NULL)
  330. {
  331. m_HeaderCtrlBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  332. m_HeaderCtrlBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  333. m_HeaderCtrlBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  334. m_HeaderCtrlBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  335. m_HeaderCtrlBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  336. m_HeaderCtrlBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  337. m_HeaderCtrlBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  338. m_HeaderCtrlBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  339. m_HeaderCtrlBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  340. m_HeaderCtrlBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  341. }
  342. pItem = cf.GetItem("SplitterWnd");
  343. if(pItem != NULL)
  344. {
  345. m_SplitterWndBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  346. m_SplitterWndBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  347. m_SplitterWndBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  348. m_SplitterWndBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  349. m_SplitterWndBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  350. m_SplitterWndBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  351. m_SplitterWndBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  352. m_SplitterWndBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  353. m_SplitterWndBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  354. m_SplitterWndBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  355. }
  356. pItem = cf.GetItem("MenuBar");
  357. if(pItem != NULL)
  358. {
  359. m_MenuBarBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  360. m_MenuBarBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  361. m_MenuBarBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  362. m_MenuBarBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  363. m_MenuBarBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  364. m_MenuBarBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  365. m_MenuBarBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  366. m_MenuBarBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  367. m_MenuBarBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  368. m_MenuBarBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  369. }
  370. pItem = cf.GetItem("BorderColor");
  371. if(pItem != NULL)
  372. {
  373. m_BorderColor[0] = StrToUINT(pItem->GetKeyValue("Color0"));
  374. m_BorderColor[1] = StrToUINT(pItem->GetKeyValue("Color1"));
  375. m_BorderColor[2] = StrToUINT(pItem->GetKeyValue("Color2"));
  376. m_BorderColor[3] = StrToUINT(pItem->GetKeyValue("Color3"));
  377. }
  378. pItem = cf.GetItem("ToolBar");
  379. if(pItem != NULL)
  380. {
  381. m_ToolBarBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  382. m_ToolBarBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  383. m_ToolBarBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  384. m_ToolBarBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  385. m_ToolBarBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  386. m_ToolBarBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  387. m_ToolBarBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  388. m_ToolBarBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  389. m_ToolBarBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  390. m_ToolBarBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  391. }
  392. pItem = cf.GetItem("ExitButton");
  393. if(pItem != NULL)
  394. {
  395. m_ExitButtonBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  396. m_ExitButtonBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  397. m_ExitButtonBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  398. m_ExitButtonBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  399. m_ExitButtonBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  400. m_ExitButtonBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  401. m_ExitButtonBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  402. m_ExitButtonBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  403. }
  404. pItem = cf.GetItem("RestoreButton");
  405. if(pItem != NULL)
  406. {
  407. m_RestoreButtonBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  408. m_RestoreButtonBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  409. m_RestoreButtonBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  410. m_RestoreButtonBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  411. m_RestoreButtonBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  412. m_RestoreButtonBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  413. m_RestoreButtonBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  414. m_RestoreButtonBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  415. }
  416. pItem = cf.GetItem("MaximizeButton");
  417. if(pItem != NULL)
  418. {
  419. m_MaximizeButtonBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  420. m_MaximizeButtonBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  421. m_MaximizeButtonBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  422. m_MaximizeButtonBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  423. m_MaximizeButtonBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  424. m_MaximizeButtonBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  425. m_MaximizeButtonBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  426. m_MaximizeButtonBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  427. }
  428. pItem = cf.GetItem("MinimizeButton");
  429. if(pItem != NULL)
  430. {
  431. m_MinimizeButtonBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  432. m_MinimizeButtonBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  433. m_MinimizeButtonBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  434. m_MinimizeButtonBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  435. m_MinimizeButtonBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  436. m_MinimizeButtonBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  437. m_MinimizeButtonBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  438. m_MinimizeButtonBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  439. }
  440. pItem = cf.GetItem("Button");
  441. if(pItem != NULL)
  442. {
  443. m_ButtonBitmap[BMP_NORMAL] = LoadBitmap(pItem->GetKeyValue("Normal"));
  444. m_ButtonBitmap[BMP_FOCUS] = LoadBitmap(pItem->GetKeyValue("Focus"));
  445. m_ButtonBitmap[BMP_DOWN] = LoadBitmap(pItem->GetKeyValue("Down"));
  446. m_ButtonBitmap[BMP_DISABLE] = LoadBitmap(pItem->GetKeyValue("Disable"));
  447. m_ButtonBitmapDrawMode[BMP_NORMAL] = StrToUINT(pItem->GetKeyValue("NormalDrawMode"));
  448. m_ButtonBitmapDrawMode[BMP_FOCUS] = StrToUINT(pItem->GetKeyValue("FocusDrawMode"));
  449. m_ButtonBitmapDrawMode[BMP_DOWN] = StrToUINT(pItem->GetKeyValue("DownDrawMode"));
  450. m_ButtonBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("DisableDrawMode"));
  451. }
  452. pItem = cf.GetItem("ListCtrl");
  453. if(pItem != NULL)
  454. {
  455. m_ListCtrlBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  456. m_ListCtrlBitmapDrawMode[BMP_BACK]= StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  457. }
  458. pItem = cf.GetItem("TreeCtrl");
  459. if(pItem != NULL)
  460. {
  461. m_TreeCtrlBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  462. m_TreeCtrlBitmapDrawMode[BMP_BACK] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  463. }
  464. pItem = cf.GetItem("StatusBar");
  465. if(pItem != NULL)
  466. {
  467. m_StatusBarBitmap[BMP_BACK] = LoadBitmap(pItem->GetKeyValue("Back"));
  468. m_StatusBarBitmapDrawMode[BMP_DISABLE] = StrToUINT(pItem->GetKeyValue("BackDrawMode"));
  469. }
  470. CRTFrameWnd::SetExitButtonBitmap(m_ExitButtonBitmap,m_ExitButtonBitmapDrawMode);
  471. CRTFrameWnd::SetRestoreButtonBitmap(m_RestoreButtonBitmap,m_RestoreButtonBitmapDrawMode);
  472. CRTFrameWnd::SetMaximizeButtonBitmap(m_MaximizeButtonBitmap,m_MaximizeButtonBitmapDrawMode);
  473. CRTFrameWnd::SetMinimizeButtonBitmap(m_MinimizeButtonBitmap,m_MinimizeButtonBitmapDrawMode);
  474. CRTFrameWnd::SetTitleBarBitmap(m_TitleBarBitmap,m_TitleBarBitmapDrawMode);
  475. CRTFrameWnd::SetMenuBarBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  476. CRTFrameWnd::SetBorderColor(m_BorderColor);
  477. CRTDialog::SetExitButtonBitmap(m_ExitButtonBitmap,m_ExitButtonBitmapDrawMode);
  478. CRTDialog::SetRestoreButtonBitmap(m_RestoreButtonBitmap,m_RestoreButtonBitmapDrawMode);
  479. CRTDialog::SetMaximizeButtonBitmap(m_MaximizeButtonBitmap,m_MaximizeButtonBitmapDrawMode);
  480. CRTDialog::SetMinimizeButtonBitmap(m_MinimizeButtonBitmap,m_MinimizeButtonBitmapDrawMode);
  481. CRTDialog::SetTitleBarBitmap(m_TitleBarBitmap,m_TitleBarBitmapDrawMode);
  482. CRTDialog::SetMenuBarBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  483. CRTDialog::SetBorderColor(m_BorderColor);
  484. CRTSplitterWnd::SetBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  485. CRTButton::SetButtonBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  486. CRTStatusBar::SetBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  487. CRTToolBar::SetBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  488. CRTTabCtrl::SetTabBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  489. //CRTStatic::SetBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  490. CRTHeaderCtrl::SetHeaderBitmap(m_HeaderCtrlBitmap,m_HeaderCtrlBitmapDrawMode);
  491. CRTTreeCtrl::SetBackBitmap(m_ListCtrlBitmap,m_ListCtrlBitmapDrawMode);
  492. CRTListCtrl::SetBackBitmap(m_ListCtrlBitmap,m_ListCtrlBitmapDrawMode);
  493. CRTScrollBar::SetVerticalBitmap(m_ScrollBarVerticalBitmap,m_ScrollBarVerticalBitmapDrawMode);
  494. CRTScrollBar::SetHorizontalBitmap(m_ScrollBarHorizontalBitmap,m_ScrollBarHorizontalBitmapDrawMode);
  495. CRTScrollBar::SetHorizontalLeftArrowBitmap(m_ScrollBarLeftArrowBitmap,m_ScrollBarLeftArrowBitmapDrawMode);
  496. CRTScrollBar::SetHorizontalRightArrowBitmap(m_ScrollBarRightArrowBitmap,m_ScrollBarRightArrowBitmapDrawMode);
  497. CRTScrollBar::SetVerticalDownArrowBitmap(m_ScrollBarDownArrowBitmap,m_ScrollBarDownArrowBitmapDrawMode);
  498. CRTScrollBar::SetVerticalUpArrowBitmap(m_ScrollBarUpArrowBitmap,m_ScrollBarUpArrowBitmapDrawMode);
  499. //CRTEdit::SetBackBitmap(m_ListCtrlBitmap,m_MenuBarBitmapDrawMode);
  500. CRTCheckBox::SetBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  501. CRTMenu::SetMenuBarBitmap(m_MenuBarBitmap,m_MenuBarBitmapDrawMode);
  502. CRTMenu::SetMenuItemBitmap(m_MenuItemBitmap,m_MenuItemBitmapDrawMode);
  503. return TRUE;
  504. }
  505. UINT CRTSkin::StrToUINT(LPCTSTR lpValue)
  506. {
  507. if(lpValue == NULL)return 0;
  508. return (UINT)atol(lpValue);
  509. }
  510. void CRTSkin::GetFullPathName(LPCTSTR lpRelativeFile, char* Buf)
  511. {
  512. if(lpRelativeFile == NULL)return;
  513. ZeroMemory(Buf,MAX_PATH);
  514. strcpy(Buf,m_BasePath);
  515. strcat(Buf,lpRelativeFile);
  516. }
  517. void CRTSkin::UseSkin(BOOL IsEnable)
  518. {
  519. CRTScrollBar::EnableSkin(IsEnable);
  520. //CRTFrameWnd::EnableSkin(IsEnable);
  521. //CRTDialog::EnableSkin(IsEnable);
  522. CRTEdit::EnableSkin(IsEnable);
  523. CRTToolBar::EnableSkin(IsEnable);
  524. CRTStatic::EnableSkin(IsEnable);
  525. CRTTreeCtrl::EnableSkin(IsEnable);
  526. CRTListCtrl::EnableSkin(IsEnable);
  527. CRTStatic::EnableSkin(IsEnable);
  528. CRTTabCtrl::EnableSkin(IsEnable);
  529. CRTStatusBar::EnableSkin(IsEnable);
  530. CRTSplitterWnd::EnableSkin(IsEnable);
  531. CRTHeaderCtrl::EnableSkin(IsEnable);
  532. CRTButton::EnableSkin(IsEnable);
  533. CRTCheckBox::EnableSkin(IsEnable);
  534. //CRTMenu::EnableSkin(IsEnable);
  535. }