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

DirextX编程

开发平台:

Visual C++

  1. // Copyright (C) 1998-1999 DXGuide.  All Rights Reserved.
  2. // File: DXButton.h
  3. #ifndef _DXBUTTON__H
  4. #define _DXBUTTON__H
  5. #if _MSC_VER >= 1000
  6. #pragma once
  7. #endif // _MSC_VER >= 1000
  8. class CDDSurface;
  9. class CDDCursor;
  10. class CDSBuffer;
  11. class CDXDialog;
  12. class CDIKeyState;
  13. class CDXButton : public CObject
  14. {
  15. DECLARE_SERIAL(CDXButton);
  16. public:
  17. enum DXBUTTON_ACTION_TYPE
  18. {
  19. DXBUTTON_DOWNACTION,
  20. DXBUTTON_UPACTION,
  21. };
  22. enum DXBUTTON_STATE
  23. {
  24. DXBUTTON_STATE_NORMAL,
  25. DXBUTTON_STATE_FOCUSED,
  26. DXBUTTON_STATE_PRESSDOWN,
  27. DXBUTTON_STATE_DISABLE,
  28. DXBUTTON_NUMBER_STATE
  29. };
  30. public:
  31. CDXButton(void);
  32. virtual ~CDXButton();
  33. public:
  34. bool Create(CDXDialog*  pParent,
  35. CDSBuffer*  pSoundFocused,
  36. CDSBuffer*  pSoundPressDown,
  37. int  nID);
  38. public:
  39. virtual bool IsPointIn(int  nX, int  nY);
  40. virtual void Draw(CDDSurface*  pDestSurface);
  41. virtual void Move(int  nOffsetX, int  nOffsetY);
  42. virtual void OnMouseOver(void);
  43. virtual void OnMouseLeave(void);
  44. virtual bool OnAction(void);
  45. virtual void SetDisable(bool  bDisable);
  46. bool IsDisable(void) const;
  47. bool IsPressed(void) const;
  48. public:
  49. void SetState(DXBUTTON_STATE  ButtonStateNew);
  50. public:
  51. virtual void OnLButtonDown(int  nMouseX, int  nMouseY);
  52. virtual void OnLButtonUp(int  nMouseX, int  nMouseY);
  53. virtual void OnLButtonDblClk(int  nMouseX, int  nMouseY);
  54. virtual void OnRButtonDown(int  nMouseX, int  nMouseY);
  55. virtual void OnRButtonUp(int  nMouseX, int  nMouseY);
  56. virtual void OnRButtonDblClk(int  nMouseX, int  nMouseY);
  57. virtual void OnMButtonDown(int  nMouseX, int  nMouseY);
  58. virtual void OnMButtonUp(int  nMouseX, int  nMouseY);
  59. virtual void OnMButtonDblClk(int  nMouseX, int  nMouseY);
  60. virtual bool OnKeyDown(CDIKeyState*  pKeyState);
  61. virtual bool OnKeyUp(CDIKeyState*  pKeyState);
  62. public:
  63. DXBUTTON_ACTION_TYPE m_ButtonActionType;
  64. DXBUTTON_STATE m_ButtonState;
  65. bool m_bPressed;
  66. CDSBuffer* m_pSoundFocused;
  67. CDSBuffer* m_pSoundPressDown;
  68. protected:
  69. CDXDialog* m_pParent;
  70. int m_nID;
  71. };
  72. #endif // _DXBUTTON__H