UIScrollBar.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef __UISCROLLBAR_H__
  2. #define __UISCROLLBAR_H__
  3. #pragma once
  4. namespace DuiLib
  5. {
  6. class UILIB_API CScrollBarUI : public CControlUI
  7. {
  8. DECLARE_DUICONTROL(CScrollBarUI)
  9. public:
  10. CScrollBarUI();
  11. LPCTSTR GetClass() const;
  12. LPVOID GetInterface(LPCTSTR pstrName);
  13. CContainerUI* GetOwner() const;
  14. void SetOwner(CContainerUI* pOwner);
  15. void SetVisible(bool bVisible = true);
  16. void SetEnabled(bool bEnable = true);
  17. void SetFocus();
  18. bool IsHorizontal();
  19. void SetHorizontal(bool bHorizontal = true);
  20. int GetScrollRange() const;
  21. void SetScrollRange(int nRange);
  22. int GetScrollPos() const;
  23. void SetScrollPos(int nPos);
  24. int GetLineSize() const;
  25. void SetLineSize(int nSize);
  26. bool GetShowButton1();
  27. void SetShowButton1(bool bShow);
  28. LPCTSTR GetButton1NormalImage();
  29. void SetButton1NormalImage(LPCTSTR pStrImage);
  30. LPCTSTR GetButton1HotImage();
  31. void SetButton1HotImage(LPCTSTR pStrImage);
  32. LPCTSTR GetButton1PushedImage();
  33. void SetButton1PushedImage(LPCTSTR pStrImage);
  34. LPCTSTR GetButton1DisabledImage();
  35. void SetButton1DisabledImage(LPCTSTR pStrImage);
  36. bool GetShowButton2();
  37. void SetShowButton2(bool bShow);
  38. LPCTSTR GetButton2NormalImage();
  39. void SetButton2NormalImage(LPCTSTR pStrImage);
  40. LPCTSTR GetButton2HotImage();
  41. void SetButton2HotImage(LPCTSTR pStrImage);
  42. LPCTSTR GetButton2PushedImage();
  43. void SetButton2PushedImage(LPCTSTR pStrImage);
  44. LPCTSTR GetButton2DisabledImage();
  45. void SetButton2DisabledImage(LPCTSTR pStrImage);
  46. LPCTSTR GetThumbNormalImage();
  47. void SetThumbNormalImage(LPCTSTR pStrImage);
  48. LPCTSTR GetThumbHotImage();
  49. void SetThumbHotImage(LPCTSTR pStrImage);
  50. LPCTSTR GetThumbPushedImage();
  51. void SetThumbPushedImage(LPCTSTR pStrImage);
  52. LPCTSTR GetThumbDisabledImage();
  53. void SetThumbDisabledImage(LPCTSTR pStrImage);
  54. LPCTSTR GetRailNormalImage();
  55. void SetRailNormalImage(LPCTSTR pStrImage);
  56. LPCTSTR GetRailHotImage();
  57. void SetRailHotImage(LPCTSTR pStrImage);
  58. LPCTSTR GetRailPushedImage();
  59. void SetRailPushedImage(LPCTSTR pStrImage);
  60. LPCTSTR GetRailDisabledImage();
  61. void SetRailDisabledImage(LPCTSTR pStrImage);
  62. LPCTSTR GetBkNormalImage();
  63. void SetBkNormalImage(LPCTSTR pStrImage);
  64. LPCTSTR GetBkHotImage();
  65. void SetBkHotImage(LPCTSTR pStrImage);
  66. LPCTSTR GetBkPushedImage();
  67. void SetBkPushedImage(LPCTSTR pStrImage);
  68. LPCTSTR GetBkDisabledImage();
  69. void SetBkDisabledImage(LPCTSTR pStrImage);
  70. bool GetShow();
  71. void SetShow(bool bShow);
  72. void SetPos(RECT rc, bool bNeedInvalidate = true);
  73. void DoEvent(TEventUI& event);
  74. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  75. bool DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl);
  76. void PaintBk(HDC hDC);
  77. void PaintButton1(HDC hDC);
  78. void PaintButton2(HDC hDC);
  79. void PaintThumb(HDC hDC);
  80. void PaintRail(HDC hDC);
  81. protected:
  82. enum
  83. {
  84. DEFAULT_SCROLLBAR_SIZE = 16,
  85. DEFAULT_TIMERID = 10,
  86. };
  87. bool m_bShow;
  88. bool m_bHorizontal;
  89. __int64 m_nRange;
  90. __int64 m_nScrollPos;
  91. int m_nLineSize;
  92. CContainerUI* m_pOwner;
  93. POINT m_ptLastMouse;
  94. int m_nLastScrollPos;
  95. int m_nLastScrollOffset;
  96. int m_nScrollRepeatDelay;
  97. CDuiString m_sBkNormalImage;
  98. CDuiString m_sBkHotImage;
  99. CDuiString m_sBkPushedImage;
  100. CDuiString m_sBkDisabledImage;
  101. bool m_bShowButton1;
  102. RECT m_rcButton1;
  103. UINT m_uButton1State;
  104. CDuiString m_sButton1NormalImage;
  105. CDuiString m_sButton1HotImage;
  106. CDuiString m_sButton1PushedImage;
  107. CDuiString m_sButton1DisabledImage;
  108. bool m_bShowButton2;
  109. RECT m_rcButton2;
  110. UINT m_uButton2State;
  111. CDuiString m_sButton2NormalImage;
  112. CDuiString m_sButton2HotImage;
  113. CDuiString m_sButton2PushedImage;
  114. CDuiString m_sButton2DisabledImage;
  115. RECT m_rcThumb;
  116. UINT m_uThumbState;
  117. CDuiString m_sThumbNormalImage;
  118. CDuiString m_sThumbHotImage;
  119. CDuiString m_sThumbPushedImage;
  120. CDuiString m_sThumbDisabledImage;
  121. CDuiString m_sRailNormalImage;
  122. CDuiString m_sRailHotImage;
  123. CDuiString m_sRailPushedImage;
  124. CDuiString m_sRailDisabledImage;
  125. CDuiString m_sImageModify;
  126. };
  127. }
  128. #endif // __UISCROLLBAR_H__