DXButton.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DXButton.h
- #ifndef _DXBUTTON__H
- #define _DXBUTTON__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- class CDDSurface;
- class CDDCursor;
- class CDSBuffer;
- class CDXDialog;
- class CDIKeyState;
- class CDXButton : public CObject
- {
- DECLARE_SERIAL(CDXButton);
- public:
- enum DXBUTTON_ACTION_TYPE
- {
- DXBUTTON_DOWNACTION,
- DXBUTTON_UPACTION,
- };
- enum DXBUTTON_STATE
- {
- DXBUTTON_STATE_NORMAL,
- DXBUTTON_STATE_FOCUSED,
- DXBUTTON_STATE_PRESSDOWN,
- DXBUTTON_STATE_DISABLE,
- DXBUTTON_NUMBER_STATE
- };
- public:
- CDXButton(void);
- virtual ~CDXButton();
- public:
- bool Create(CDXDialog* pParent,
- CDSBuffer* pSoundFocused,
- CDSBuffer* pSoundPressDown,
- int nID);
- public:
- virtual bool IsPointIn(int nX, int nY);
- virtual void Draw(CDDSurface* pDestSurface);
- virtual void Move(int nOffsetX, int nOffsetY);
- virtual void OnMouseOver(void);
- virtual void OnMouseLeave(void);
- virtual bool OnAction(void);
- virtual void SetDisable(bool bDisable);
- bool IsDisable(void) const;
- bool IsPressed(void) const;
- public:
- void SetState(DXBUTTON_STATE ButtonStateNew);
- public:
- virtual void OnLButtonDown(int nMouseX, int nMouseY);
- virtual void OnLButtonUp(int nMouseX, int nMouseY);
- virtual void OnLButtonDblClk(int nMouseX, int nMouseY);
- virtual void OnRButtonDown(int nMouseX, int nMouseY);
- virtual void OnRButtonUp(int nMouseX, int nMouseY);
- virtual void OnRButtonDblClk(int nMouseX, int nMouseY);
- virtual void OnMButtonDown(int nMouseX, int nMouseY);
- virtual void OnMButtonUp(int nMouseX, int nMouseY);
- virtual void OnMButtonDblClk(int nMouseX, int nMouseY);
- virtual bool OnKeyDown(CDIKeyState* pKeyState);
- virtual bool OnKeyUp(CDIKeyState* pKeyState);
- public:
- DXBUTTON_ACTION_TYPE m_ButtonActionType;
- DXBUTTON_STATE m_ButtonState;
- bool m_bPressed;
- CDSBuffer* m_pSoundFocused;
- CDSBuffer* m_pSoundPressDown;
- protected:
- CDXDialog* m_pParent;
- int m_nID;
- };
- #endif // _DXBUTTON__H