UICombo.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #ifndef __UICOMBO_H__
  2. #define __UICOMBO_H__
  3. #pragma once
  4. namespace DuiLib {
  5. /////////////////////////////////////////////////////////////////////////////////////
  6. //
  7. class CComboWnd;
  8. class UILIB_API CComboUI : public CContainerUI, public IListOwnerUI
  9. {
  10. friend class CComboWnd;
  11. public:
  12. CComboUI();
  13. LPCTSTR GetClass() const;
  14. LPVOID GetInterface(LPCTSTR pstrName);
  15. void DoInit();
  16. UINT GetControlFlags() const;
  17. CDuiString GetText() const;
  18. void SetEnabled(bool bEnable = true);
  19. CDuiString GetDropBoxAttributeList();
  20. void SetDropBoxAttributeList(LPCTSTR pstrList);
  21. SIZE GetDropBoxSize() const;
  22. void SetDropBoxSize(SIZE szDropBox);
  23. int GetCurSel() const;
  24. bool GetSelectCloseFlag();
  25. void SetSelectCloseFlag(bool flag);
  26. bool SelectItem(int iIndex, bool bTakeFocus = false, bool bTriggerEvent=true);
  27. bool SetItemIndex(CControlUI* pControl, int iIndex);
  28. bool Add(CControlUI* pControl);
  29. bool AddAt(CControlUI* pControl, int iIndex);
  30. bool Remove(CControlUI* pControl);
  31. bool RemoveAt(int iIndex);
  32. void RemoveAll();
  33. bool Activate();
  34. bool GetShowText() const;
  35. void SetShowText(bool flag);
  36. RECT GetTextPadding() const;
  37. void SetTextPadding(RECT rc);
  38. LPCTSTR GetNormalImage() const;
  39. void SetNormalImage(LPCTSTR pStrImage);
  40. LPCTSTR GetHotImage() const;
  41. void SetHotImage(LPCTSTR pStrImage);
  42. LPCTSTR GetPushedImage() const;
  43. void SetPushedImage(LPCTSTR pStrImage);
  44. LPCTSTR GetFocusedImage() const;
  45. void SetFocusedImage(LPCTSTR pStrImage);
  46. LPCTSTR GetDisabledImage() const;
  47. void SetDisabledImage(LPCTSTR pStrImage);
  48. TListInfoUI* GetListInfo();
  49. void SetItemFont(int index);
  50. void SetItemTextStyle(UINT uStyle);
  51. RECT GetItemTextPadding() const;
  52. void SetItemTextPadding(RECT rc);
  53. DWORD GetItemTextColor() const;
  54. void SetItemTextColor(DWORD dwTextColor);
  55. DWORD GetItemBkColor() const;
  56. void SetItemBkColor(DWORD dwBkColor);
  57. LPCTSTR GetItemBkImage() const;
  58. void SetItemBkImage(LPCTSTR pStrImage);
  59. bool IsAlternateBk() const;
  60. void SetAlternateBk(bool bAlternateBk);
  61. DWORD GetSelectedItemTextColor() const;
  62. void SetSelectedItemTextColor(DWORD dwTextColor);
  63. DWORD GetSelectedItemBkColor() const;
  64. void SetSelectedItemBkColor(DWORD dwBkColor);
  65. LPCTSTR GetSelectedItemImage() const;
  66. void SetSelectedItemImage(LPCTSTR pStrImage);
  67. DWORD GetHotItemTextColor() const;
  68. void SetHotItemTextColor(DWORD dwTextColor);
  69. DWORD GetHotItemBkColor() const;
  70. void SetHotItemBkColor(DWORD dwBkColor);
  71. LPCTSTR GetHotItemImage() const;
  72. void SetHotItemImage(LPCTSTR pStrImage);
  73. DWORD GetDisabledItemTextColor() const;
  74. void SetDisabledItemTextColor(DWORD dwTextColor);
  75. DWORD GetDisabledItemBkColor() const;
  76. void SetDisabledItemBkColor(DWORD dwBkColor);
  77. LPCTSTR GetDisabledItemImage() const;
  78. void SetDisabledItemImage(LPCTSTR pStrImage);
  79. DWORD GetItemLineColor() const;
  80. void SetItemLineColor(DWORD dwLineColor);
  81. bool IsItemShowHtml();
  82. void SetItemShowHtml(bool bShowHtml = true);
  83. SIZE EstimateSize(SIZE szAvailable);
  84. void SetPos(RECT rc, bool bNeedInvalidate = true);
  85. void Move(SIZE szOffset, bool bNeedInvalidate = true);
  86. void DoEvent(TEventUI& event);
  87. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  88. void DoPaint(HDC hDC, const RECT& rcPaint);
  89. void PaintText(HDC hDC);
  90. void PaintStatusImage(HDC hDC);
  91. protected:
  92. CComboWnd* m_pWindow;
  93. int m_iCurSel;
  94. bool m_bShowText;
  95. bool m_bSelectCloseFlag;
  96. RECT m_rcTextPadding;
  97. CDuiString m_sDropBoxAttributes;
  98. SIZE m_szDropBox;
  99. UINT m_uButtonState;
  100. TDrawInfo m_diNormal;
  101. TDrawInfo m_diHot;
  102. TDrawInfo m_diPushed;
  103. TDrawInfo m_diFocused;
  104. TDrawInfo m_diDisabled;
  105. TListInfoUI m_ListInfo;
  106. };
  107. } // namespace DuiLib
  108. #endif // __UICOMBO_H__