HoverButton.h
上传用户:shyhzl888
上传日期:2007-01-07
资源大小:35k
文件大小:2k
源码类别:

行业应用

开发平台:

Visual C++

  1. #if !defined(AFX_HOVERBUTTON_H__1155737E_628E_11D2_81B5_0020AFC24C58__INCLUDED_)
  2. #define AFX_HOVERBUTTON_H__1155737E_628E_11D2_81B5_0020AFC24C58__INCLUDED_
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif // _MSC_VER >= 1000
  6. // HoverButton.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CHoverButton window
  10. enum BUTTON_STATE{ BUTTON_OFF, BUTTON_ON, BUTTON_OVER, BUTTON_GREYED};
  11. class CHoverButton : public CBitmapButton
  12. {
  13. // Construction
  14. public:
  15. // Constructor: default is to use buttons defined in our resources
  16. CHoverButton();
  17. // Attributes
  18. public:
  19. // The only way of accessing data from outside this class is to call these 2 functions
  20. BUTTON_STATE GetButtonState(void) { return(m_ButtonState);};
  21. BUTTON_STATE SetButtonState(BUTTON_STATE nState);
  22. private:
  23. BOOL m_bMouseTracking;
  24. BUTTON_STATE m_ButtonState;
  25. CBitmap m_bmpButtonDown;
  26. CBitmap m_bmpButtonFocussed;
  27. CBitmap m_bmpButtonUp;
  28. CBitmap m_bmpButtonDisabled;
  29. HWND m_hWndOld;
  30. // Operations
  31. public:
  32. // Overrides
  33. // ClassWizard generated virtual function overrides
  34. //{{AFX_VIRTUAL(CHoverButton)
  35. public:
  36. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  37. //}}AFX_VIRTUAL
  38. private:
  39. // Called by OnMouseMove() when entering/leaving the button
  40. void OnMouseLeave(void);
  41. void OnMouseEnter(void);
  42. // Implementation
  43. public:
  44. virtual ~CHoverButton();
  45. BOOL LoadBitmaps(UINT nBitmapUp, UINT nBitmapDown, UINT nBitmapFocus, UINT nBitmapDisabled);
  46. BOOL LoadBitmaps(LPCSTR lpszBitmapUp, LPCSTR lpszBitmapDown, LPCSTR lpszBitmapFocus, LPCSTR lpszBitmapDisabled);
  47. // Generated message map functions
  48. protected:
  49. //{{AFX_MSG(CHoverButton)
  50. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  51. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  52. //}}AFX_MSG
  53. DECLARE_MESSAGE_MAP()
  54. };
  55. /////////////////////////////////////////////////////////////////////////////
  56. //{{AFX_INSERT_LOCATION}}
  57. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  58. #endif // !defined(AFX_HOVERBUTTON_H__1155737E_628E_11D2_81B5_0020AFC24C58__INCLUDED_)