DUiLib 原始碼分析——第一篇UIManager
阿新 • • 發佈:2019-01-11
公開方法
繪圖管理器的初始化(m_hWndPaint,m_hDcPaint賦值,在預處理訊息中加入管理器)
+---void Init(HWND hWnd);
當前需要更新介面
+---void NeedUpdate();
指定區域失效
+---void Invalidate(RECT& rcItem);
獲取繪圖裝置DC
+---HDC GetPaintDC() const;
獲取繪圖的視窗控制代碼
+---HWND GetPaintWindow() const;
獲取提示窗體控制代碼
+---HWND GetTooltipWindow() const;
獲取當前滑鼠的位置
+---POINT GetMousePos() const;
獲取客戶區大小
+---SIZE GetClientSize() const;
獲取窗體初始化時的大小
+---SIZE GetInitSize();
設定窗體初始化大小
+---void SetInitSize(int cx, int cy);
獲取窗體的邊框區域大小
+---RECT& GetSizeBox();
設定窗體的邊框區域大小
+---void SetSizeBox(RECT& rcSizeBox);
獲取標題區域位置
+---RECT& GetCaptionRect();
設定標題區域位置
+---void SetCaptionRect(RECT& rcCaption);
獲取窗體四角的圓角弧度
+---SIZE GetRoundCorner() const;
設定窗體四角的圓角弧度
+---void SetRoundCorner(int cx, int cy);
獲取窗體可以調整到的最小大小
+---SIZE GetMinInfo() const;
設定窗體可以調整到的最小大小
+---void SetMinInfo(int cx, int cy);
獲取窗體可以調整到的最大大小
+---SIZE GetMaxInfo() const;
設定窗體可以調整到的最大大小
+---void SetMaxInfo(int cx, int cy);
窗體的不透明度(0完全透明-255完全不透明)
+---void SetTransparent(int nOpacity);
設定繪圖是否支援透明處理
+---void SetBackgroundTransparent(bool bTrans);
是否顯示更新區域
+---bool IsShowUpdateRect() const;
設定是否顯示更新
+---void SetShowUpdateRect(bool show);
獲取當前管理的例項控制代碼
+---static HINSTANCE GetInstance();
獲得當前執行的例項的路徑
+---static CStdString GetInstancePath();
獲得當前的工作路徑
+---static CStdString GetCurrentPath();
獲取資源DLL的例項控制代碼
+---static HINSTANCE GetResourceDll();
獲取資源的路徑(以"\"結尾)
+---static const CStdString& GetResourcePath();
獲得Zip資源的路徑
+---static const CStdString& GetResourceZip();
設定例項控制代碼
+---static void SetInstance(HINSTANCE hInst);
設定當前的工作路徑
+---static void SetCurrentPath(LPCTSTR pStrPath);
設定當前的DLL資源的例項控制代碼
+---static void SetResourceDll(HINSTANCE hInst);
設定資源所在資料夾路徑
+---static void SetResourcePath(LPCTSTR pStrPath);
設定Zip資源的路徑(包括Zip檔名)
+---static void SetResourceZip(LPCTSTR pStrZip);
設定使用上級資源的繪圖管理器
+---bool UseParentResource(CPaintManagerUI* pm);
獲得上級資源繪圖管理器
+---CPaintManagerUI* GetParentResource() const;
獲取禁用狀態的預設顏色
+---DWORD GetDefaultDisabledColor() const;
設定禁用狀態的預設顏色
+---void SetDefaultDisabledColor(DWORD dwColor);
獲取字型預設顏色
+---DWORD GetDefaultFontColor() const;
設定字型預設顏色
+---void SetDefaultFontColor(DWORD dwColor);
設定連結文字的預設字型顏色
+---DWORD GetDefaultLinkFontColor() const;
獲取連結文字的預設顏色
+---void SetDefaultLinkFontColor(DWORD dwColor);
獲取滑鼠懸停與超鏈上的預設字型顏色
+---DWORD GetDefaultLinkHoverFontColor() const;
獲取滑鼠懸停與超鏈上的預設字型顏色
+---void SetDefaultLinkHoverFontColor(DWORD dwColor);
獲取選中狀體的預設背景顏色
+---DWORD GetDefaultSelectedBkColor() const;
設定選中狀態的預設背景顏色
+---void SetDefaultSelectedBkColor(DWORD dwColor);
獲取預設使用的字型資訊
+---TFontInfo* GetDefaultFontInfo();
設定預設使用的字型資訊
+---void SetDefaultFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
獲取使用者自定義字型的數量(一般對應xml中Font的數量)
+---DWORD GetCustomFontCount() const;
向字型陣列列表追加字型資源
+---HFONT AddFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
向字型陣列列表中插入字型資源
+---HFONT AddFontAt(int index, LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
獲取陣列中指定下標的字型物件控制代碼
+---HFONT GetFont(int index);
從字型陣列中獲取指定配置的字型物件控制代碼
+---HFONT GetFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
字型陣列集合中是否存在字型物件
+---bool FindFont(HFONT hFont);
字型陣列集合中是否存在指定配置的字型物件
+---bool FindFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
獲得字型物件的
+---int GetFontIndex(HFONT hFont);
根據指定的配置資訊查詢字型索引
+---int GetFontIndex(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
從字型陣列列表中移除字型物件
+---bool RemoveFont(HFONT hFont);
從字型陣列列表中移除指定位置的字型資訊
+---bool RemoveFontAt(int index);
清空字型陣列列表
+---void RemoveAllFonts();
通過字型陣列索引查詢字型資訊
+---TFontInfo* GetFontInfo(int index);
通過字型物件控制代碼獲取字型資訊
+---TFontInfo* GetFontInfo(HFONT hFont);
根據影象路徑查詢影象資訊
+---const TImageInfo* GetImage(LPCTSTR bitmap);
根據名稱,型別,遮罩色 查詢 影象資訊
+---const TImageInfo* GetImageEx(LPCTSTR bitmap, LPCTSTR type = NULL, DWORD mask = 0);
新增影象
+---const TImageInfo* AddImage(LPCTSTR bitmap, LPCTSTR type = NULL, DWORD mask = 0);
新增影象
+---const TImageInfo* AddImage(LPCTSTR bitmap, HBITMAP hBitmap, int iWidth, int iHeight, bool bAlpha);
根據影象名稱移除影象
+---bool RemoveImage(LPCTSTR bitmap);
移除全部影象
+---void RemoveAllImages();
新增控制元件的預設配置資訊(如button)
+---void AddDefaultAttributeList(LPCTSTR pStrControlName, LPCTSTR pStrControlAttrList);
根據控制元件名稱查詢該類控制元件的預設配置
+---LPCTSTR GetDefaultAttributeList(LPCTSTR pStrControlName) const;
移除指定控制元件型別名稱的預設配置
+---bool RemoveDefaultAttributeList(LPCTSTR pStrControlName);
獲取預設配置資訊列表
+---const CStdStringPtrMap& GetDefaultAttribultes() const;
清空預設配置資訊列表
+---void RemoveAllDefaultAttributeList();
將對話方塊控制元件附加到當前的管理器中
+---bool AttachDialog(CControlUI* pControl);
控制元件初始化
+---bool InitControls(CControlUI* pControl, CControlUI* pParent = NULL);
控制元件回收
+---void ReapObjects(CControlUI* pControl);
繪圖管理器的初始化(m_hWndPaint,m_hDcPaint賦值,在預處理訊息中加入管理器)
+---void Init(HWND hWnd);
當前需要更新介面
+---void NeedUpdate();
指定區域失效
+---void Invalidate(RECT& rcItem);
獲取繪圖裝置DC
+---HDC GetPaintDC() const;
獲取繪圖的視窗控制代碼
+---HWND GetPaintWindow() const;
獲取提示窗體控制代碼
+---HWND GetTooltipWindow() const;
獲取當前滑鼠的位置
+---POINT GetMousePos() const;
獲取客戶區大小
+---SIZE GetClientSize() const;
獲取窗體初始化時的大小
+---SIZE GetInitSize();
設定窗體初始化大小
+---void SetInitSize(int cx, int cy);
獲取窗體的邊框區域大小
+---RECT& GetSizeBox();
設定窗體的邊框區域大小
+---void SetSizeBox(RECT& rcSizeBox);
獲取標題區域位置
+---RECT& GetCaptionRect();
設定標題區域位置
+---void SetCaptionRect(RECT& rcCaption);
獲取窗體四角的圓角弧度
+---SIZE GetRoundCorner() const;
設定窗體四角的圓角弧度
+---void SetRoundCorner(int cx, int cy);
獲取窗體可以調整到的最小大小
+---SIZE GetMinInfo() const;
設定窗體可以調整到的最小大小
+---void SetMinInfo(int cx, int cy);
獲取窗體可以調整到的最大大小
+---SIZE GetMaxInfo() const;
設定窗體可以調整到的最大大小
+---void SetMaxInfo(int cx, int cy);
窗體的不透明度(0完全透明-255完全不透明)
+---void SetTransparent(int nOpacity);
設定繪圖是否支援透明處理
+---void SetBackgroundTransparent(bool bTrans);
是否顯示更新區域
+---bool IsShowUpdateRect() const;
設定是否顯示更新
+---void SetShowUpdateRect(bool show);
獲取當前管理的例項控制代碼
+---static HINSTANCE GetInstance();
獲得當前執行的例項的路徑
+---static CStdString GetInstancePath();
獲得當前的工作路徑
+---static CStdString GetCurrentPath();
獲取資源DLL的例項控制代碼
+---static HINSTANCE GetResourceDll();
獲取資源的路徑(以"\"結尾)
+---static const CStdString& GetResourcePath();
獲得Zip資源的路徑
+---static const CStdString& GetResourceZip();
設定例項控制代碼
+---static void SetInstance(HINSTANCE hInst);
設定當前的工作路徑
+---static void SetCurrentPath(LPCTSTR pStrPath);
設定當前的DLL資源的例項控制代碼
+---static void SetResourceDll(HINSTANCE hInst);
設定資源所在資料夾路徑
+---static void SetResourcePath(LPCTSTR pStrPath);
設定Zip資源的路徑(包括Zip檔名)
+---static void SetResourceZip(LPCTSTR pStrZip);
設定使用上級資源的繪圖管理器
+---bool UseParentResource(CPaintManagerUI* pm);
獲得上級資源繪圖管理器
+---CPaintManagerUI* GetParentResource() const;
獲取禁用狀態的預設顏色
+---DWORD GetDefaultDisabledColor() const;
設定禁用狀態的預設顏色
+---void SetDefaultDisabledColor(DWORD dwColor);
獲取字型預設顏色
+---DWORD GetDefaultFontColor() const;
設定字型預設顏色
+---void SetDefaultFontColor(DWORD dwColor);
設定連結文字的預設字型顏色
+---DWORD GetDefaultLinkFontColor() const;
獲取連結文字的預設顏色
+---void SetDefaultLinkFontColor(DWORD dwColor);
獲取滑鼠懸停與超鏈上的預設字型顏色
+---DWORD GetDefaultLinkHoverFontColor() const;
獲取滑鼠懸停與超鏈上的預設字型顏色
+---void SetDefaultLinkHoverFontColor(DWORD dwColor);
獲取選中狀體的預設背景顏色
+---DWORD GetDefaultSelectedBkColor() const;
設定選中狀態的預設背景顏色
+---void SetDefaultSelectedBkColor(DWORD dwColor);
獲取預設使用的字型資訊
+---TFontInfo* GetDefaultFontInfo();
設定預設使用的字型資訊
+---void SetDefaultFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
獲取使用者自定義字型的數量(一般對應xml中Font的數量)
+---DWORD GetCustomFontCount() const;
向字型陣列列表追加字型資源
+---HFONT AddFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
向字型陣列列表中插入字型資源
+---HFONT AddFontAt(int index, LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
獲取陣列中指定下標的字型物件控制代碼
+---HFONT GetFont(int index);
從字型陣列中獲取指定配置的字型物件控制代碼
+---HFONT GetFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
字型陣列集合中是否存在字型物件
+---bool FindFont(HFONT hFont);
字型陣列集合中是否存在指定配置的字型物件
+---bool FindFont(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
獲得字型物件的
+---int GetFontIndex(HFONT hFont);
根據指定的配置資訊查詢字型索引
+---int GetFontIndex(LPCTSTR pStrFontName, int nSize, bool bBold, bool bUnderline, bool bItalic);
從字型陣列列表中移除字型物件
+---bool RemoveFont(HFONT hFont);
從字型陣列列表中移除指定位置的字型資訊
+---bool RemoveFontAt(int index);
清空字型陣列列表
+---void RemoveAllFonts();
通過字型陣列索引查詢字型資訊
+---TFontInfo* GetFontInfo(int index);
通過字型物件控制代碼獲取字型資訊
+---TFontInfo* GetFontInfo(HFONT hFont);
根據影象路徑查詢影象資訊
+---const TImageInfo* GetImage(LPCTSTR bitmap);
根據名稱,型別,遮罩色 查詢 影象資訊
+---const TImageInfo* GetImageEx(LPCTSTR bitmap, LPCTSTR type = NULL, DWORD mask = 0);
新增影象
+---const TImageInfo* AddImage(LPCTSTR bitmap, LPCTSTR type = NULL, DWORD mask = 0);
新增影象
+---const TImageInfo* AddImage(LPCTSTR bitmap, HBITMAP hBitmap, int iWidth, int iHeight, bool bAlpha);
根據影象名稱移除影象
+---bool RemoveImage(LPCTSTR bitmap);
移除全部影象
+---void RemoveAllImages();
新增控制元件的預設配置資訊(如button)
+---void AddDefaultAttributeList(LPCTSTR pStrControlName, LPCTSTR pStrControlAttrList);
根據控制元件名稱查詢該類控制元件的預設配置
+---LPCTSTR GetDefaultAttributeList(LPCTSTR pStrControlName) const;
移除指定控制元件型別名稱的預設配置
+---bool RemoveDefaultAttributeList(LPCTSTR pStrControlName);
獲取預設配置資訊列表
+---const CStdStringPtrMap& GetDefaultAttribultes() const;
清空預設配置資訊列表
+---void RemoveAllDefaultAttributeList();
將對話方塊控制元件附加到當前的管理器中
+---bool AttachDialog(CControlUI* pControl);
控制元件初始化
+---bool InitControls(CControlUI* pControl, CControlUI* pParent = NULL);
控制元件回收
+---void ReapObjects(CControlUI* pControl);