ReactOS 0.4.16-dev-336-gb667d82
cardregion.h
Go to the documentation of this file.
1#ifndef CARDREGION_INCLUDED
2#define CARDREGION_INCLUDED
3
4class CardWindow;
5
6//
7// This class defines a physical card-stack,
8// which draws the cards, supports
9//
10
12{
13 friend class CardWindow;
14 friend class CardStack;
15
16 //
17 // Constructor is PRIVATE - only
18 // a CardWindow can create cardstacks!
19 //
20 CardRegion(CardWindow &parent, int id, bool fVisible,
21 int x, int y, int xOffset, int yOffset);
22
24
25public:
26
27 void SetBackColor(COLORREF cr);
28
29 void SetCardStack(const CardStack &cs);
30 const CardStack & GetCardStack();
31
32 //
33 // Event-callback support
34 //
35 bool SetDragRule(UINT uDragType, pCanDragProc proc = 0);
36 bool SetDropRule(UINT uDropType, pCanDropProc proc = 0);
37
41
44
45 //
46 // Physical attribute support
47 //
48 bool SetThreedCount (int count);
49 void SetOffsets (int x, int y);
50 void SetPos (int x, int y);
51 void Show (bool fShow);
52 bool IsVisible ();
53
54 void SetEmptyImage (UINT uImage);
55 void SetBackCardIdx (UINT uBackIdx);
56 void SetPlacement (UINT xJustify, UINT yJustify, int xAdjust, int yAdjust);
57
58 void Update();
59 void Redraw();
60
61 void SetFaceDirection(UINT uDirType, int nOption);
62 UINT GetFaceDirection(int *pnOption);
63
64 void Flash(int count, int timeout);
65 void StopFlash();
66
67 int Id();
68
70
71 bool PlayCard(CardRegion *pDestStack, int value, int num);
72 bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate);
73 bool SimulateDrag(CardRegion *pDestStack, int nNumCards, bool fAnimate);
74
75 bool Lock();
76 bool UnLock();
77
78 //
79 // Common wrappers for the CardStack object
80 //
81 int NumCards() const;
84 void Clear() { cardstack.Clear(); }
85
87
88 void Push(const Card card) { cardstack.Push(card); }
89 void Push(const CardStack &cs) { cardstack.Push(cs); }
90
91 Card Pop() { return cardstack.Pop(); }
93
94 Card Top() { return cardstack.Top(); }
96
97
98private:
99
100 void DoFlash();
101 void RedrawIfNotDim(CardRegion *compare, bool fFullRedraw);
102
103 void UpdateFaceDir(CardStack &cards);
104 void Clip(HDC hdc);
105 void Render(HDC hdc);
106 int GetOverlapRatio(int x, int y, int width, int height);
107
108 void MoveDragCardTo(HDC hdc, int x, int y);
109 void ZoomCard(HDC hdc, int xpos, int ypos, CardRegion *dest);
110
111 void RenderBottomMost(HDC hdc, int minustopmost = 0);
112 void PrepareDragBitmaps(int numtodrag);
113 void PrepareDragBitmapsThreed(int numtodrag);
114 void ReleaseDragBitmaps(void);
115
116 bool CanDragCards(int iNumCards);
117 bool CanDropCards(CardStack &cards);
118
119 void CalcApparentCards();
120 int CalcApparentCards(int realnum);
121
122 void UpdateSize();
123 void AdjustPosition(int winwidth, int winheight);
124
125 bool IsPointInStack(int x, int y);
126
127 int GetNumDragCards(int x, int y);
128 bool OnLButtonDown(int x, int y);
129 bool OnLButtonDblClk(int x, int y);
130 bool OnMouseMove(int x, int y);
131 bool OnLButtonUp(int x, int y);
132 void ClickRelease(int x, int y);
133
134
135 //
136 // Private data members
137 //
138
139 int id;
140
142
143 CardStack cardstack; //cards in this stack
144 CardStack dragstack; //cards which we might be dragging
145
147
148 int xpos; //coordinates of stack
149 int ypos;
150
151 int xoffset; //direction that cards take
153
154 int width; //stack-size of all cards
156
157 //
158 // justify / placement vars
163
164 //
165 // Used for mouse-dragging / moving cards
166 //
170 int oldx;
171 int oldy;
172
175
180
184
188
190
195
198
199 //
200 // Stack callback support
201 //
209
210 //locking mechanism to prevent user dragging etc
212};
213
214#endif /* CARDREGION_INCLUDED */
int yOffset
Definition: appswitch.c:59
int xOffset
Definition: appswitch.c:59
void(CARDLIBPROC * pClickProc)(CardRegion &stackobj, int iNumCards)
Definition: cardlib.h:87
bool(CARDLIBPROC * pCanDragProc)(CardRegion &stackobj, int iNumDragging)
Definition: cardlib.h:85
void(CARDLIBPROC * pAddProc)(CardRegion &stackobj, const CardStack &cards)
Definition: cardlib.h:88
bool(CARDLIBPROC * pCanDropProc)(CardRegion &stackobj, CardStack &cards)
Definition: cardlib.h:86
void(CARDLIBPROC * pRemoveProc)(CardRegion &stackobj, int iNumRemoved)
Definition: cardlib.h:89
int nDragCardWidth
Definition: cardregion.h:173
void SetClickProc(pClickProc proc)
Definition: cardregion.cpp:182
void Push(const Card card)
Definition: cardregion.h:88
int nDragCardHeight
Definition: cardregion.h:174
void Push(const CardStack &cs)
Definition: cardregion.h:89
void SetBackColor(COLORREF cr)
Definition: cardregion.cpp:67
void Flash(int count, int timeout)
Definition: cardregion.cpp:322
void CalcApparentCards()
Definition: cardregion.cpp:77
bool IsVisible()
Definition: cardregion.cpp:245
HANDLE mxlock
Definition: cardregion.h:211
bool fMouseDragging
Definition: cardregion.h:146
bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:477
void SetBackCardIdx(UINT uBackIdx)
Definition: cardregion.cpp:384
pRemoveProc RemoveCallback
Definition: cardregion.h:208
void UpdateSize()
Definition: cardregion.cpp:83
UINT uDragRule
Definition: cardregion.h:196
bool CanDragCards(int iNumCards)
void DoFlash()
Definition: cardregion.cpp:344
void Show(bool fShow)
Definition: cardregion.cpp:240
UINT uFaceDirType
Definition: cardregion.h:192
void SetEmptyImage(UINT uImage)
Definition: cardregion.cpp:366
bool IsPointInStack(int x, int y)
int GetNumDragCards(int x, int y)
CardStack Top(int items)
Definition: cardregion.h:95
bool SetDropRule(UINT uDropType, pCanDropProc proc=0)
Definition: cardregion.cpp:164
void SetClickReleaseProc(pClickProc proc)
Definition: cardregion.cpp:187
bool Lock()
Definition: cardregion.cpp:552
void RedrawIfNotDim(CardRegion *compare, bool fFullRedraw)
Definition: cardregion.cpp:611
int nBackCardIdx
Definition: cardregion.h:194
CardStack cardstack
Definition: cardregion.h:143
HBITMAP hbmDragCard
Definition: cardregion.h:179
void Clip(HDC hdc)
void SetRemoveCardProc(pRemoveProc proc)
Definition: cardregion.cpp:202
void ClickRelease(int x, int y)
pCanDragProc CanDragCallback
Definition: cardregion.h:202
UINT uFlashTimer
Definition: cardregion.h:187
int mouseyoffset
Definition: cardregion.h:169
bool CanDropCards(CardStack &cards)
bool PlayCard(CardRegion *pDestStack, int value, int num)
Definition: cardregion.cpp:583
bool SetDragRule(UINT uDragType, pCanDragProc proc=0)
Definition: cardregion.cpp:146
void ReleaseDragBitmaps(void)
void NewDeck()
Definition: cardregion.h:82
void PrepareDragBitmaps(int numtodrag)
void SetPlacement(UINT xJustify, UINT yJustify, int xAdjust, int yAdjust)
Definition: cardregion.cpp:250
CardWindow & GetCardWindow()
Definition: cardregion.h:69
bool OnLButtonDblClk(int x, int y)
void SetAddCardProc(pAddProc proc)
Definition: cardregion.cpp:197
void PrepareDragBitmapsThreed(int numtodrag)
void RenderBottomMost(HDC hdc, int minustopmost=0)
int nFaceDirOption
Definition: cardregion.h:193
bool OnMouseMove(int x, int y)
bool fVisible
Definition: cardregion.h:183
pClickProc ClickCallback
Definition: cardregion.h:204
bool SetThreedCount(int count)
Definition: cardregion.cpp:215
void Redraw()
int xjustify
Definition: cardregion.h:159
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
int yjustify
Definition: cardregion.h:160
bool OnLButtonUp(int x, int y)
void Reverse()
Definition: cardregion.h:86
void AdjustPosition(int winwidth, int winheight)
Definition: cardregion.cpp:281
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
CardStack Pop(int items)
Definition: cardregion.h:92
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
int iNumDragCards
Definition: cardregion.h:167
void SetPos(int x, int y)
Definition: cardregion.cpp:234
void SetOffsets(int x, int y)
Definition: cardregion.cpp:228
void Render(HDC hdc)
bool fFlashVisible
Definition: cardregion.h:186
int GetOverlapRatio(int x, int y, int width, int height)
Definition: cardregion.cpp:120
UINT uDropRule
Definition: cardregion.h:197
int nFlashCount
Definition: cardregion.h:185
UINT uEmptyImage
Definition: cardregion.h:191
HDC hdcBackGnd
Definition: cardregion.h:176
int NumCards() const
Definition: cardregion.cpp:544
HDC hdcDragCard
Definition: cardregion.h:178
int nThreedCount
Definition: cardregion.h:182
void Update()
Definition: cardregion.cpp:207
void Clear()
Definition: cardregion.h:84
pClickProc DblClickCallback
Definition: cardregion.h:206
UINT GetFaceDirection(int *pnOption)
Definition: cardregion.cpp:273
CardStack dragstack
Definition: cardregion.h:144
void Shuffle()
Definition: cardregion.h:83
bool UnLock()
Definition: cardregion.cpp:569
pAddProc AddCallback
Definition: cardregion.h:207
bool SimulateDrag(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:636
void ZoomCard(HDC hdc, int xpos, int ypos, CardRegion *dest)
void MoveDragCardTo(HDC hdc, int x, int y)
Card Pop()
Definition: cardregion.h:91
int mousexoffset
Definition: cardregion.h:168
Card Top()
Definition: cardregion.h:94
pCanDropProc CanDropCallback
Definition: cardregion.h:203
int nNumApparentCards
Definition: cardregion.h:181
CardWindow & parentWnd
Definition: cardregion.h:141
bool OnLButtonDown(int x, int y)
void UpdateFaceDir(CardStack &cards)
Definition: cardregion.cpp:409
void SetDblClickProc(pClickProc proc)
Definition: cardregion.cpp:192
HBITMAP hbmBackGnd
Definition: cardregion.h:177
pClickProc ClickReleaseCallback
Definition: cardregion.h:205
COLORREF crBackgnd
Definition: cardregion.h:189
void StopFlash()
Definition: cardregion.cpp:333
void NewDeck()
Definition: cardstack.cpp:42
Card Top()
Definition: cardstack.cpp:151
void Push(const Card card)
Definition: cardstack.cpp:83
void Clear()
Definition: cardstack.cpp:37
void Reverse()
Definition: cardstack.cpp:73
void Shuffle()
Definition: cardstack.cpp:50
Card Pop()
Definition: cardstack.cpp:127
Definition: card.h:28
r parent
Definition: btrfs.c:3010
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint GLuint num
Definition: glext.h:9618
#define cs
Definition: i386-dis.c:442
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static char * dest
Definition: rtl.c:135
unsigned int UINT
Definition: ndis.h:50
static TCHAR * items[]
Definition: page1.c:45
static HANDLE proc()
Definition: pdb.c:34
Definition: bug.cpp:8
Definition: dhcpd.h:245
Definition: pdh_main.c:94
DWORD COLORREF
Definition: windef.h:300