forked from excitom/vp-spades
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameBtn.h
59 lines (49 loc) · 1.45 KB
/
GameBtn.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _UBQ_GAME_BUTTON_H_
#define _UBQ_GAME_BUTTON_H_
#define BTN_UP_NO_FOCUS 0
#define BTN_UP_FOCUS 1
#define BTN_DOWN 2
#define BTN_DISABLED 3
#define TOGGLE_NO_FOCUS 0
#define TOGGLE_FOCUS 1
#define TOGGLE_DISABLED 4
class CUbqGameButton : public CUbqMultImage
{
// construction
public:
CUbqGameButton(int id, CRect Area, CUbqGameBoard* p_board, BOOL IsToggle=FALSE);
~CUbqGameButton();
// methods
public:
int GetID() { return m_id;}
void MouseUp();
void MouseDown();
void SetDisabled(BOOL bIsDisables);
void SetInFocus(BOOL bIsInFocus);
void SetEnabledInFocus();
BOOL IsDisabled() { if (m_bIsToggle)
return(GetStatus() == TOGGLE_DISABLED);
else
return(GetStatus() == BTN_DISABLED) ; }
BOOL IsDown() { if (m_bIsToggle)
return FALSE;
else
return(GetStatus() == BTN_DOWN); }
BOOL IsUpNoFocus(){ if (m_bIsToggle)
return(GetStatus() == TOGGLE_NO_FOCUS+m_nToggleFrame);
else
return(GetStatus() == BTN_UP_NO_FOCUS); }
BOOL IsUpFocus() { if (m_bIsToggle)
return(GetStatus() == TOGGLE_FOCUS+m_nToggleFrame);
else
return(GetStatus() == BTN_UP_FOCUS); }
// toggle buttons support.
void SetToggle (BOOL ToggleOn) {m_nToggleFrame = (ToggleOn?0:2);}
BOOL IsToggleOn () {return m_nToggleFrame==2;}
// members
private:
int m_id;
BOOL m_bIsToggle;
int m_nToggleFrame;
};
#endif // _UBQ_GAME_BUTTON_H_