Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.0 KiB

  1. //
  2. // cuitb.h
  3. // UI object library - define UI objects
  4. //
  5. // CUIFObject
  6. // +- CUIFBorder border object
  7. // +- CUIFStatic static object
  8. // +- CUIFButton button object
  9. // | +- CUIFScrollButton scrollbar button object (used in CUIFScroll)
  10. // +- CUIFScrollButton scrollbar thumb object (used in CUIFScroll)
  11. // +- CUIFScroll scrollbar object
  12. // +- CUIFList listbox object
  13. // +- CUIFWindow window frame object (need to be at top of parent)
  14. //
  15. #ifndef CUITB_H
  16. #define CUITB_H
  17. #include "cuiobj.h"
  18. #include "cuiwnd.h"
  19. //-----------------------------------------------------------------------------
  20. //
  21. // CUIFToolbarButtonElement
  22. //
  23. //-----------------------------------------------------------------------------
  24. class CUIFToolbarButton;
  25. class CUIFToolbarButtonElement : public CUIFButton2
  26. {
  27. public:
  28. CUIFToolbarButtonElement( CUIFToolbarButton *pParent, DWORD dwID, RECT *prc, DWORD dwStyle);
  29. virtual ~CUIFToolbarButtonElement( void );
  30. // virtual void OnPaint(HDC hDC);
  31. virtual void OnLButtonUp( POINT pt );
  32. virtual void OnRButtonUp( POINT pt );
  33. virtual BOOL OnSetCursor( UINT uMsg, POINT pt );
  34. virtual LPCWSTR GetToolTip( void );
  35. protected:
  36. CUIFToolbarButton *_pTBButton;
  37. };
  38. //-----------------------------------------------------------------------------
  39. //
  40. // CUIFToolbarMenuButton
  41. //
  42. //-----------------------------------------------------------------------------
  43. class CUIFToolbarButton;
  44. class CUIFToolbarMenuButton : public CUIFButton2
  45. {
  46. public:
  47. CUIFToolbarMenuButton( CUIFToolbarButton *pParent, DWORD dwID, RECT *prc, DWORD dwStyle);
  48. virtual ~CUIFToolbarMenuButton( void );
  49. // virtual void OnPaint(HDC hDC);
  50. virtual void OnLButtonUp( POINT pt );
  51. virtual BOOL OnSetCursor( UINT uMsg, POINT pt );
  52. protected:
  53. CUIFToolbarButton *_pTBButton;
  54. };
  55. //
  56. // CUIFToolbarButton
  57. //-----------------------------------------------------------------------------
  58. // UIToolbarButton show type
  59. #define UITBBUTTON_BUTTON 0x00010000
  60. #define UITBBUTTON_MENU 0x00020000
  61. #define UITBBUTTON_TOGGLE 0x00040000
  62. #define UITBBUTTON_VERTICAL 0x00080000
  63. // UIToolbarButton show type
  64. #define UITBBUTTON_TEXT 0x0001
  65. //
  66. // CUIFToolbarButton
  67. //
  68. class CUIFToolbarButton : public CUIFObject
  69. {
  70. public:
  71. CUIFToolbarButton( CUIFObject *pParent, DWORD dwID, RECT *prc, DWORD dwStyle , DWORD dwSBtnStyle, DWORD dwSBtnShowType);
  72. virtual ~CUIFToolbarButton( void );
  73. BOOL Init();
  74. void SetShowType(DWORD dwSBtnShowType);
  75. virtual void SetRect( const RECT *prc );
  76. virtual void OnRightClick() {}
  77. virtual void OnLeftClick() {}
  78. virtual void OnShowMenu() {}
  79. virtual void Enable( BOOL fEnable );
  80. void SetIcon( HICON hIcon );
  81. HICON GetIcon( );
  82. void SetBitmap( HBITMAP hBmp );
  83. HBITMAP GetBitmap( );
  84. void SetBitmapMask( HBITMAP hBmp );
  85. HBITMAP GetBitmapMask( );
  86. void SetText( WCHAR *psz);
  87. void SetToolTip( LPCWSTR pwchToolTip );
  88. void SetFont(HFONT hfont);
  89. virtual LPCWSTR GetToolTip( void );
  90. BOOL IsMenuOnly();
  91. BOOL IsMenuButton();
  92. BOOL IsButtonOnly();
  93. BOOL IsToggle();
  94. BOOL IsVertical();
  95. void DetachWndObj( void );
  96. const WCHAR *GetText()
  97. {
  98. Assert(PtrToInt(_pBtn));
  99. return _pBtn->GetText();
  100. }
  101. virtual void SetActiveTheme(LPCWSTR pszClassList, int iPartID = 0, int iStateID = 0)
  102. {
  103. if (_pBtn)
  104. _pBtn->SetActiveTheme(pszClassList, iPartID, iStateID);
  105. if (_pMenuBtn)
  106. _pMenuBtn->SetActiveTheme(pszClassList, iPartID, iStateID);
  107. CUIFObject::SetActiveTheme(pszClassList, iPartID, iStateID);
  108. }
  109. virtual void ClearWndObj()
  110. {
  111. if (_pBtn)
  112. _pBtn->ClearWndObj();
  113. if (_pMenuBtn)
  114. _pMenuBtn->ClearWndObj();
  115. CUIFObject::ClearWndObj();
  116. }
  117. CUIFToolbarButtonElement *_pBtn;
  118. CUIFToolbarMenuButton *_pMenuBtn;
  119. DWORD m_dwSBtnStyle;
  120. DWORD m_dwSBtnShowType;
  121. };
  122. //
  123. //
  124. //-----------------------------------------------------------------------------
  125. // UIFSeparator style
  126. #define UITBSEPARATOR_VERTICAL 0x00000001
  127. class CUIFSeparator : public CUIFObject
  128. {
  129. public:
  130. CUIFSeparator( CUIFObject *pParent, DWORD dwId, RECT *prc, DWORD dwStyle) : CUIFObject( pParent, dwId, prc, dwStyle )
  131. {
  132. if (IsVertical())
  133. SetActiveTheme(L"TOOLBAR", TP_SEPARATORVERT);
  134. else
  135. SetActiveTheme(L"TOOLBAR", TP_SEPARATOR);
  136. }
  137. virtual ~CUIFSeparator()
  138. {
  139. }
  140. protected:
  141. virtual BOOL OnPaintTheme( HDC hDC );
  142. virtual void OnPaintNoTheme( HDC hDC );
  143. private:
  144. BOOL IsVertical() {return (GetStyle() & UITBSEPARATOR_VERTICAL) ? TRUE : FALSE;}
  145. };
  146. #endif /* CUITB_H */