UIButton.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef __UIBUTTON_H__
  2. #define __UIBUTTON_H__
  3. #pragma once
  4. namespace DuiLib
  5. {
  6. class UILIB_API CButtonUI : public CLabelUI
  7. {
  8. DECLARE_DUICONTROL(CButtonUI)
  9. public:
  10. CButtonUI();
  11. LPCTSTR GetClass() const;
  12. LPVOID GetInterface(LPCTSTR pstrName);
  13. UINT GetControlFlags() const;
  14. bool Activate();
  15. void SetEnabled(bool bEnable = true);
  16. void DoEvent(TEventUI& event);
  17. virtual LPCTSTR GetNormalImage();
  18. virtual void SetNormalImage(LPCTSTR pStrImage);
  19. virtual LPCTSTR GetHotImage();
  20. virtual void SetHotImage(LPCTSTR pStrImage);
  21. virtual LPCTSTR GetPushedImage();
  22. virtual void SetPushedImage(LPCTSTR pStrImage);
  23. virtual LPCTSTR GetFocusedImage();
  24. virtual void SetFocusedImage(LPCTSTR pStrImage);
  25. virtual LPCTSTR GetDisabledImage();
  26. virtual void SetDisabledImage(LPCTSTR pStrImage);
  27. virtual LPCTSTR GetHotForeImage();
  28. virtual void SetHotForeImage(LPCTSTR pStrImage);
  29. virtual LPCTSTR GetPushedForeImage();
  30. virtual void SetPushedForeImage(LPCTSTR pStrImage);
  31. void SetStateCount(int nCount);
  32. int GetStateCount() const;
  33. virtual LPCTSTR GetStateImage();
  34. virtual void SetStateImage(LPCTSTR pStrImage);
  35. void BindTabIndex(int _BindTabIndex);
  36. void BindTabLayoutName(LPCTSTR _TabLayoutName);
  37. void BindTriggerTabSel(int _SetSelectIndex = -1);
  38. void RemoveBindTabIndex();
  39. int GetBindTabLayoutIndex();
  40. LPCTSTR GetBindTabLayoutName();
  41. void SetHotFont(int index);
  42. int GetHotFont() const;
  43. void SetPushedFont(int index);
  44. int GetPushedFont() const;
  45. void SetFocusedFont(int index);
  46. int GetFocusedFont() const;
  47. void SetHotBkColor(DWORD dwColor);
  48. DWORD GetHotBkColor() const;
  49. void SetPushedBkColor(DWORD dwColor);
  50. DWORD GetPushedBkColor() const;
  51. void SetDisabledBkColor(DWORD dwColor);
  52. DWORD GetDisabledBkColor() const;
  53. void SetHotTextColor(DWORD dwColor);
  54. DWORD GetHotTextColor() const;
  55. void SetPushedTextColor(DWORD dwColor);
  56. DWORD GetPushedTextColor() const;
  57. void SetFocusedTextColor(DWORD dwColor);
  58. DWORD GetFocusedTextColor() const;
  59. void SetHotBorderColor(DWORD dwColor);
  60. DWORD GetHotBorderColor() const;
  61. void SetPushedBorderColor(DWORD dwColor);
  62. DWORD GetPushedBorderColor() const;
  63. void SetDisabledBorderColor(DWORD dwColor);
  64. DWORD GetDisabledBorderColor() const;
  65. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  66. void PaintText(HDC hDC);
  67. void PaintBkColor(HDC hDC);
  68. void PaintStatusImage(HDC hDC);
  69. void PaintBorder(HDC hDC);
  70. void PaintForeImage(HDC hDC);
  71. void DrawBorder(HDC hDC, const RECT& rcItem, const DWORD& dwBorderColor, const int& nBorderSize, const RECT& rcBorderSize, const SIZE& cxyBorderRound, const int& nBorderStyle);
  72. protected:
  73. UINT m_uButtonState;
  74. int m_iHotFont;
  75. int m_iPushedFont;
  76. int m_iFocusedFont;
  77. DWORD m_dwHotBkColor;
  78. DWORD m_dwPushedBkColor;
  79. DWORD m_dwDisabledBkColor;
  80. DWORD m_dwHotTextColor;
  81. DWORD m_dwPushedTextColor;
  82. DWORD m_dwFocusedTextColor;
  83. DWORD m_dwHotBorderColor;
  84. DWORD m_dwPushedBorderColor;
  85. DWORD m_dwDisabledBorderColor;
  86. CDuiString m_sNormalImage;
  87. CDuiString m_sHotImage;
  88. CDuiString m_sHotForeImage;
  89. CDuiString m_sPushedImage;
  90. CDuiString m_sPushedForeImage;
  91. CDuiString m_sFocusedImage;
  92. CDuiString m_sDisabledImage;
  93. int m_nStateCount;
  94. CDuiString m_sStateImage;
  95. int m_iBindTabIndex;
  96. CDuiString m_sBindTabLayoutName;
  97. };
  98. } // namespace DuiLib
  99. #endif // __UIBUTTON_H__