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.

106 lines
4.3 KiB

  1. #ifndef _CLASS_EXTENDED_BUTTON_H_
  2. #define _CLASS_EXTENDED_BUTTON_H_
  3. #include <windowsx.h>
  4. #include "dbg.h"
  5. #include "ccom.h"
  6. #ifdef UNDER_CE // macro
  7. // Under WindowsCE, DrawIcon() is defined as DrawIconEx(), not a real function
  8. #undef DrawIcon
  9. #endif // UNDER_CE
  10. //----------------------------------------------------------------
  11. //Pushed poped, flat image style definition.
  12. //----------------------------------------------------------------
  13. typedef enum tagIMAGESTYLE {
  14. IS_FLAT = 0,
  15. IS_POPED,
  16. IS_PUSHED,
  17. }IMAGESTYLE;
  18. class CEXButton;
  19. typedef CEXButton *LPCEXButton;
  20. class CEXButton : public CCommon
  21. {
  22. public:
  23. CEXButton(HINSTANCE hInst, HWND hwndParent, DWORD dwStyle, DWORD wID);
  24. ~CEXButton();
  25. #ifndef UNDER_CE
  26. BOOL RegisterWinClass(LPSTR lpstrClassName);
  27. #else // UNDER_CE
  28. BOOL RegisterWinClass(LPTSTR lpstrClassName);
  29. #endif // UNDER_CE
  30. INT MsgCreate (HWND hwnd, WPARAM wParam, LPARAM lParam);
  31. INT MsgPaint (HWND hwnd, WPARAM wParam, LPARAM lParam);
  32. INT MsgDestroy (HWND hwnd, WPARAM wParam, LPARAM lParam);
  33. INT MsgTimer (HWND hwnd, WPARAM wParam, LPARAM lParam);
  34. INT MsgMouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam);
  35. INT MsgButtonDown (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  36. INT MsgButtonUp (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  37. INT MsgNcMouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam);
  38. INT MsgNcButtonDown (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  39. INT MsgNcButtonUp (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  40. INT MsgEnable (HWND hwnd, WPARAM wParam, LPARAM lParam);
  41. INT MsgSetFont (HWND hwnd, WPARAM wParam, LPARAM lParam);
  42. INT MsgCaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam);
  43. INT MsgEXB_GetCheck (HWND hwnd, WPARAM wParam, LPARAM lParam);
  44. INT MsgEXB_SetCheck (HWND hwnd, WPARAM wParam, LPARAM lParam);
  45. INT MsgEXB_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam);
  46. INT MsgEXB_SetText (HWND hwnd, WPARAM wParam, LPARAM lParam);
  47. INT MsgEXB_SetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam);
  48. private:
  49. //----------------------------------------------------------------
  50. // Private method
  51. //----------------------------------------------------------------
  52. INT NotifyToParent (INT notify);
  53. INT NotifyClickToParent(INT notify);
  54. INT PressedState();
  55. INT CancelPressedState();
  56. INT DrawButton (HDC hDC, LPRECT lpRc);
  57. INT DrawThickEdge (HDC hDC, LPRECT lpRc, IMAGESTYLE imageStyle);
  58. INT DrawThinEdge (HDC hDC, LPRECT lpRc, IMAGESTYLE imageStyle);
  59. INT DrawIcon (HDC hDC, LPRECT lpRc, IMAGESTYLE imageStyle);
  60. INT DrawBitmap (HDC hDC, LPRECT lpRc, IMAGESTYLE imageStyle);
  61. INT DrawText (HDC hDC, LPRECT lpRc, IMAGESTYLE imageStyle);
  62. INT DrawLine (HDC hDC, INT x, INT y, INT destX, INT destY);
  63. //----------------------------------------------------------------
  64. //member variable
  65. //----------------------------------------------------------------
  66. HINSTANCE m_hInst;
  67. HWND m_hwndParent;
  68. HWND m_hwndFrame;
  69. DWORD m_dwStyle; //combination of DDBS_XXXX
  70. DWORD m_wID; //Window ID;
  71. BOOL m_fEnable; //Enabled or Disabled.
  72. HFONT m_hFont; //Font handle
  73. HICON m_hIcon; //Icon handle
  74. INT m_cxIcon; //Icon width
  75. INT m_cyIcon; //Icon height
  76. LPWSTR m_lpwstrText; //Button face text.
  77. BOOL m_fPushed; //Toggle button : Pushed or poped state.
  78. BOOL m_fArmed; //Pushed or poped apparence.
  79. BOOL m_fDowned; //Mouse has clicked.
  80. BOOL m_fDblClked; //Send Double click or not.
  81. BOOL m_fWaiting; // Waiting for double click.
  82. #ifdef NOTUSED // kwada
  83. INT m_wNotifyMsg; // either EXBN_CLICKED or EXBN_DOUBLECLICKED
  84. #endif
  85. BOOL m_f16bitOnNT; //it's on 16bit Application On WinNT.
  86. SIZE m_tmpSize; //to reduce stack
  87. #ifndef UNDER_CE // not support WNDCLASSEX
  88. WNDCLASSEX m_tmpWC; //to reduce stack
  89. #else // UNDER_CE
  90. WNDCLASS m_tmpWC; //to reduce stack
  91. #endif // UNDER_CE
  92. RECT m_tmpBtnRc; //to reduce stack
  93. RECT m_tmpRect; //to reduce stack
  94. RECT m_tmpRect2; //to reduce stack
  95. POINT m_tmpPoint; //to reduce stack
  96. PAINTSTRUCT m_tmpPs; //to reduce stack
  97. ICONINFO m_tmpIconInfo; //to reduce stack
  98. BITMAP m_tmpBitmap; //to reduce stack
  99. };
  100. #endif //_CLASS_EXTENDED_BUTTON_H_