UICombo.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #ifndef __UICOMBO_H__
  2. #define __UICOMBO_H__
  3. #pragma once
  4. namespace DuiLib {
  5. /////////////////////////////////////////////////////////////////////////////////////
  6. //
  7. class CComboWnd;
  8. class DUILIB_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 ExpandItem(int iIndex, bool bExpand = true);
  28. int GetExpandedItem() const;
  29. bool SetItemIndex(CControlUI* pControl, int iNewIndex);
  30. bool SetMultiItemIndex(CControlUI* pStartControl, int iCount, int iNewStartIndex);
  31. bool Add(CControlUI* pControl);
  32. bool AddAt(CControlUI* pControl, int iIndex);
  33. bool Remove(CControlUI* pControl, bool bDoNotDestroy=false);
  34. bool RemoveAt(int iIndex, bool bDoNotDestroy=false);
  35. void RemoveAll();
  36. bool Activate();
  37. bool GetShowText() const;
  38. void SetShowText(bool flag);
  39. RECT GetTextPadding() const;
  40. void SetTextPadding(RECT rc);
  41. LPCTSTR GetNormalImage() const;
  42. void SetNormalImage(LPCTSTR pStrImage);
  43. LPCTSTR GetHotImage() const;
  44. void SetHotImage(LPCTSTR pStrImage);
  45. LPCTSTR GetPushedImage() const;
  46. void SetPushedImage(LPCTSTR pStrImage);
  47. LPCTSTR GetFocusedImage() const;
  48. void SetFocusedImage(LPCTSTR pStrImage);
  49. LPCTSTR GetDisabledImage() const;
  50. void SetDisabledImage(LPCTSTR pStrImage);
  51. TListInfoUI* GetListInfo();
  52. UINT GetItemFixedHeight();
  53. void SetItemFixedHeight(UINT nHeight);
  54. int GetItemFont(int index);
  55. void SetItemFont(int index);
  56. UINT GetItemTextStyle();
  57. void SetItemTextStyle(UINT uStyle);
  58. RECT GetItemTextPadding() const;
  59. void SetItemTextPadding(RECT rc);
  60. DWORD GetItemTextColor() const;
  61. void SetItemTextColor(DWORD dwTextColor);
  62. DWORD GetItemBkColor() const;
  63. void SetItemBkColor(DWORD dwBkColor);
  64. LPCTSTR GetItemBkImage() const;
  65. void SetItemBkImage(LPCTSTR pStrImage);
  66. bool IsAlternateBk() const;
  67. void SetAlternateBk(bool bAlternateBk);
  68. DWORD GetSelectedItemTextColor() const;
  69. void SetSelectedItemTextColor(DWORD dwTextColor);
  70. DWORD GetSelectedItemBkColor() const;
  71. void SetSelectedItemBkColor(DWORD dwBkColor);
  72. LPCTSTR GetSelectedItemImage() const;
  73. void SetSelectedItemImage(LPCTSTR pStrImage);
  74. DWORD GetHotItemTextColor() const;
  75. void SetHotItemTextColor(DWORD dwTextColor);
  76. DWORD GetHotItemBkColor() const;
  77. void SetHotItemBkColor(DWORD dwBkColor);
  78. LPCTSTR GetHotItemImage() const;
  79. void SetHotItemImage(LPCTSTR pStrImage);
  80. DWORD GetDisabledItemTextColor() const;
  81. void SetDisabledItemTextColor(DWORD dwTextColor);
  82. DWORD GetDisabledItemBkColor() const;
  83. void SetDisabledItemBkColor(DWORD dwBkColor);
  84. LPCTSTR GetDisabledItemImage() const;
  85. void SetDisabledItemImage(LPCTSTR pStrImage);
  86. int GetItemHLineSize() const;
  87. void SetItemHLineSize(int iSize);
  88. DWORD GetItemHLineColor() const;
  89. void SetItemHLineColor(DWORD dwLineColor);
  90. int GetItemVLineSize() const;
  91. void SetItemVLineSize(int iSize);
  92. DWORD GetItemVLineColor() const;
  93. void SetItemVLineColor(DWORD dwLineColor);
  94. bool IsItemShowHtml();
  95. void SetItemShowHtml(bool bShowHtml = true);
  96. SIZE EstimateSize(SIZE szAvailable);
  97. void SetPos(RECT rc, bool bNeedInvalidate = true);
  98. void Move(SIZE szOffset, bool bNeedInvalidate = true);
  99. void DoEvent(TEventUI& event);
  100. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  101. bool DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl);
  102. void PaintText(HDC hDC);
  103. void PaintStatusImage(HDC hDC);
  104. protected:
  105. CComboWnd* m_pWindow;
  106. int m_iCurSel;
  107. bool m_bShowText;
  108. bool m_bSelectCloseFlag;
  109. RECT m_rcTextPadding;
  110. CDuiString m_sDropBoxAttributes;
  111. SIZE m_szDropBox;
  112. UINT m_uButtonState;
  113. TDrawInfo m_diNormal;
  114. TDrawInfo m_diHot;
  115. TDrawInfo m_diPushed;
  116. TDrawInfo m_diFocused;
  117. TDrawInfo m_diDisabled;
  118. TListInfoUI m_ListInfo;
  119. };
  120. } // namespace DuiLib
  121. #endif // __UICOMBO_H__