00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_SKIN_H__E4027F91_1EB1_4B0D_82E2_C8DD1E7F054F__INCLUDED_)
00023 #define AFX_SKIN_H__E4027F91_1EB1_4B0D_82E2_C8DD1E7F054F__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "CoolMenu.h"
00028
00029 class CCoolBarCtrl;
00030 class CXMLElement;
00031 class CSkinWindow;
00032
00033
00034 class CSkin
00035 {
00036
00037 public:
00038 CSkin();
00039 virtual ~CSkin();
00040
00041
00042 public:
00043 void Apply();
00044 void Clear();
00045 BOOL LoadFromFile(LPCTSTR pszFile);
00046 BOOL LoadFromResource(HINSTANCE hInstance, UINT nResourceID);
00047 BOOL LoadFromString(const CString& strXML, const CString& strPath);
00048 BOOL LoadFromXML(CXMLElement* pXML, const CString& strPath);
00049 BOOL SelectCaption(CWnd* pWnd, int nIndex);
00050 BOOL SelectCaption(CString& strCaption, int nIndex);
00051 void DrawWrappedText(CDC* pDC, CRect* pBox, LPCTSTR pszText, CPoint ptStart, BOOL bExclude = TRUE);
00052 protected:
00053 void ApplyRecursive(LPCTSTR pszPath);
00054 void CreateDefault();
00055 void Finalise();
00056 HBITMAP LoadBitmap(CString& strName);
00057
00058
00059 public:
00060 BOOL LoadString(CString& str, UINT nStringID);
00061 int GetTextFlowChange(LPCTSTR pszText, BOOL* bIsRTL);
00062 protected:
00063 BOOL LoadStrings(CXMLElement* pBase);
00064 CMap<UINT, UINT, CString, CString&> m_pStrings;
00065
00066
00067 public:
00068 CMenu* GetMenu(LPCTSTR pszName);
00069 UINT TrackPopupMenu(LPCTSTR pszMenu, const CPoint& point, UINT nDefaultID = 0, UINT nFlags = 0);
00070 CMapStringToPtr m_pMenus;
00071 protected:
00072 BOOL LoadMenus(CXMLElement* pBase);
00073 BOOL LoadMenu(CXMLElement* pXML);
00074 BOOL CreateMenu(CXMLElement* pXML, HMENU hMenu);
00075 CMenu m_mnuDefault;
00076
00077
00078 public:
00079 BOOL CreateToolBar(LPCTSTR pszName, CCoolBarCtrl* pBar);
00080 CMapStringToPtr m_pToolbars;
00081 protected:
00082 BOOL LoadToolbars(CXMLElement* pBase);
00083 BOOL CreateToolBar(CXMLElement* pElement);
00084
00085
00086 public:
00087 CXMLElement* GetDocument(LPCTSTR pszName);
00088 protected:
00089 BOOL LoadDocuments(CXMLElement* pBase);
00090 CMapStringToPtr m_pDocuments;
00091
00092
00093 public:
00094 HBITMAP GetWatermark(LPCTSTR pszName);
00095 BOOL GetWatermark(CBitmap* pBitmap, LPCTSTR pszName);
00096 protected:
00097 BOOL LoadWatermarks(CXMLElement* pSub, const CString& strPath);
00098 CMapStringToString m_pWatermarks;
00099
00100
00101 public:
00102 BOOL Translate(LPCTSTR pszName, CHeaderCtrl* pCtrl);
00103 protected:
00104 BOOL LoadListColumns(CXMLElement* pBase);
00105 CMapStringToString m_pLists;
00106
00107
00108 public:
00109 BOOL Apply(LPCTSTR pszName, CDialog* pDialog, UINT nIconID = 0);
00110 CString GetDialogCaption(LPCTSTR pszName);
00111 protected:
00112 BOOL LoadDialogs(CXMLElement* pBase);
00113 CMapStringToPtr m_pDialogs;
00114
00115
00116 public:
00117 CSkinWindow* GetWindowSkin(LPCTSTR pszWindow, LPCTSTR pszAppend = NULL);
00118 CSkinWindow* GetWindowSkin(CWnd* pWnd);
00119 protected:
00120 BOOL LoadWindowSkins(CXMLElement* pSub, const CString& strPath);
00121 CPtrList m_pSkins;
00122
00123
00124 public:
00125 COLORREF m_crDialog;
00126 CBrush m_brDialog;
00127 COLORREF m_crPanelBack;
00128 CBitmap m_bmPanelMark;
00129 COLORREF m_crPanelText;
00130 COLORREF m_crPanelBorder;
00131 COLORREF m_crBannerBack;
00132 COLORREF m_crBannerText;
00133 COLORREF m_crSchemaRow[2];
00134 protected:
00135 BOOL LoadColourScheme(CXMLElement* pBase);
00136
00137
00138 protected:
00139 CStringList m_pFontPaths;
00140 protected:
00141 BOOL LoadFonts(CXMLElement* pBase, const CString& strPath);
00142
00143
00144 protected:
00145 UINT LookupCommandID(CXMLElement* pXML, LPCTSTR pszName = NULL);
00146 BOOL LoadCommandMap(CXMLElement* pBase);
00147 BOOL LoadCommandImages(CXMLElement* pBase, const CString& strPath);
00148 BOOL LoadCommandBitmap(CXMLElement* pBase, const CString& strPath);
00149
00150
00151 protected:
00152 static LPCTSTR m_pszModeSuffix[3][4];
00153
00154 };
00155
00156
00157 extern CSkin Skin;
00158
00159 #endif // !defined(AFX_SKIN_H__E4027F91_1EB1_4B0D_82E2_C8DD1E7F054F__INCLUDED_)