ReactOS  0.4.14-dev-98-gb0d4763
CardRegion Class Reference

#include <cardregion.h>

Collaboration diagram for CardRegion:

Public Member Functions

void SetBackColor (COLORREF cr)
 
void SetCardStack (const CardStack &cs)
 
const CardStackGetCardStack ()
 
bool SetDragRule (UINT uDragType, pCanDragProc proc=0)
 
bool SetDropRule (UINT uDropType, pCanDropProc proc=0)
 
void SetClickProc (pClickProc proc)
 
void SetClickReleaseProc (pClickProc proc)
 
void SetDblClickProc (pClickProc proc)
 
void SetAddCardProc (pAddProc proc)
 
void SetRemoveCardProc (pRemoveProc proc)
 
bool SetThreedCount (int count)
 
void SetOffsets (int x, int y)
 
void SetPos (int x, int y)
 
void Show (bool fShow)
 
bool IsVisible ()
 
void SetEmptyImage (UINT uImage)
 
void SetBackCardIdx (UINT uBackIdx)
 
void SetPlacement (UINT xJustify, UINT yJustify, int xAdjust, int yAdjust)
 
void Update ()
 
void Redraw ()
 
void SetFaceDirection (UINT uDirType, int nOption)
 
UINT GetFaceDirection (int *pnOption)
 
void Flash (int count, int timeout)
 
void StopFlash ()
 
int Id ()
 
CardWindowGetCardWindow ()
 
bool PlayCard (CardRegion *pDestStack, int value, int num)
 
bool MoveCard (CardRegion *pDestStack, int nNumCards, bool fAnimate)
 
bool SimulateDrag (CardRegion *pDestStack, int nNumCards, bool fAnimate)
 
bool Lock ()
 
bool UnLock ()
 
int NumCards () const
 
void NewDeck ()
 
void Shuffle ()
 
void Clear ()
 
void Reverse ()
 
void Push (const Card card)
 
void Push (const CardStack &cs)
 
Card Pop ()
 
CardStack Pop (int items)
 
Card Top ()
 
CardStack Top (int items)
 

Private Member Functions

 CardRegion (CardWindow &parent, int id, bool fVisible, int x, int y, int xOffset, int yOffset)
 
 ~CardRegion ()
 
void DoFlash ()
 
void RedrawIfNotDim (CardRegion *compare, bool fFullRedraw)
 
void UpdateFaceDir (CardStack &cards)
 
void Clip (HDC hdc)
 
void Render (HDC hdc)
 
int GetOverlapRatio (int x, int y, int width, int height)
 
void MoveDragCardTo (HDC hdc, int x, int y)
 
void ZoomCard (HDC hdc, int xpos, int ypos, CardRegion *dest)
 
void RenderBottomMost (HDC hdc, int minustopmost=0)
 
void PrepareDragBitmaps (int numtodrag)
 
void PrepareDragBitmapsThreed (int numtodrag)
 
void ReleaseDragBitmaps (void)
 
bool CanDragCards (int iNumCards)
 
bool CanDropCards (CardStack &cards)
 
void CalcApparentCards ()
 
int CalcApparentCards (int realnum)
 
void UpdateSize ()
 
void AdjustPosition (int winwidth, int winheight)
 
bool IsPointInStack (int x, int y)
 
int GetNumDragCards (int x, int y)
 
bool OnLButtonDown (int x, int y)
 
bool OnLButtonDblClk (int x, int y)
 
bool OnMouseMove (int x, int y)
 
bool OnLButtonUp (int x, int y)
 
void ClickRelease (int x, int y)
 

Private Attributes

int id
 
CardWindowparentWnd
 
CardStack cardstack
 
CardStack dragstack
 
bool fMouseDragging
 
int xpos
 
int ypos
 
int xoffset
 
int yoffset
 
int width
 
int height
 
int xjustify
 
int yjustify
 
int xadjust
 
int yadjust
 
int iNumDragCards
 
int mousexoffset
 
int mouseyoffset
 
int oldx
 
int oldy
 
int nDragCardWidth
 
int nDragCardHeight
 
HDC hdcBackGnd
 
HBITMAP hbmBackGnd
 
HDC hdcDragCard
 
HBITMAP hbmDragCard
 
int nNumApparentCards
 
int nThreedCount
 
bool fVisible
 
int nFlashCount
 
bool fFlashVisible
 
UINT uFlashTimer
 
COLORREF crBackgnd
 
UINT uEmptyImage
 
UINT uFaceDirType
 
int nFaceDirOption
 
int nBackCardIdx
 
UINT uDragRule
 
UINT uDropRule
 
pCanDragProc CanDragCallback
 
pCanDropProc CanDropCallback
 
pClickProc ClickCallback
 
pClickProc ClickReleaseCallback
 
pClickProc DblClickCallback
 
pAddProc AddCallback
 
pRemoveProc RemoveCallback
 
HANDLE mxlock
 

Friends

class CardWindow
 
class CardStack
 

Detailed Description

Definition at line 11 of file cardregion.h.

Constructor & Destructor Documentation

◆ CardRegion()

CardRegion::CardRegion ( CardWindow parent,
int  id,
bool  fVisible,
int  x,
int  y,
int  xOffset,
int  yOffset 
)
private

Definition at line 14 of file cardregion.cpp.

16 {
19 
20  crBackgnd = RGB(0, 64, 100);
21 
23  nFaceDirOption = 0;
25 
26  fVisible = visible;
27 
28  nThreedCount = 1;
29 
30  Update(); //Update this stack's size+card count
31 
32  hdcBackGnd = 0;
33  hbmBackGnd = 0;
34  hdcDragCard = 0;
35  hbmDragCard = 0;
36 
37  nDragCardWidth = 0;
38  nDragCardHeight = 0;
39 
40  CanDragCallback = 0;
41  CanDropCallback = 0;
42  AddCallback = 0;
43  RemoveCallback = 0;
44  ClickCallback = 0;
46  DblClickCallback = 0;
47 
50 
51  xjustify = yjustify = xadjust = yadjust = 0;
52 
53  nFlashCount = 0;
54  fFlashVisible = false;
55  uFlashTimer = (UINT)-1;
56 
57  fMouseDragging = false;
58 
59  mxlock = CreateMutex(0, FALSE, 0);
60 }
pAddProc AddCallback
Definition: cardregion.h:207
pClickProc DblClickCallback
Definition: cardregion.h:206
GLint GLint GLsizei width
Definition: gl.h:1546
HDC hdcDragCard
Definition: cardregion.h:178
int nThreedCount
Definition: cardregion.h:182
pRemoveProc RemoveCallback
Definition: cardregion.h:208
#define CS_EI_SUNK
Definition: cardlib.h:19
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
pClickProc ClickReleaseCallback
Definition: cardregion.h:205
HBITMAP hbmDragCard
Definition: cardregion.h:179
#define CS_FACE_UP
Definition: cardlib.h:51
pCanDropProc CanDropCallback
Definition: cardregion.h:203
bool fMouseDragging
Definition: cardregion.h:146
#define CS_DROP_ALL
Definition: cardlib.h:34
void Update()
Definition: cardregion.cpp:207
int xjustify
Definition: cardregion.h:159
HANDLE mxlock
Definition: cardregion.h:211
int nDragCardHeight
Definition: cardregion.h:174
UINT uFlashTimer
Definition: cardregion.h:187
HDC hdcBackGnd
Definition: cardregion.h:176
UINT uFaceDirType
Definition: cardregion.h:192
#define CreateMutex
Definition: winbase.h:3580
r parent
Definition: btrfs.c:2897
int yjustify
Definition: cardregion.h:160
#define CS_DRAG_ALL
Definition: cardlib.h:30
#define RGB(r, g, b)
Definition: wingdi.h:2935
UINT uDropRule
Definition: cardregion.h:197
pClickProc ClickCallback
Definition: cardregion.h:204
UINT uDragRule
Definition: cardregion.h:196
bool fFlashVisible
Definition: cardregion.h:186
COLORREF crBackgnd
Definition: cardregion.h:189
int nFaceDirOption
Definition: cardregion.h:193
int __cardwidth
Definition: cardlib.cpp:25
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
int nDragCardWidth
Definition: cardregion.h:173
int xOffset
Definition: appswitch.c:59
unsigned int UINT
Definition: ndis.h:50
int nFlashCount
Definition: cardregion.h:185
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
pCanDragProc CanDragCallback
Definition: cardregion.h:202
int __cardheight
Definition: cardlib.cpp:26
int yOffset
Definition: appswitch.c:59
CardWindow & parentWnd
Definition: cardregion.h:141
UINT uEmptyImage
Definition: cardregion.h:191
HBITMAP hbmBackGnd
Definition: cardregion.h:177
bool fVisible
Definition: cardregion.h:183

◆ ~CardRegion()

CardRegion::~CardRegion ( )
private

Definition at line 62 of file cardregion.cpp.

63 {
65 }
#define CloseHandle
Definition: compat.h:398
HANDLE mxlock
Definition: cardregion.h:211

Member Function Documentation

◆ AdjustPosition()

void CardRegion::AdjustPosition ( int  winwidth,
int  winheight 
)
private

Definition at line 281 of file cardregion.cpp.

282 {
283  Update(); //Update this stack's card count + size
284 
285  switch(xjustify)
286  {
287  default: case CS_XJUST_NONE: break;
288 
289  case CS_XJUST_CENTER: //centered
290  xpos = (winwidth - (width & ~0x1)) / 2;
291  xpos += xadjust;
292 
293  if(xoffset < 0) xpos += (width - __cardwidth);
294 
295  break;
296 
297  case CS_XJUST_RIGHT: //right-aligned
298  xpos = winwidth - __cardwidth;//width - 20;
299  xpos += xadjust;
300  break;
301  }
302 
303  switch(yjustify)
304  {
305  default: case CS_YJUST_NONE: break;
306 
307  case CS_YJUST_CENTER: //centered
308  ypos = (winheight - height) / 2;
309  ypos += yadjust;
310  if(yoffset < 0) ypos += (height - __cardheight);
311  break;
312 
313  case CS_YJUST_BOTTOM: //bottom-aligned
314  ypos = winheight - __cardheight;//height - 20;
315  ypos += yadjust;
316  break;
317  }
318 
319 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define CS_XJUST_RIGHT
Definition: cardlib.h:38
GLint GLint GLint yoffset
Definition: gl.h:1547
#define CS_XJUST_NONE
Definition: cardlib.h:37
void Update()
Definition: cardregion.cpp:207
GLint GLint xoffset
Definition: gl.h:1547
int xjustify
Definition: cardregion.h:159
#define CS_XJUST_CENTER
Definition: cardlib.h:39
int yjustify
Definition: cardregion.h:160
#define CS_YJUST_NONE
Definition: cardlib.h:41
int __cardwidth
Definition: cardlib.cpp:25
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define CS_YJUST_BOTTOM
Definition: cardlib.h:42
#define CS_YJUST_CENTER
Definition: cardlib.h:43
int __cardheight
Definition: cardlib.cpp:26

Referenced by CardWindow::Update(), and CardWindow::WndProc().

◆ CalcApparentCards() [1/2]

void CardRegion::CalcApparentCards ( )
private

Definition at line 77 of file cardregion.cpp.

78 {
80 }
CardStack cardstack
Definition: cardregion.h:143
int nNumApparentCards
Definition: cardregion.h:181
void CalcApparentCards()
Definition: cardregion.cpp:77
int NumCards() const
Definition: cardstack.h:14

Referenced by PrepareDragBitmapsThreed(), and Update().

◆ CalcApparentCards() [2/2]

int CardRegion::CalcApparentCards ( int  realnum)
private

Definition at line 72 of file cardregion.cpp.

73 {
74  return ((realnum + nThreedCount - 1) - (realnum + nThreedCount - 1) % nThreedCount) / nThreedCount;
75 }
int nThreedCount
Definition: cardregion.h:182

◆ CanDragCards()

bool CardRegion::CanDragCards ( int  iNumCards)
private

Definition at line 141 of file cardrgnmouse.cpp.

142 {
143  if(iNumCards <= 0) return false;
144  if(nThreedCount > 1 && iNumCards > 1) return false;
145 
147  {
148 // TRACE("Failed to gain access to card stack\n");
149  return false;
150  }
151 
153 
154  switch(uDragRule)
155  {
156  case CS_DRAG_ALL:
157  return true;
158 
159  case CS_DRAG_TOP:
160 
161  if(iNumCards == 1)
162  return true;
163  else
164  return false;
165 
166  case CS_DRAG_NONE:
167  return false;
168 
169  case CS_DRAG_CALLBACK:
170 
171  if(CanDragCallback)
172  {
173  return CanDragCallback(*this, iNumCards);
174  }
175  else
176  {
177  return false;
178  }
179 
180  default:
181  return false;
182  }
183 }
int nThreedCount
Definition: cardregion.h:182
#define CS_DRAG_NONE
Definition: cardlib.h:28
#define CS_DRAG_CALLBACK
Definition: cardlib.h:31
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE mxlock
Definition: cardregion.h:211
#define WAIT_OBJECT_0
Definition: winbase.h:387
#define CS_DRAG_TOP
Definition: cardlib.h:29
#define CS_DRAG_ALL
Definition: cardlib.h:30
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
UINT uDragRule
Definition: cardregion.h:196
pCanDragProc CanDragCallback
Definition: cardregion.h:202

Referenced by OnLButtonDown(), and SimulateDrag().

◆ CanDropCards()

bool CardRegion::CanDropCards ( CardStack cards)
private

Definition at line 185 of file cardrgnmouse.cpp.

186 {
188  {
189  return false;
190  }
191 
193 
194  switch(uDropRule)
195  {
196  case CS_DROP_ALL:
197  return true;
198 
199  case CS_DROP_NONE:
200  return false;
201 
202  case CS_DROP_CALLBACK:
203 
204  if(CanDropCallback)
205  {
206  return CanDropCallback(*this, cards);
207  }
208  else
209  {
210  return false;
211  }
212 
213  default:
214  return false;
215  }
216 }
pCanDropProc CanDropCallback
Definition: cardregion.h:203
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define CS_DROP_ALL
Definition: cardlib.h:34
HANDLE mxlock
Definition: cardregion.h:211
#define WAIT_OBJECT_0
Definition: winbase.h:387
#define CS_DROP_NONE
Definition: cardlib.h:33
UINT uDropRule
Definition: cardregion.h:197
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
#define CS_DROP_CALLBACK
Definition: cardlib.h:35

Referenced by OnLButtonUp(), and SimulateDrag().

◆ Clear()

void CardRegion::Clear ( )
inline

Definition at line 84 of file cardregion.h.

84 { cardstack.Clear(); }
CardStack cardstack
Definition: cardregion.h:143
void Clear()
Definition: cardstack.cpp:37

Referenced by CardWindow::EmptyStacks().

◆ ClickRelease()

void CardRegion::ClickRelease ( int  x,
int  y 
)
private

Definition at line 279 of file cardrgnmouse.cpp.

280 {
282 
285 }
int GetNumDragCards(int x, int y)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
pClickProc ClickReleaseCallback
Definition: cardregion.h:205
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int iNumDragCards
Definition: cardregion.h:167

Referenced by CardWindow::WndProc().

◆ Clip()

void CardRegion::Clip ( HDC  hdc)
private

Definition at line 208 of file cardrgndraw.cpp.

209 {
210  int numtoclip;
211 
212  if(fVisible == false)
213  return;
214 
215  Update(); //Update this stack's size+card count
216  numtoclip = nNumApparentCards;
217 
218  //if we are making this stack flash on/off, then only
219  //clip the stack for drawing if the flash is in its ON state
220  if(nFlashCount != 0)
221  {
222  if(fFlashVisible == FALSE)
223  numtoclip = 0;
224  }
225 
226  //if offset along a diagonal
227  if(xoffset != 0 && yoffset != 0 && cardstack.NumCards() != 0)
228  {
229  for(int j = 0; j < numtoclip; j ++)
230  {
232  }
233  }
234  //otherwise if just offset along a horizontal/vertical axis
235  else
236  {
238  {
239  ClipCard(hdc, xpos, ypos-((numtoclip-1)*-yoffset), width, height);
240  }
241  else if(xoffset < 0 && numtoclip > 0)
242  {
243  ClipCard(hdc, xpos-((numtoclip-1)*-xoffset), ypos, width, height);
244  }
245  else
246  {
248  }
249  }
250 
251 }
GLint GLint GLsizei width
Definition: gl.h:1546
CardStack cardstack
Definition: cardregion.h:143
int nNumApparentCards
Definition: cardregion.h:181
GLint GLint GLint yoffset
Definition: gl.h:1547
void Update()
Definition: cardregion.cpp:207
GLint GLint xoffset
Definition: gl.h:1547
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
HDC hdc
Definition: main.c:9
bool fFlashVisible
Definition: cardregion.h:186
int __cardwidth
Definition: cardlib.cpp:25
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
int nFlashCount
Definition: cardregion.h:185
int ClipCard(HDC hdc, int x, int y, int width, int height)
int __cardheight
Definition: cardlib.cpp:26
int NumCards() const
Definition: cardstack.h:14
bool fVisible
Definition: cardregion.h:183

Referenced by CardWindow::Paint().

◆ DoFlash()

void CardRegion::DoFlash ( )
private

Definition at line 344 of file cardregion.cpp.

345 {
346  if(uFlashTimer != (UINT)-1)
347  {
349 
350  if(--nFlashCount == 0)
351  {
353  uFlashTimer = (UINT)-1;
354  fFlashVisible = true;
355  }
356 
357  parentWnd.Redraw();
358  }
359 }
void Redraw(void)
Definition: cardwindow.cpp:553
UINT uFlashTimer
Definition: cardregion.h:187
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
bool fFlashVisible
Definition: cardregion.h:186
unsigned int UINT
Definition: ndis.h:50
int nFlashCount
Definition: cardregion.h:185
CardWindow & parentWnd
Definition: cardregion.h:141

Referenced by CardWindow::WndProc().

◆ Flash()

void CardRegion::Flash ( int  count,
int  timeout 
)

Definition at line 322 of file cardregion.cpp.

323 {
324  if(count <= 0) return;
325 
326  nFlashCount = count;
327  fFlashVisible = false;
328  uFlashTimer = SetTimer((HWND)parentWnd, (WPARAM)this, milliseconds, 0);
329 
330  parentWnd.Redraw();
331 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
UINT_PTR WPARAM
Definition: windef.h:207
void Redraw(void)
Definition: cardwindow.cpp:553
UINT uFlashTimer
Definition: cardregion.h:187
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
bool fFlashVisible
Definition: cardregion.h:186
int nFlashCount
Definition: cardregion.h:185
CardWindow & parentWnd
Definition: cardregion.h:141

Referenced by SuitStackAddProc().

◆ GetCardStack()

const CardStack & CardRegion::GetCardStack ( )

Definition at line 399 of file cardregion.cpp.

400 {
401  //return reference to our internal stack
402  return cardstack;
403 }
CardStack cardstack
Definition: cardregion.h:143

Referenced by CanDrop(), DeckClickProc(), MoveCard(), OnLButtonUp(), RowStackDblClickProc(), RowStackDropProc(), StackDragProc(), and StackDropProc().

◆ GetCardWindow()

CardWindow& CardRegion::GetCardWindow ( )
inline

Definition at line 69 of file cardregion.h.

69 { return parentWnd; }
CardWindow & parentWnd
Definition: cardregion.h:141

◆ GetFaceDirection()

UINT CardRegion::GetFaceDirection ( int pnOption)

Definition at line 273 of file cardregion.cpp.

274 {
275  if(pnOption)
276  *pnOption = nFaceDirOption;
277 
278  return uFaceDirType;
279 }
UINT uFaceDirType
Definition: cardregion.h:192
int nFaceDirOption
Definition: cardregion.h:193

Referenced by DeckClickProc(), RowStackClickProc(), RowStackDragProc(), StackDragProc(), StackDropProc(), and TurnStackCard().

◆ GetNumDragCards()

int CardRegion::GetNumDragCards ( int  x,
int  y 
)
private

Definition at line 76 of file cardrgnmouse.cpp.

77 {
78  int cardindex = 0; //index from stack start
79  int maxidx;
80 
81  //make x,y relative to the stack's upper left corner
82  x -= xpos + (xoffset < 0 ? (nNumApparentCards/*cardstack.NumCards()*/ - 1) * xoffset : 0);
83  y -= ypos + (yoffset < 0 ? (nNumApparentCards/*cardstack.NumCards()*/ - 1) * yoffset : 0);
84 
85  //if stack is empty, cannot drag any cards from it
86  if(cardstack.NumCards() <= 0)
87  return 0;
88 
89  //see which card in the stack has been clicked on
90  //top-bottom ordering
91  if(yoffset > 0)
92  {
93  if(y < height - __cardheight)
94  cardindex = y / yoffset;
95  else
96  cardindex = cardstack.NumCards() - 1;
97  }
98  else if(yoffset < 0)
99  {
100  if(y < __cardheight)
101  cardindex = cardstack.NumCards() - 1;
102  else
103  cardindex = cardstack.NumCards() - ((y - __cardheight) / -yoffset) - 2;
104  }
105  else //yoffset == 0
106  {
107  cardindex = cardstack.NumCards() - 1;
108  }
109 
110  maxidx = cardindex;
111 
112  //if left-right
113  if(xoffset > 0)
114  {
115  if(x < width - __cardwidth)
116  cardindex = x / xoffset;
117  else
118  cardindex = cardstack.NumCards() - 1;
119  }
120  else if(xoffset < 0)
121  {
122  if(x < __cardwidth)
123  cardindex = cardstack.NumCards() - 1;
124  else
125  cardindex = cardstack.NumCards() - ((x - __cardwidth) / -xoffset) - 2;
126  }
127  else
128  {
129  cardindex = cardstack.NumCards() - 1;
130  }
131 
132  if(cardindex > maxidx) cardindex = maxidx;
133 
134  if(cardindex > cardstack.NumCards())
135  cardindex = 1;
136 
137  //if are trying to drag too many cards at once
138  return cardstack.NumCards() - cardindex;
139 }
GLint GLint GLsizei width
Definition: gl.h:1546
CardStack cardstack
Definition: cardregion.h:143
int nNumApparentCards
Definition: cardregion.h:181
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint yoffset
Definition: gl.h:1547
GLint GLint xoffset
Definition: gl.h:1547
int __cardwidth
Definition: cardlib.cpp:25
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int __cardheight
Definition: cardlib.cpp:26
int NumCards() const
Definition: cardstack.h:14

Referenced by ClickRelease(), OnLButtonDblClk(), and OnLButtonDown().

◆ GetOverlapRatio()

int CardRegion::GetOverlapRatio ( int  x,
int  y,
int  width,
int  height 
)
private

Definition at line 120 of file cardregion.cpp.

121 {
122  RECT me, him;
123  RECT inter;
124  SetRect(&him, x, y, x+w, y+h);
125  SetRect(&me, xpos, ypos, xpos+width, ypos+height);
126 
127  //see if the specified rectangle overlaps us
128  if(IntersectRect(&inter, &me, &him))
129  {
130  int wi = inter.right - inter.left;
131  int hi = inter.bottom - inter.top;
132 
133  int overlap = wi * hi;
134  int total = width * height;
135 
136  int percent = (overlap << 16) / total;
137  return (percent * 100) >> 16;
138  }
139  //do not overlap
140  else
141  {
142  return 0;
143  }
144 }
GLint GLint GLsizei width
Definition: gl.h:1546
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
LONG top
Definition: windef.h:292
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:294

Referenced by CardWindow::GetBestStack().

◆ Id()

int CardRegion::Id ( )

Definition at line 361 of file cardregion.cpp.

362 {
363  return id;
364 }

Referenced by PileClickProc(), RowStackClickProc(), StackDropProc(), and SuitStackClickProc().

◆ IsPointInStack()

bool CardRegion::IsPointInStack ( int  x,
int  y 
)
private

Definition at line 65 of file cardrgnmouse.cpp.

66 {
67  int axpos = xoffset < 0 ? xpos + (nNumApparentCards-1)*xoffset : xpos;
68  int aypos = yoffset < 0 ? ypos + (nNumApparentCards-1)*yoffset : ypos;
69 
70  if(x >= axpos && x < axpos + width && y >= aypos && y < aypos + height && fVisible)
71  return true;
72  else
73  return false;
74 }
int nNumApparentCards
Definition: cardregion.h:181
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint yoffset
Definition: gl.h:1547
GLint GLint xoffset
Definition: gl.h:1547
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
bool fVisible
Definition: cardregion.h:183

Referenced by CardWindow::CardRegionFromPoint().

◆ IsVisible()

bool CardRegion::IsVisible ( )

Definition at line 245 of file cardregion.cpp.

246 {
247  return fVisible;
248 }
bool fVisible
Definition: cardregion.h:183

Referenced by CardWindow::DistributeStacks().

◆ Lock()

bool CardRegion::Lock ( void  )

Definition at line 552 of file cardregion.cpp.

553 {
555 
556  if(dw == WAIT_OBJECT_0)
557  {
558  //TRACE("LockStack succeeded\n");
559  return true;
560  }
561  else
562  {
563  //TRACE("LockStack failed\n");
564  return false;
565  }
566  return false;
567 }
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE mxlock
Definition: cardregion.h:211
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID DWORD dw
Definition: atlbase.h:40

◆ MoveCard()

bool CardRegion::MoveCard ( CardRegion pDestStack,
int  nNumCards,
bool  fAnimate 
)

Definition at line 477 of file cardregion.cpp.

478 {
479  HDC hdc;
480 
481  int x, y;
482 
483  if(pDestStack == 0) return false; //{ forcedfacedir = -1 ;return 0; }
484 
485  if(nNumCards < 0 || nNumCards > cardstack.NumCards())
486  return false;
487 
488  x = xpos + xoffset * (nNumApparentCards - nNumCards);
489  y = ypos + yoffset * (nNumApparentCards - nNumCards);
490 
491  oldx = x;
492  oldy = y;
493 
494  dragstack = cardstack.Pop(nNumCards);
495 
496  //Alter the drag-stack so that it's cards are the same way up
497  //as the destination. Use the destination's drag-rules
498  //instead of this ones!!
499  CardStack temp;
500  temp.Push(pDestStack->GetCardStack());
501  temp.Push(dragstack);
502 
503  pDestStack->UpdateFaceDir(temp);
504 
505  dragstack = temp.Pop(nNumCards);
506 
507  if(fAnimate)
508  {
509  iNumDragCards = nNumCards;
510  PrepareDragBitmaps(nNumCards);
511  }
512 
513  Update(); //Update this stack's size+card count
514 
515  if(fAnimate)
516  {
517  hdc = GetDC((HWND)parentWnd);
518 
519  ZoomCard(hdc, x, y, pDestStack);
520 
523  }
524 
525  // Get a copy of the cardstack
526  CardStack cs = pDestStack->GetCardStack();
527  cs.Push(dragstack);
528 
529  pDestStack->SetCardStack(cs);
530 
531  //cs = pDestStack->GetCardStack();
532  //pDestStack->Update();
533  //pDestStack->UpdateFaceDir(cs);
534 
535  RedrawIfNotDim(pDestStack, false);
536 
537  //forcedfacedir = -1;
538  return true;
539 }
CardStack cardstack
Definition: cardregion.h:143
int nNumApparentCards
Definition: cardregion.h:181
HDC WINAPI GetDC(_In_opt_ HWND)
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
static HDC
Definition: imagelist.c:92
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint yoffset
Definition: gl.h:1547
uint32_t cs
Definition: isohybrid.c:75
void UpdateFaceDir(CardStack &cards)
Definition: cardregion.cpp:409
void Update()
Definition: cardregion.cpp:207
GLint GLint xoffset
Definition: gl.h:1547
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
CardStack dragstack
Definition: cardregion.h:144
Card Pop()
Definition: cardstack.cpp:127
void ZoomCard(HDC hdc, int xpos, int ypos, CardRegion *dest)
void RedrawIfNotDim(CardRegion *compare, bool fFullRedraw)
Definition: cardregion.cpp:611
HDC hdc
Definition: main.c:9
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
void ReleaseDragBitmaps(void)
static calc_node_t temp
Definition: rpn_ieee.c:38
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
CardWindow & parentWnd
Definition: cardregion.h:141
int NumCards() const
Definition: cardstack.h:14
void PrepareDragBitmaps(int numtodrag)
int iNumDragCards
Definition: cardregion.h:167

Referenced by PlayCard(), and SimulateDrag().

◆ MoveDragCardTo()

void CardRegion::MoveDragCardTo ( HDC  hdc,
int  x,
int  y 
)
private

Definition at line 424 of file cardrgnmouse.cpp.

425 {
426  RECT inter, rect1, rect2;
427 
428  //mask off the new position of the drag-card, so
429  //that it will not be painted over
431 
432  //restore the area covered by the card at its previous position
434 
435  //remove clipping so we can draw the card at its new place
437 
438  //if the card's old and new positions overlap, then we
439  //need some funky code to update the "saved background" image,
442 
443  if(IntersectRect(&inter, &rect1, &rect2))
444  {
445  int interwidth = inter.right-inter.left;
446  int interheight = inter.bottom-inter.top;
447  int destx, desty, srcx, srcy;
448 
449  if(rect2.left > rect1.left)
450  {
451  destx = 0; srcx = nDragCardWidth - interwidth;
452  }
453  else
454  {
455  destx = nDragCardWidth - interwidth; srcx = 0;
456  }
457 
458  if(rect2.top > rect1.top)
459  {
460  desty = 0; srcy = nDragCardHeight - interheight;
461  }
462  else
463  {
464  desty = nDragCardHeight - interheight; srcy = 0;
465  }
466 
467  //shift the bit we didn't use for the restore (due to the clipping)
468  //into the opposite corner
469  BitBlt(hdcBackGnd, destx,desty, interwidth, interheight, hdcBackGnd, srcx, srcy, SRCCOPY);
470 
471  ExcludeClipRect(hdcBackGnd, destx, desty, destx+interwidth, desty+interheight);
472 
473  //this bit requires us to clip the BitBlt (from screen to background)
474  //as BitBlt is a bit buggy it seems
477  }
478  else
479  {
481  }
482 
483  //finally draw the card to the screen
485 }
RECT rect2
Definition: edittest.c:51
HDC hdcDragCard
Definition: cardregion.h:178
int ClipCard(HDC hdc, int x, int y, int width, int height)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
LONG top
Definition: windef.h:292
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void DrawCard(HDC hdc, int x, int y, HDC hdcSource, int width, int height)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int nDragCardHeight
Definition: cardregion.h:174
smooth NULL
Definition: ftsmooth.c:416
HDC hdcBackGnd
Definition: cardregion.h:176
HDC hdc
Definition: main.c:9
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
int nDragCardWidth
Definition: cardregion.h:173
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL ClippedBitBlt(HDC hdcDest, int x, int y, int width, int height, HDC hdcSrc, int srcx, int srcy, DWORD dwROP)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:294
#define SRCCOPY
Definition: wingdi.h:332

Referenced by OnMouseMove(), and ZoomCard().

◆ NewDeck()

void CardRegion::NewDeck ( )
inline

Definition at line 82 of file cardregion.h.

82 { cardstack.NewDeck(); }
CardStack cardstack
Definition: cardregion.h:143
void NewDeck()
Definition: cardstack.cpp:42

◆ NumCards()

int CardRegion::NumCards ( ) const

Definition at line 544 of file cardregion.cpp.

545 {
546  if(fMouseDragging)
547  return cardstack.NumCards() + dragstack.NumCards();
548  else
549  return cardstack.NumCards();
550 }
CardStack cardstack
Definition: cardregion.h:143
bool fMouseDragging
Definition: cardregion.h:146
CardStack dragstack
Definition: cardregion.h:144
int NumCards() const
Definition: cardstack.h:14

Referenced by PileRemoveProc(), RowStackClickProc(), RowStackDragProc(), RowStackDropProc(), StackDragProc(), StackDropProc(), and TurnStackCard().

◆ OnLButtonDblClk()

bool CardRegion::OnLButtonDblClk ( int  x,
int  y 
)
private

Definition at line 218 of file cardrgnmouse.cpp.

219 {
221 
222  if(DblClickCallback)
224 
225  return true;
226 }
pClickProc DblClickCallback
Definition: cardregion.h:206
int GetNumDragCards(int x, int y)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int iNumDragCards
Definition: cardregion.h:167

Referenced by CardWindow::WndProc().

◆ OnLButtonDown()

bool CardRegion::OnLButtonDown ( int  x,
int  y 
)
private

Definition at line 228 of file cardrgnmouse.cpp.

229 {
231 
232 #ifdef _DEBUG
233  if(DebugStackClickProc)
234  {
235  if(!DebugStackClickProc(*this))
236  return false;
237  }
238 #endif
239 
240  if(ClickCallback)
242 
243  if(CanDragCards(iNumDragCards) != false)
244  {
245 
246  //offset of the mouse cursor relative to the top-left corner
247  //of the cards that are being dragged
250 
251  if(xoffset < 0)
252  mousexoffset += -xoffset * (iNumDragCards - 1);
253 
254  if(yoffset < 0)
255  mouseyoffset += -yoffset * (iNumDragCards - 1);
256 
257  //remove the cards from the source stack
259 
260  //prepare the back buffer, and the drag image
262 
263  oldx = x - mousexoffset;
264  oldy = y - mouseyoffset;
265 
266  Update(); //Update this stack's card count + size
267 
269 
270  //set AFTER settings the dragstack...
271  fMouseDragging = true;
272 
273  return true;
274  }
275 
276  return false;
277 }
CardStack cardstack
Definition: cardregion.h:143
int nNumApparentCards
Definition: cardregion.h:181
int GetNumDragCards(int x, int y)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint yoffset
Definition: gl.h:1547
bool fMouseDragging
Definition: cardregion.h:146
void Update()
Definition: cardregion.cpp:207
GLint GLint xoffset
Definition: gl.h:1547
CardStack dragstack
Definition: cardregion.h:144
Card Pop()
Definition: cardstack.cpp:127
int mousexoffset
Definition: cardregion.h:168
pClickProc ClickCallback
Definition: cardregion.h:204
int mouseyoffset
Definition: cardregion.h:169
HWND WINAPI SetCapture(_In_ HWND hWnd)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
CardWindow & parentWnd
Definition: cardregion.h:141
void PrepareDragBitmaps(int numtodrag)
int iNumDragCards
Definition: cardregion.h:167
bool CanDragCards(int iNumCards)

Referenced by CardWindow::WndProc().

◆ OnLButtonUp()

bool CardRegion::OnLButtonUp ( int  x,
int  y 
)
private

Definition at line 287 of file cardrgnmouse.cpp.

288 {
289  CardRegion *pDestStack = 0;
290  HDC hdc;
291  int dropstackid = CS_DROPZONE_NODROP;
292 
293  RECT dragrect;
294  DropZone *dropzone;
295 
296  fMouseDragging = false;
297 
298  //first of all, see if any drop zones have been registered
300 
301  dropzone = parentWnd.GetDropZoneFromRect(&dragrect);
302 
303  if(dropzone)
304  {
305  dropstackid = dropzone->DropCards(dragstack);
306 
307  if(dropstackid != CS_DROPZONE_NODROP)
308  pDestStack = parentWnd.CardRegionFromId(dropstackid);
309  else
310  pDestStack = 0;
311  }
312  else
313  {
315  }
316 
317  // If have found a stack to drop onto
318  //
319  TRACE ( "can I drop card?\n" );
320  if(pDestStack && pDestStack->CanDropCards(dragstack))
321  {
322  TRACE ( "yes, dropping card\n" );
323  hdc = GetDC((HWND)parentWnd);
324  // UseNicePalette(hdc);
325  ZoomCard(hdc, x - mousexoffset, y - mouseyoffset, pDestStack);
327 
328  //
329  //add the cards to the destination stack
330  //
331  CardStack temp = pDestStack->GetCardStack();
332  temp.Push(dragstack);
333 
334  pDestStack->SetCardStack(temp);
335 // pDestStack->Update(); //Update this stack's card count + size
336 // pDestStack->UpdateFaceDir(temp);
337 
338  // Call the remove callback on THIS stack, if one is specified
339  //
340  if(RemoveCallback)
342 
343  // Call the add callback, if one is specified
344  //
345  if(pDestStack->AddCallback)
346  pDestStack->AddCallback(*pDestStack, pDestStack->cardstack);//index, deststack->numcards);
347 
348  RedrawIfNotDim(pDestStack, true);
349  TRACE ( "done dropping card\n" );
350  }
351 
352  //
353  // Otherwise, let the cards snap back onto this stack
354  //
355  else
356  {
357  TRACE ( "no, putting card back\n" );
358  hdc = GetDC((HWND)parentWnd);
359  TRACE ( "calling ZoomCard()\n" );
360  ZoomCard(hdc, x - mousexoffset, y - mouseyoffset, this);
361  TRACE ( "cardstack += dragstack\n" );
362  cardstack += dragstack;
363  TRACE ( "calling ReleaseDC()\n" );
365 
366  TRACE ( "calling Update()\n" );
367  Update(); //Update this stack's card count + size
368  TRACE ( "done putting card back\n" );
369  }
370 
372  ReleaseCapture();
373 
374  TRACE ( "OnLButtonUp() done\n" );
375  return true;
376 }
pAddProc AddCallback
Definition: cardregion.h:207
CardStack cardstack
Definition: cardregion.h:143
CardRegion * CardRegionFromId(int id)
Definition: cardwindow.cpp:531
pRemoveProc RemoveCallback
Definition: cardregion.h:208
#define CS_DROPZONE_NODROP
Definition: cardlib.h:57
HDC WINAPI GetDC(_In_opt_ HWND)
const CardStack & GetCardStack()
Definition: cardregion.cpp:399
DropZone * GetDropZoneFromRect(RECT *rect)
Definition: dropzone.cpp:22
static HDC
Definition: imagelist.c:92
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define TRACE(s)
bool fMouseDragging
Definition: cardregion.h:146
void Update()
Definition: cardregion.cpp:207
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int nDragCardHeight
Definition: cardregion.h:174
CardStack dragstack
Definition: cardregion.h:144
void ZoomCard(HDC hdc, int xpos, int ypos, CardRegion *dest)
bool CanDropCards(CardStack &cards)
int mousexoffset
Definition: cardregion.h:168
void RedrawIfNotDim(CardRegion *compare, bool fFullRedraw)
Definition: cardregion.cpp:611
HDC hdc
Definition: main.c:9
CardRegion * GetBestStack(int x, int y, int w, int h)
void SetCardStack(const CardStack &cs)
Definition: cardregion.cpp:390
int mouseyoffset
Definition: cardregion.h:169
void ReleaseDragBitmaps(void)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
int nDragCardWidth
Definition: cardregion.h:173
int DropCards(CardStack &cardstack)
Definition: dropzone.h:24
static calc_node_t temp
Definition: rpn_ieee.c:38
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
CardWindow & parentWnd
Definition: cardregion.h:141
int iNumDragCards
Definition: cardregion.h:167

Referenced by CardWindow::WndProc().

◆ OnMouseMove()

bool CardRegion::OnMouseMove ( int  x,
int  y 
)
private

Definition at line 378 of file cardrgnmouse.cpp.

379 {
380  HDC hdc;
381 
382  hdc = GetDC((HWND)parentWnd);
383 
384  x -= mousexoffset;
385  y -= mouseyoffset;
386 
387  MoveDragCardTo(hdc, x, y);
388 
389  //BitBlt(hdc, nDragCardWidth+10, 0, nDragCardWidth, nDragCardHeight, hdcBackGnd, 0, 0, SRCCOPY);
390  //BitBlt(hdc, 0, 0, nDragCardWidth, nDragCardHeight, hdcDragCard, 0, 0, SRCCOPY);
391 
393 
394  oldx = x;
395  oldy = y;
396 
397  return true;
398 }
void MoveDragCardTo(HDC hdc, int x, int y)
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int mousexoffset
Definition: cardregion.h:168
HDC hdc
Definition: main.c:9
int mouseyoffset
Definition: cardregion.h:169
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
CardWindow & parentWnd
Definition: cardregion.h:141

Referenced by CardWindow::WndProc().

◆ PlayCard()

bool CardRegion::PlayCard ( CardRegion pDestStack,
int  value,
int  num 
)

Definition at line 583 of file cardregion.cpp.

584 {
585  //search the stack for the specified card value...
586  while(num--)
587  {
588  for(int i = 0; i < cardstack.NumCards(); i++)
589  {
590  if(cardstack[i].HiVal() == value)
591  {
592  //swap the card with one at top pos...
593  Card card = cardstack.RemoveCard(i);
594  cardstack.Push(card);
595 
596  Redraw();
597 
598  MoveCard(pDestStack, 1, true);
599  break;
600  }
601  }
602  }
603 
604  return true;
605 }
CardStack cardstack
Definition: cardregion.h:143
bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:477
void Push(const Card card)
Definition: cardstack.cpp:83
Card RemoveCard(size_t index)
Definition: cardstack.cpp:172
void Redraw()
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLuint GLuint num
Definition: glext.h:9618
GLsizei const GLfloat * value
Definition: glext.h:6069
Definition: card.h:27
int NumCards() const
Definition: cardstack.h:14

◆ Pop() [1/2]

Card CardRegion::Pop ( )
inline

Definition at line 91 of file cardregion.h.

91 { return cardstack.Pop(); }
CardStack cardstack
Definition: cardregion.h:143
Card Pop()
Definition: cardstack.cpp:127

◆ Pop() [2/2]

CardStack CardRegion::Pop ( int  items)
inline

Definition at line 92 of file cardregion.h.

92 { return cardstack.Pop(items); }
CardStack cardstack
Definition: cardregion.h:143
Card Pop()
Definition: cardstack.cpp:127
static TCHAR * items[]
Definition: page1.c:45

◆ PrepareDragBitmaps()

void CardRegion::PrepareDragBitmaps ( int  numtodrag)
private

Definition at line 379 of file cardrgndraw.cpp.

380 {
381  RECT rect;
382  HDC hdc;
383  int icard;
384  int numcards = cardstack.NumCards();
385  int xoff, yoff;
386 
387  if(nThreedCount > 1)
388  {
389  PrepareDragBitmapsThreed(numtodrag);
390  return;
391  }
392 
393  //work out how big the bitmaps need to be
394  nDragCardWidth = (numtodrag - 1) * abs(xoffset) + __cardwidth;
395  nDragCardHeight = (numtodrag - 1) * abs(yoffset) + __cardheight;
396 
397  //Create bitmap for the back-buffer
398  hdc = GetDC(NULL);
402 
403  //Create bitmap for the drag-image
407  ReleaseDC(NULL, hdc);
408 
411 
412  int realvisible = numcards / nThreedCount;
413 
414  //if(numcards > 0 && realvisible == 0) realvisible = 1;
415  int iwhichcard = numcards - 1;
416  if(nThreedCount == 1) iwhichcard = 0;
417 
418  //grab the first bit of background so we can prep the back buffer; do this by
419  //rendering the card stack (minus the card we are dragging) to the temporary
420  //background buffer, so it appears if we have lifted the card from the stack
421  //PaintRect(hdcBackGnd, &rect, crBackgnd);
423 
424  xoff = calc_offset(xoffset, numcards, numtodrag, realvisible);
425  yoff = calc_offset(yoffset, numcards, numtodrag, realvisible);
426 
428 
429  //
430  // Render the cardstack into the back-buffer. The stack
431  // has already had the dragcards removed, so just draw
432  // what is left
433  //
434  for(icard = 0; icard < realvisible; icard++)
435  {
436  Card card = cardstack.cardlist[iwhichcard];
437  int nCardVal;
438 
439  nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;
440 
441  xoff = xoffset * icard + calc_offset(xoffset, numcards, numtodrag, realvisible);//- xoffset * ((numcards+numtodrag) / nThreedCount - numtodrag);
442  yoff = yoffset * icard + calc_offset(yoffset, numcards, numtodrag, realvisible);//- yoffset * ((numcards+numtodrag) / nThreedCount - numtodrag);
443 
444  CardBlt(hdcBackGnd, xoff, yoff, nCardVal);
445  iwhichcard++;
446  }
447 
448  //
449  // If there are no cards under this one, just draw the place holder
450  //
451  if(numcards == 0)
452  {
453  int xoff = 0, yoff = 0;
454 
455  if(xoffset < 0) xoff = nDragCardWidth - __cardwidth;
456  if(yoffset < 0) yoff = nDragCardHeight - __cardheight;
457 
458  switch(uEmptyImage)
459  {
460  case CS_EI_NONE:
461  //No need to draw anything: We already cleared the
462  //back-buffer before the main loop..
463 
464  //SetRect(&rc, xoff, yoff, xoff+ __cardwidth, yoff + __cardheight);
465  //PaintRect(hdcBackGnd, &rc, MAKE_PALETTERGB(crBackgnd));
466  //parentWnd.PaintCardRgn(hdcBackGnd, xoff, yoff, __cardwidth, __cardheight, xpos, ypos);// + xoff, ypos + yoff);
467  break;
468 
469  case CS_EI_SUNK:
471  break;
472 
473  case CS_EI_CIRC:
474  case CS_EI_X:
475  CardBlt(hdc, xoff, yoff, uEmptyImage);
476  break;
477  }
478  }
479 
480  //
481  // now render the drag-cards into the dragcard image
482  //
484 
485  for(icard = 0; icard < numtodrag; icard++)
486  {
487  int nCardVal;
488 
489  if(xoffset >= 0) xoff = xoffset * icard;
490  else xoff = -xoffset * (numtodrag - icard - 1);
491 
492  if(yoffset >= 0) yoff = yoffset * icard;
493  else yoff = -yoffset * (numtodrag - icard - 1);
494 
495  Card card = dragstack.cardlist[icard];
496 
497  nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;
498 
499  CardBlt(hdcDragCard, xoff, yoff, nCardVal);
500  }
501 }
#define abs(i)
Definition: fconv.c:206
bool FaceUp() const
Definition: card.h:74
HDC hdcDragCard
Definition: cardregion.h:178
CardStack cardstack
Definition: cardregion.h:143
int nThreedCount
Definition: cardregion.h:182
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
void PaintRect(HDC hdc, RECT *rect, COLORREF colour)
Definition: cardlib.cpp:116
Card cardlist[MAX_CARDSTACK_SIZE]
Definition: cardstack.h:47
HPALETTE UseNicePalette(HDC hdc, HPALETTE hPalette)
Definition: cardwindow.cpp:14
static HDC
Definition: imagelist.c:92
void PrepareDragBitmapsThreed(int numtodrag)
#define CS_EI_SUNK
Definition: cardlib.h:19
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HDC __hdcPlaceHolder
Definition: cardlib.cpp:21
GLint GLint GLint yoffset
Definition: gl.h:1547
HBITMAP hbmDragCard
Definition: cardregion.h:179
& rect
Definition: startmenu.cpp:1413
#define CS_EI_NONE
Definition: cardlib.h:18
void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy)
Definition: cardwindow.cpp:743
#define CS_EI_CIRC
Definition: cardlib.h:20
GLint GLint xoffset
Definition: gl.h:1547
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int nDragCardHeight
Definition: cardregion.h:174
smooth NULL
Definition: ftsmooth.c:416
HDC hdcBackGnd
Definition: cardregion.h:176
int Idx() const
Definition: card.h:69
CardStack dragstack
Definition: cardregion.h:144
#define CS_EI_X
Definition: cardlib.h:21
HPALETTE __hPalette
Definition: cardlib.cpp:28
int nBackCardIdx
Definition: cardregion.h:194
HDC hdc
Definition: main.c:9
COLORREF crBackgnd
Definition: cardregion.h:189
int __cardwidth
Definition: cardlib.cpp:25
void CardBlt(HDC hdc, int x, int y, int nCardNum)
Definition: cardrgndraw.cpp:22
Definition: card.h:27
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
int nDragCardWidth
Definition: cardregion.h:173
int __cardheight
Definition: cardlib.cpp:26
void DrawCard(HDC hdc, int x, int y, HDC hdcSource, int width, int height)
CardWindow & parentWnd
Definition: cardregion.h:141
UINT uEmptyImage
Definition: cardregion.h:191
int NumCards() const
Definition: cardstack.h:14
HBITMAP hbmBackGnd
Definition: cardregion.h:177
int calc_offset(int offset, int numcards, int numtodrag, int realvisible)

Referenced by MoveCard(), and OnLButtonDown().

◆ PrepareDragBitmapsThreed()

void CardRegion::PrepareDragBitmapsThreed ( int  numtodrag)
private

Definition at line 503 of file cardrgndraw.cpp.

504 {
505  RECT rect;
506  HDC hdc;
507  int icard;
508  int numunder = 0;
509  int iwhichcard;
510 
511  int numcards = cardstack.NumCards();
512 
513  //work out how big the bitmaps need to be
514  nDragCardWidth = (numtodrag - 1) * abs(xoffset) + __cardwidth;
515  nDragCardHeight = (numtodrag - 1) * abs(yoffset) + __cardheight;
516 
517  //Create bitmap for the back-buffer
518  hdc = GetDC(NULL);
522 
523  //create bitmap for the drag-image
527  ReleaseDC(NULL, hdc);
528 
531 
532  //grab the first bit of background so we can prep the back buffer; do this by
533  //rendering the card stack (minus the card we are dragging) to the temporary
534  //background buffer, so it appears if we have lifted the card from the stack
535  //--SetRect(&rect, 0, 0, nDragCardWidth, nDragCardHeight);
536  //--PaintRect(hdcBackGnd, &rect, crBackgnd);
537 
538  int threedadjust = numcards % nThreedCount == 0;
539 
540  numunder = CalcApparentCards(numcards);
541  iwhichcard = (numcards+numtodrag) - numunder - 1;
542  if(nThreedCount == 1) iwhichcard = 0;
543 
544  int xoff = calc_offset(xoffset, numunder, numtodrag, numunder);
545  int yoff = calc_offset(yoffset, numunder, numtodrag, numunder);
546 
548 
549  //
550  // Render the cardstack into the back-buffer. The stack
551  // has already had the dragcards removed, so just draw
552  // what is left
553  //
554  for(icard = 0; icard < numunder; icard++)
555  {
556  Card card = cardstack.cardlist[iwhichcard];
557  int nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;
558 
560  xoffset * icard - xoffset*(numunder-numtodrag+threedadjust),
561  yoffset * icard - yoffset*(numunder-numtodrag+threedadjust),
562  nCardVal);
563 
564  iwhichcard++;
565  }
566 
567  //
568  // If there are no cards under this one, just draw the place holder
569  //
570  if(numcards == 0)
571  {
572  switch(uEmptyImage)
573  {
574  case CS_EI_NONE:
575  //no need! we've already cleared the whole
576  //back-buffer before the main loop!
577  //SetRect(&rect, 0, 0, __cardwidth, __cardheight);
578  //PaintRect(hdcBackGnd, &rect, MAKE_PALETTERGB(crBackgnd));
579  break;
580 
581  case CS_EI_SUNK:
583  break;
584 
585  case CS_EI_CIRC:
586  case CS_EI_X:
587  CardBlt(hdc, 0, 0, uEmptyImage);
588  break;
589  }
590  }
591 
592  //
593  // now render the drag-cards into the dragcard image
594  //
596 
597  for(icard = 0; icard < numtodrag; icard++)
598  {
599  Card card = dragstack.cardlist[icard];
600  int nCardVal = card.FaceUp() ? card.Idx() : nBackCardIdx;
601 
602  CardBlt(hdcDragCard, xoffset * icard, yoffset * icard, nCardVal);
603  }
604 }
#define abs(i)
Definition: fconv.c:206
bool FaceUp() const
Definition: card.h:74
HDC hdcDragCard
Definition: cardregion.h:178
CardStack cardstack
Definition: cardregion.h:143
int nThreedCount
Definition: cardregion.h:182
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
void PaintRect(HDC hdc, RECT *rect, COLORREF colour)
Definition: cardlib.cpp:116
Card cardlist[MAX_CARDSTACK_SIZE]
Definition: cardstack.h:47
HPALETTE UseNicePalette(HDC hdc, HPALETTE hPalette)
Definition: cardwindow.cpp:14
static HDC
Definition: imagelist.c:92
#define CS_EI_SUNK
Definition: cardlib.h:19
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HDC __hdcPlaceHolder
Definition: cardlib.cpp:21
GLint GLint GLint yoffset
Definition: gl.h:1547
HBITMAP hbmDragCard
Definition: cardregion.h:179
& rect
Definition: startmenu.cpp:1413
#define CS_EI_NONE
Definition: cardlib.h:18
void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy)
Definition: cardwindow.cpp:743
#define CS_EI_CIRC
Definition: cardlib.h:20
GLint GLint xoffset
Definition: gl.h:1547
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int nDragCardHeight
Definition: cardregion.h:174
smooth NULL
Definition: ftsmooth.c:416
HDC hdcBackGnd
Definition: cardregion.h:176
int Idx() const
Definition: card.h:69
void CalcApparentCards()
Definition: cardregion.cpp:77
CardStack dragstack
Definition: cardregion.h:144
#define CS_EI_X
Definition: cardlib.h:21
HPALETTE __hPalette
Definition: cardlib.cpp:28
int nBackCardIdx
Definition: cardregion.h:194
HDC hdc
Definition: main.c:9
COLORREF crBackgnd
Definition: cardregion.h:189
int __cardwidth
Definition: cardlib.cpp:25
void CardBlt(HDC hdc, int x, int y, int nCardNum)
Definition: cardrgndraw.cpp:22
Definition: card.h:27
int nDragCardWidth
Definition: cardregion.h:173
int __cardheight
Definition: cardlib.cpp:26
void DrawCard(HDC hdc, int x, int y, HDC hdcSource, int width, int height)
CardWindow & parentWnd
Definition: cardregion.h:141
UINT uEmptyImage
Definition: cardregion.h:191
int NumCards() const
Definition: cardstack.h:14
HBITMAP hbmBackGnd
Definition: cardregion.h:177
int calc_offset(int offset, int numcards, int numtodrag, int realvisible)

Referenced by PrepareDragBitmaps().

◆ Push() [1/2]

void CardRegion::Push ( const Card  card)
inline

Definition at line 88 of file cardregion.h.

88 { cardstack.Push(card); }
CardStack cardstack
Definition: cardregion.h:143
void Push(const Card card)
Definition: cardstack.cpp:83

◆ Push() [2/2]

void CardRegion::Push ( const CardStack cs)
inline

Definition at line 89 of file cardregion.h.

89 { cardstack.Push(cs); }
CardStack cardstack
Definition: cardregion.h:143
void Push(const Card card)
Definition: cardstack.cpp:83
uint32_t cs
Definition: isohybrid.c:75

◆ Redraw()

void CardRegion::Redraw ( )

Definition at line 618 of file cardrgndraw.cpp.

619 {
620  HDC hdc = GetDC((HWND)parentWnd);
621 
622  Update();
623  Render(hdc);
624 
626 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
void Update()
Definition: cardregion.cpp:207
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: main.c:9
void Render(HDC hdc)
CardWindow & parentWnd
Definition: cardregion.h:141

Referenced by PlayCard(), RedrawIfNotDim(), RowStackClickProc(), and TurnStackCard().

◆ RedrawIfNotDim()

void CardRegion::RedrawIfNotDim ( CardRegion compare,
bool  fFullRedraw 
)
private

Definition at line 611 of file cardregion.cpp.

612 {
613  //
614  //
615  //
616  if( pCompare->xoffset != xoffset ||
617  pCompare->yoffset != yoffset ||
618  pCompare->nThreedCount != nThreedCount ||
619  pCompare->uFaceDirType != uFaceDirType ||
620  pCompare->uFaceDirType != CS_FACE_ANY
621  )
622  {
623  if(fFullRedraw)
624  parentWnd.Redraw();
625  else
626  pCompare->Redraw();
627  }
628 
629 }
int nThreedCount
Definition: cardregion.h:182
#define CS_FACE_ANY
Definition: cardlib.h:55
GLint GLint GLint yoffset
Definition: gl.h:1547
void Redraw(void)
Definition: cardwindow.cpp:553
GLint GLint xoffset
Definition: gl.h:1547
UINT uFaceDirType
Definition: cardregion.h:192
CardWindow & parentWnd
Definition: cardregion.h:141

Referenced by MoveCard(), OnLButtonUp(), and SimulateDrag().

◆ ReleaseDragBitmaps()

void CardRegion::ReleaseDragBitmaps ( void  )
private

Definition at line 606 of file cardrgndraw.cpp.

607 {
608  //SelectObject(hdcBackGnd, hOld1);
611 
612  //SelectObject(hdcDragCard, hOld2);
615 }
HDC hdcDragCard
Definition: cardregion.h:178
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HBITMAP hbmDragCard
Definition: cardregion.h:179
HDC hdcBackGnd
Definition: cardregion.h:176
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP hbmBackGnd
Definition: cardregion.h:177

Referenced by MoveCard(), and OnLButtonUp().

◆ Render()

void CardRegion::Render ( HDC  hdc)
private

Definition at line 253 of file cardrgndraw.cpp.

254 {
255  int cardnum = 0;
256  int numtodraw;
257  BOOL fDrawTips;
258 
259  Update(); //Update this stack's card count + size
260 
261  numtodraw = nNumApparentCards;
262 
263  if(nFlashCount != 0)
264  {
265  if(fFlashVisible == false)
266  numtodraw = 0;
267  }
268 
269  if(fVisible == 0) return;
270 
271  cardnum = cardstack.NumCards() - numtodraw;
272  int counter;
273 
274  for(counter = 0; counter < numtodraw; counter++)
275  {
276  int cardval;
277 
278  int x = xoffset * counter + xpos;
279  int y = yoffset * counter + ypos;
280 
281  //if about to draw last card, then actually draw the top card
282  if(counter == numtodraw - 1) cardnum = cardstack.NumCards() - 1;
283 
284  Card card = cardstack.cardlist[cardnum];
285  cardval = card.Idx();
286 
287  if(card.FaceDown())
288  cardval = nBackCardIdx; //card-back
289 
290  //only draw the visible part of the card
291  if(counter < numtodraw - 1)
292  {
293  if(yoffset != 0 && xoffset != 0)
294  fDrawTips = FALSE;
295  else
296  fDrawTips = TRUE;
297 
298  if((yoffset != 0 && abs(xoffset) == 1) || (xoffset != 0 && abs(yoffset) == 1))
299  fDrawTips = TRUE;
300 
301  //draw horizontal strips
302  if(yoffset > 0)
303  {
304  DrawHorzCardStrip(hdc, x, y, cardval, yoffset, fDrawTips);
305  }
306  else if(yoffset < 0)
307  {
308  DrawHorzCardStrip(hdc, x, y+__cardheight+yoffset, cardval, yoffset, fDrawTips);
309  }
310 
311  //draw some vertical bars
312  if(xoffset > 0)
313  {
314  DrawVertCardStrip(hdc, x, y, cardval, xoffset, fDrawTips);
315  }
316  else if(xoffset < 0)
317  {
318  DrawVertCardStrip(hdc, x+__cardwidth+xoffset, y, cardval, xoffset, fDrawTips);
319  }
320 
321  if(yoffset != 0 && xoffset != 0)//fDrawTips == FALSE)
322  {
323  //if we didn't draw any tips, then this is a 2-dim stack
324  //(i.e, it goes at a diagonal).
325  //in this case, we need to fill in the small triangle in
326  //each corner!
327  DrawCardCorner(hdc, x, y, cardval, xoffset, yoffset);
328  }
329  }
330  //if the top card, draw the whole thing
331  else
332  {
333  CardBlt(hdc, x, y, cardval);
334  }
335 
336  cardnum ++;
337 
338  } //end of index
339 
340  if(counter == 0) //if the cardstack is empty, then draw it that way
341  {
342  int x = xpos;
343  int y = ypos;
344 
345  switch(uEmptyImage)
346  {
347  default:
348  case CS_EI_NONE:
349  //this wipes the RECT variable, so watch out!
350  //SetRect(&rect, x, y, x+__cardwidth, y+__cardheight);
351  //PaintRect(hdc, &rect, MAKE_PALETTERGB(crBackgnd));
353  break;
354 
355  case CS_EI_SUNK:
357  break;
358 
359  case CS_EI_CIRC:
360  case CS_EI_X:
361  CardBlt(hdc, x, y, uEmptyImage);
362  break;
363  }
364 
365  }
366 
367  return;
368 }
#define abs(i)
Definition: fconv.c:206
CardStack cardstack
Definition: cardregion.h:143
#define TRUE
Definition: types.h:120
int nNumApparentCards
Definition: cardregion.h:181
bool FaceDown() const
Definition: card.h:79
Card cardlist[MAX_CARDSTACK_SIZE]
Definition: cardstack.h:47
#define CS_EI_SUNK
Definition: cardlib.h:19
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC __hdcPlaceHolder
Definition: cardlib.cpp:21
GLint GLint GLint yoffset
Definition: gl.h:1547
#define CS_EI_NONE
Definition: cardlib.h:18
void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy)
Definition: cardwindow.cpp:743
#define CS_EI_CIRC
Definition: cardlib.h:20
unsigned int BOOL
Definition: ntddk_ex.h:94
void Update()
Definition: cardregion.cpp:207
GLint GLint xoffset
Definition: gl.h:1547
void DrawVertCardStrip(HDC hdc, int x, int y, int nCardNum, int width, BOOL fDrawTips)
Definition: cardrgndraw.cpp:98
GLuint counter
Definition: glext.h:11116
int Idx() const
Definition: card.h:69
void DrawCardCorner(HDC hdc, int x, int y, int cardval, int xdir, int ydir)
#define CS_EI_X
Definition: cardlib.h:21
int nBackCardIdx
Definition: cardregion.h:194
HDC hdc
Definition: main.c:9
bool fFlashVisible
Definition: cardregion.h:186
int __cardwidth
Definition: cardlib.cpp:25
void CardBlt(HDC hdc, int x, int y, int nCardNum)
Definition: cardrgndraw.cpp:22
void DrawHorzCardStrip(HDC hdc, int x, int y, int nCardNum, int height, BOOL fDrawTips)
Definition: cardrgndraw.cpp:48
Definition: card.h:27
int nFlashCount
Definition: cardregion.h:185
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int __cardheight
Definition: cardlib.cpp:26
void DrawCard(HDC hdc, int x, int y, HDC hdcSource, int width, int height)
CardWindow & parentWnd
Definition: cardregion.h:141
UINT uEmptyImage
Definition: cardregion.h:191
int NumCards() const
Definition: cardstack.h:14
bool fVisible
Definition: cardregion.h:183

Referenced by CardWindow::Paint(), and Redraw().

◆ RenderBottomMost()

void CardRegion::RenderBottomMost ( HDC  hdc,
int  minustopmost = 0 
)
private

◆ Reverse()

void CardRegion::Reverse ( )
inline

Definition at line 86 of file cardregion.h.

86 { cardstack.Reverse(); }
CardStack cardstack
Definition: cardregion.h:143
void Reverse()
Definition: cardstack.cpp:73

◆ SetAddCardProc()

void CardRegion::SetAddCardProc ( pAddProc  proc)

Definition at line 197 of file cardregion.cpp.

198 {
199  AddCallback = proc;
200 }
pAddProc AddCallback
Definition: cardregion.h:207
static HANDLE proc()
Definition: pdb.c:32

Referenced by CreateSol(), and CreateSpider().

◆ SetBackCardIdx()

void CardRegion::SetBackCardIdx ( UINT  uBackIdx)

Definition at line 384 of file cardregion.cpp.

385 {
386  if(uBackIdx >= 52 && uBackIdx <= 68)
387  nBackCardIdx = uBackIdx;
388 }
int nBackCardIdx
Definition: cardregion.h:194

Referenced by CardWindow::CreateRegion().

◆ SetBackColor()

void CardRegion::SetBackColor ( COLORREF  cr)

Definition at line 67 of file cardregion.cpp.

68 {
69  crBackgnd = cr;
70 }
COLORREF crBackgnd
Definition: cardregion.h:189

Referenced by CardWindow::CreateRegion(), and CardWindow::SetBackColor().

◆ SetCardStack()

void CardRegion::SetCardStack ( const CardStack cs)

Definition at line 390 of file cardregion.cpp.

391 {
392  //make a complete copy of the specified stack..
393  cardstack = cs;
394 
395  // Update the face-direction and stack-size
396  Update();
397 }
CardStack cardstack
Definition: cardregion.h:143
uint32_t cs
Definition: isohybrid.c:75
void Update()
Definition: cardregion.cpp:207

Referenced by DeckClickProc(), MoveCard(), NewGame(), OnLButtonUp(), PileRemoveProc(), and StackDropProc().

◆ SetClickProc()

void CardRegion::SetClickProc ( pClickProc  proc)

Definition at line 182 of file cardregion.cpp.

183 {
185 }
static HANDLE proc()
Definition: pdb.c:32
pClickProc ClickCallback
Definition: cardregion.h:204

Referenced by CreateSol().

◆ SetClickReleaseProc()

void CardRegion::SetClickReleaseProc ( pClickProc  proc)

Definition at line 187 of file cardregion.cpp.

188 {
190 }
pClickProc ClickReleaseCallback
Definition: cardregion.h:205
static HANDLE proc()
Definition: pdb.c:32

Referenced by CreateSpider().

◆ SetDblClickProc()

void CardRegion::SetDblClickProc ( pClickProc  proc)

Definition at line 192 of file cardregion.cpp.

193 {
195 }
pClickProc DblClickCallback
Definition: cardregion.h:206
static HANDLE proc()
Definition: pdb.c:32

Referenced by CreateSol().

◆ SetDragRule()

bool CardRegion::SetDragRule ( UINT  uDragType,
pCanDragProc  proc = 0 
)

Definition at line 146 of file cardregion.cpp.

147 {
148  switch(uDragType)
149  {
150  case CS_DRAG_NONE: case CS_DRAG_ALL: case CS_DRAG_TOP:
151  uDragRule = uDragType;
152  return true;
153 
154  case CS_DRAG_CALLBACK:
155  uDragRule = uDragType;
157  return true;
158 
159  default:
160  return false;
161  }
162 }
#define CS_DRAG_NONE
Definition: cardlib.h:28
#define CS_DRAG_CALLBACK
Definition: cardlib.h:31
static HANDLE proc()
Definition: pdb.c:32
#define CS_DRAG_TOP
Definition: cardlib.h:29
#define CS_DRAG_ALL
Definition: cardlib.h:30
UINT uDragRule
Definition: cardregion.h:196
pCanDragProc CanDragCallback
Definition: cardregion.h:202

Referenced by CreateSol(), and CreateSpider().

◆ SetDropRule()

bool CardRegion::SetDropRule ( UINT  uDropType,
pCanDropProc  proc = 0 
)

Definition at line 164 of file cardregion.cpp.

165 {
166  switch(uDropType)
167  {
168  case CS_DROP_NONE: case CS_DROP_ALL:
169  uDropRule = uDropType;
170  return true;
171 
172  case CS_DROP_CALLBACK:
173  uDropRule = uDropType;
175  return true;
176 
177  default:
178  return false;
179  }
180 }
static HANDLE proc()
Definition: pdb.c:32
pCanDropProc CanDropCallback
Definition: cardregion.h:203
#define CS_DROP_ALL
Definition: cardlib.h:34
#define CS_DROP_NONE
Definition: cardlib.h:33
UINT uDropRule
Definition: cardregion.h:197
#define CS_DROP_CALLBACK
Definition: cardlib.h:35

Referenced by CreateSol(), and CreateSpider().

◆ SetEmptyImage()

void CardRegion::SetEmptyImage ( UINT  uImage)

Definition at line 366 of file cardregion.cpp.

367 {
368  switch(uImage)
369  {
370  case CS_EI_NONE:
371  case CS_EI_SUNK:
372  case CS_EI_CIRC:
373  case CS_EI_X:
374  uEmptyImage = uImage;
375  break;
376 
377  default:
379  break;
380  }
381 
382 }
#define CS_EI_SUNK
Definition: cardlib.h:19
#define CS_EI_NONE
Definition: cardlib.h:18
#define CS_EI_CIRC
Definition: cardlib.h:20
#define CS_EI_X
Definition: cardlib.h:21
UINT uEmptyImage
Definition: cardregion.h:191

Referenced by CreateSol(), and CreateSpider().

◆ SetFaceDirection()

void CardRegion::SetFaceDirection ( UINT  uDirType,
int  nOption 
)

Definition at line 258 of file cardregion.cpp.

259 {
260  switch(uDirType)
261  {
262  case CS_FACE_UP: case CS_FACE_DOWN: case CS_FACE_DOWNUP:
263  case CS_FACE_UPDOWN: case CS_FACE_ANY:
264  uFaceDirType = uDirType;
265  nFaceDirOption = nOption;
266 
268 
269  break;
270  }
271 }
CardStack cardstack
Definition: cardregion.h:143
#define CS_FACE_ANY
Definition: cardlib.h:55
#define CS_FACE_UPDOWN
Definition: cardlib.h:54
#define CS_FACE_UP
Definition: cardlib.h:51
void UpdateFaceDir(CardStack &cards)
Definition: cardregion.cpp:409
UINT uFaceDirType
Definition: cardregion.h:192
#define CS_FACE_DOWN
Definition: cardlib.h:52
int nFaceDirOption
Definition: cardregion.h:193
#define CS_FACE_DOWNUP
Definition: cardlib.h:53

Referenced by CreateSol(), CreateSpider(), NewGame(), RowStackClickProc(), and TurnStackCard().

◆ SetOffsets()

void CardRegion::SetOffsets ( int  x,
int  y 
)

Definition at line 228 of file cardregion.cpp.

229 {
230  xoffset = x;
231  yoffset = y;
232 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint yoffset
Definition: gl.h:1547
GLint GLint xoffset
Definition: gl.h:1547
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by DeckClickProc(), NewGame(), and PileRemoveProc().

◆ SetPlacement()

void CardRegion::SetPlacement ( UINT  xJustify,
UINT  yJustify,
int  xAdjust,
int  yAdjust 
)

Definition at line 250 of file cardregion.cpp.

251 {
252  xjustify = xJustify;
253  yjustify = yJustify;
254  xadjust = xAdjust;
255  yadjust = yAdjust;
256 }
int xjustify
Definition: cardregion.h:159
int yjustify
Definition: cardregion.h:160

Referenced by CreateSol(), and CreateSpider().

◆ SetPos()

void CardRegion::SetPos ( int  x,
int  y 
)

Definition at line 234 of file cardregion.cpp.

235 {
236  xpos = x;
237  ypos = y;
238 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ SetRemoveCardProc()

void CardRegion::SetRemoveCardProc ( pRemoveProc  proc)

Definition at line 202 of file cardregion.cpp.

203 {
205 }
pRemoveProc RemoveCallback
Definition: cardregion.h:208
static HANDLE proc()
Definition: pdb.c:32

Referenced by CreateSol().

◆ SetThreedCount()

bool CardRegion::SetThreedCount ( int  count)

Definition at line 215 of file cardregion.cpp.

216 {
217  if(count < 1)
218  {
219  return false;
220  }
221  else
222  {
224  return true;
225  }
226 }
int nThreedCount
Definition: cardregion.h:182
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by CreateSol().

◆ Show()

void CardRegion::Show ( bool  fShow)

Definition at line 240 of file cardregion.cpp.

241 {
242  fVisible = fShow;
243 }
bool fVisible
Definition: cardregion.h:183

◆ Shuffle()

void CardRegion::Shuffle ( )
inline

Definition at line 83 of file cardregion.h.

83 { cardstack.Shuffle(); }
CardStack cardstack
Definition: cardregion.h:143
void Shuffle()
Definition: cardstack.cpp:50

◆ SimulateDrag()

bool CardRegion::SimulateDrag ( CardRegion pDestStack,
int  nNumCards,
bool  fAnimate 
)

Definition at line 636 of file cardregion.cpp.

637 {
638  if(pDestStack == 0)
639  return false;
640 
641  if(CanDragCards(iNumDragCards) != false)
642  {
643  if(pDestStack->CanDropCards(cardstack))
644  {
645  MoveCard(pDestStack, iNumDragCards, fAnimate);
646 
647  if(RemoveCallback)
649 
650  if(pDestStack->AddCallback)
651  pDestStack->AddCallback(*pDestStack, pDestStack->cardstack);
652 
653  RedrawIfNotDim(pDestStack, true);
654  }
655 
656  }
657 
658  return true;
659 }
pAddProc AddCallback
Definition: cardregion.h:207
CardStack cardstack
Definition: cardregion.h:143
pRemoveProc RemoveCallback
Definition: cardregion.h:208
bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate)
Definition: cardregion.cpp:477
bool CanDropCards(CardStack &cards)
void RedrawIfNotDim(CardRegion *compare, bool fFullRedraw)
Definition: cardregion.cpp:611
int iNumDragCards
Definition: cardregion.h:167
bool CanDragCards(int iNumCards)

Referenced by RowStackDblClickProc().

◆ StopFlash()

void CardRegion::StopFlash ( )

Definition at line 333 of file cardregion.cpp.

334 {
335  if(uFlashTimer != (UINT)-1)
336  {
338  nFlashCount = 0;
339  uFlashTimer = (UINT)-1;
340  fFlashVisible = true;
341  }
342 }
UINT uFlashTimer
Definition: cardregion.h:187
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
bool fFlashVisible
Definition: cardregion.h:186
unsigned int UINT
Definition: ndis.h:50
int nFlashCount
Definition: cardregion.h:185
CardWindow & parentWnd
Definition: cardregion.h:141

◆ Top() [1/2]

Card CardRegion::Top ( )
inline

Definition at line 94 of file cardregion.h.

94 { return cardstack.Top(); }
CardStack cardstack
Definition: cardregion.h:143
Card Top()
Definition: cardstack.cpp:151

Referenced by TConsole::DeleteCharacter(), TConsole::InsertCharacter(), and TConsole::InsertLine().

◆ Top() [2/2]

CardStack CardRegion::Top ( int  items)
inline

Definition at line 95 of file cardregion.h.

95 { return cardstack.Top(items); }
CardStack cardstack
Definition: cardregion.h:143
Card Top()
Definition: cardstack.cpp:151
static TCHAR * items[]
Definition: page1.c:45

◆ UnLock()

bool CardRegion::UnLock ( )

Definition at line 569 of file cardregion.cpp.

570 {
571  if(ReleaseMutex(mxlock))
572  {
573  //TRACE("Unlocking stack\n");
574  return true;
575  }
576  else
577  {
578  //TRACE("Unlocking stack failed\n");
579  return false;
580  }
581 }
HANDLE mxlock
Definition: cardregion.h:211
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618

◆ Update()

void CardRegion::Update ( void  )

Definition at line 207 of file cardregion.cpp.

208 {
210  UpdateSize();
212 }
CardStack cardstack
Definition: cardregion.h:143
void UpdateFaceDir(CardStack &cards)
Definition: cardregion.cpp:409
void UpdateSize()
Definition: cardregion.cpp:83
void CalcApparentCards()
Definition: cardregion.cpp:77

Referenced by AdjustPosition(), CardRegion(), Clip(), DeckClickProc(), CardWindow::EmptyStacks(), MoveCard(), NewGame(), OnLButtonDown(), OnLButtonUp(), Redraw(), Render(), and SetCardStack().

◆ UpdateFaceDir()

void CardRegion::UpdateFaceDir ( CardStack cards)
private

Definition at line 409 of file cardregion.cpp.

410 {
411  int i, n, num;
412 
413  num = cards.NumCards();
414 
415  //Now apply the face direction rules..
416  switch(uFaceDirType)
417  {
418  case CS_FACE_UP:
419 
420  for(i = 0; i < num; i++)
421  {
422  cards[i].SetFaceUp(true);
423  }
424 
425  break;
426 
427  case CS_FACE_DOWN:
428 
429  for(i = 0; i < num; i++)
430  {
431  cards[i].SetFaceUp(false);
432  }
433 
434  break;
435 
436  case CS_FACE_DOWNUP:
437 
438  num = cardstack.NumCards();
439  n = min(nFaceDirOption, num);
440 
441  //bottom n cards..
442  for(i = 0; i < n; i++)
443  {
444  cards[num - i - 1].SetFaceUp(false);
445  }
446 
447  for(i = n; i < num; i++)
448  {
449  cards[num - i - 1].SetFaceUp(true);
450  }
451 
452  break;
453 
454  case CS_FACE_UPDOWN:
455 
456  num = cardstack.NumCards();
457  n = min(nFaceDirOption, num);
458 
459  for(i = 0; i < n; i++)
460  {
461  cards[num - i - 1].SetFaceUp(true);
462  }
463 
464  for(i = n; i < num; i++)
465  {
466  cards[num - i - 1].SetFaceUp(false);
467  }
468 
469  break;
470 
471  case CS_FACE_ANY: //cards can be any orientation
472  default:
473  break;
474  }
475 }
CardStack cardstack
Definition: cardregion.h:143
#define CS_FACE_ANY
Definition: cardlib.h:55
GLdouble n
Definition: glext.h:7729
#define CS_FACE_UPDOWN
Definition: cardlib.h:54
#define CS_FACE_UP
Definition: cardlib.h:51
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
UINT uFaceDirType
Definition: cardregion.h:192
#define CS_FACE_DOWN
Definition: cardlib.h:52
GLuint GLuint num
Definition: glext.h:9618
int nFaceDirOption
Definition: cardregion.h:193
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
#define min(a, b)
Definition: monoChain.cc:55
int NumCards() const
Definition: cardstack.h:14

Referenced by MoveCard(), SetFaceDirection(), and Update().

◆ UpdateSize()

void CardRegion::UpdateSize ( void  )
private

Definition at line 83 of file cardregion.cpp.

84 {
85  if(cardstack.NumCards() > 0)
86  {
87  if(xoffset > 0)
89  else
91 
92  if(yoffset > 0)
94  else
96  }
97  else
98  {
101  }
102 }
GLint GLint GLsizei width
Definition: gl.h:1546
CardStack cardstack
Definition: cardregion.h:143
int nNumApparentCards
Definition: cardregion.h:181
GLint GLint GLint yoffset
Definition: gl.h:1547
GLint GLint xoffset
Definition: gl.h:1547
int __cardwidth
Definition: cardlib.cpp:25
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
int __cardheight
Definition: cardlib.cpp:26
int NumCards() const
Definition: cardstack.h:14

Referenced by CardWindow::DistributeStacks(), and Update().

◆ ZoomCard()

void CardRegion::ZoomCard ( HDC  hdc,
int  xpos,
int  ypos,
CardRegion dest 
)
private

Definition at line 553 of file cardrgnmouse.cpp.

554 {
555  TRACE ( "ENTER ZoomCard()\n" );
556  double dx, dy, x ,y;
557  int apparentcards;
558  x = (double)xpos; y = (double)ypos;
559 
560  oldx = (int)x;
561  oldy = (int)y;
562 
563  apparentcards = pDestStack->cardstack.NumCards() / pDestStack->nThreedCount;
564 
565  int idestx = pDestStack->xpos + pDestStack->xoffset * (apparentcards);
566  int idesty = pDestStack->ypos + pDestStack->yoffset * (apparentcards);
567 
568  if(pDestStack->yoffset < 0)
569  idesty += pDestStack->yoffset * (iNumDragCards-1);
570 
571  if(pDestStack->xoffset < 0)
572  idestx += pDestStack->xoffset * (iNumDragCards-1);
573 
574  //normalise the motion vector
575  dx = idestx - x;
576  dy = idesty - y;
577  if ( fabs(dx) + fabs(dy) < 0.001f )
578  {
579  MoveDragCardTo(hdc, idestx, idesty);
580  return;
581  }
582  double recip = 1.0 / sqrt(dx*dx + dy*dy);
583  dx *= recip * __CARDZOOMSPEED; dy *= recip * __CARDZOOMSPEED;
584 
585  //if(dx < 0) dxinc = 1.001; else
586 
587  for(;;)
588  {
589  bool attarget = true;
590  int ix, iy;
591  x += dx;
592  y += dy;
593 
594  ix = (int)x;
595  iy = (int)y;
596 
597  if(dx < 0.0 && ix < idestx) ix = idestx;
598  else if(dx > 0.0 && ix > idestx) ix = idestx;
599  else attarget = false;
600 
601  if(dy < 0.0 && iy < idesty) iy = idesty;
602  else if(dy > 0.0 && iy > idesty) iy = idesty;
603  else attarget = false;
604 
605  //if the target stack wants the drag cards drawn differently
606  //to how they are, then redraw the drag card image just before
607  //the cards land
608  /*if(attarget == true)
609  {
610  for(int i = 0; i < iNumDragCards; i++)
611  {
612  int xdraw = pDestStack->xoffset*i;
613  int ydraw = pDestStack->yoffset*i;
614 
615  if(pDestStack->yoffset < 0)
616  ydraw = -pDestStack->yoffset * (iNumDragCards-i-1);
617  if(pDestStack->xoffset < 0)
618  xdraw = -pDestStack->xoffset * (iNumDragCards-i-1);
619 
620  if(pDestStack->facedirection == CS_FACEUP &&
621  pDestStack->numcards+i >= dest->numfacedown)
622  {
623  //cdtDraw(hdcDragCard, xdraw, ydraw, iDragCards[i], ectFACES, 0);
624  }
625  else
626  {
627  //cdtDraw(hdcDragCard, xdraw, ydraw, CARDSTACK::backcard, ectBACKS, 0);
628  }
629  }
630  }*/
631 
632  MoveDragCardTo(hdc, ix, iy);
633 
634  if(attarget || (ix == idestx && iy == idesty))
635  break;
636 
637  oldx = (int)x;
638  oldy = (int)y;
639 
640  //dx *= 1.2;
641  //dy *= 1.2;
642 
643  Sleep(10);
644  }
645  TRACE ( "EXIT ZoomCard()\n" );
646 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
void MoveDragCardTo(HDC hdc, int x, int y)
double __CARDZOOMSPEED
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
GLint dy
Definition: linetemp.h:97
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int iy
Definition: tritemp.h:491
#define TRACE(s)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
HDC hdc
Definition: main.c:9
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
int iNumDragCards
Definition: cardregion.h:167
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by MoveCard(), and OnLButtonUp().

Friends And Related Function Documentation

◆ CardStack

friend class CardStack
friend

Definition at line 14 of file cardregion.h.

◆ CardWindow

friend class CardWindow
friend

Definition at line 13 of file cardregion.h.

Member Data Documentation

◆ AddCallback

pAddProc CardRegion::AddCallback
private

Definition at line 207 of file cardregion.h.

Referenced by CardRegion(), OnLButtonUp(), SetAddCardProc(), and SimulateDrag().

◆ CanDragCallback

pCanDragProc CardRegion::CanDragCallback
private

Definition at line 202 of file cardregion.h.

Referenced by CanDragCards(), CardRegion(), and SetDragRule().

◆ CanDropCallback

pCanDropProc CardRegion::CanDropCallback
private

Definition at line 203 of file cardregion.h.

Referenced by CanDropCards(), CardRegion(), and SetDropRule().

◆ cardstack

◆ ClickCallback

pClickProc CardRegion::ClickCallback
private

Definition at line 204 of file cardregion.h.

Referenced by CardRegion(), OnLButtonDown(), and SetClickProc().

◆ ClickReleaseCallback

pClickProc CardRegion::ClickReleaseCallback
private

Definition at line 205 of file cardregion.h.

Referenced by CardRegion(), ClickRelease(), and SetClickReleaseProc().

◆ crBackgnd

COLORREF CardRegion::crBackgnd
private

◆ DblClickCallback

pClickProc CardRegion::DblClickCallback
private

Definition at line 206 of file cardregion.h.

Referenced by CardRegion(), OnLButtonDblClk(), and SetDblClickProc().

◆ dragstack

CardStack CardRegion::dragstack
private

◆ fFlashVisible

bool CardRegion::fFlashVisible
private

Definition at line 186 of file cardregion.h.

Referenced by CardRegion(), Clip(), DoFlash(), Flash(), Render(), and StopFlash().

◆ fMouseDragging

bool CardRegion::fMouseDragging
private

Definition at line 146 of file cardregion.h.

Referenced by CardRegion(), NumCards(), OnLButtonDown(), and OnLButtonUp().

◆ fVisible

bool CardRegion::fVisible
private

Definition at line 183 of file cardregion.h.

Referenced by CardRegion(), Clip(), IsPointInStack(), IsVisible(), Render(), and Show().

◆ hbmBackGnd

HBITMAP CardRegion::hbmBackGnd
private

◆ hbmDragCard

HBITMAP CardRegion::hbmDragCard
private

◆ hdcBackGnd

HDC CardRegion::hdcBackGnd
private

◆ hdcDragCard

HDC CardRegion::hdcDragCard
private

◆ height

int CardRegion::height
private

Definition at line 155 of file cardregion.h.

Referenced by AdjustPosition(), and GetOverlapRatio().

◆ id

int CardRegion::id
private

Definition at line 139 of file cardregion.h.

Referenced by Id().

◆ iNumDragCards

int CardRegion::iNumDragCards
private

◆ mousexoffset

int CardRegion::mousexoffset
private

Definition at line 168 of file cardregion.h.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

◆ mouseyoffset

int CardRegion::mouseyoffset
private

Definition at line 169 of file cardregion.h.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

◆ mxlock

HANDLE CardRegion::mxlock
private

Definition at line 211 of file cardregion.h.

Referenced by CanDragCards(), CanDropCards(), CardRegion(), Lock(), UnLock(), and ~CardRegion().

◆ nBackCardIdx

int CardRegion::nBackCardIdx
private

Definition at line 194 of file cardregion.h.

Referenced by PrepareDragBitmaps(), PrepareDragBitmapsThreed(), Render(), and SetBackCardIdx().

◆ nDragCardHeight

int CardRegion::nDragCardHeight
private

◆ nDragCardWidth

int CardRegion::nDragCardWidth
private

◆ nFaceDirOption

int CardRegion::nFaceDirOption
private

Definition at line 193 of file cardregion.h.

Referenced by CardRegion(), GetFaceDirection(), SetFaceDirection(), and UpdateFaceDir().

◆ nFlashCount

int CardRegion::nFlashCount
private

Definition at line 185 of file cardregion.h.

Referenced by CardRegion(), Clip(), DoFlash(), Flash(), Render(), and StopFlash().

◆ nNumApparentCards

int CardRegion::nNumApparentCards
private

◆ nThreedCount

◆ oldx

int CardRegion::oldx
private

Definition at line 170 of file cardregion.h.

Referenced by MoveCard(), MoveDragCardTo(), OnLButtonDown(), OnMouseMove(), and ZoomCard().

◆ oldy

int CardRegion::oldy
private

Definition at line 171 of file cardregion.h.

Referenced by MoveCard(), MoveDragCardTo(), OnLButtonDown(), OnMouseMove(), and ZoomCard().

◆ parentWnd

◆ RemoveCallback

pRemoveProc CardRegion::RemoveCallback
private

Definition at line 208 of file cardregion.h.

Referenced by CardRegion(), OnLButtonUp(), SetRemoveCardProc(), and SimulateDrag().

◆ uDragRule

UINT CardRegion::uDragRule
private

Definition at line 196 of file cardregion.h.

Referenced by CanDragCards(), CardRegion(), and SetDragRule().

◆ uDropRule

UINT CardRegion::uDropRule
private

Definition at line 197 of file cardregion.h.

Referenced by CanDropCards(), CardRegion(), and SetDropRule().

◆ uEmptyImage

UINT CardRegion::uEmptyImage
private

◆ uFaceDirType

UINT CardRegion::uFaceDirType
private

◆ uFlashTimer

UINT CardRegion::uFlashTimer
private

Definition at line 187 of file cardregion.h.

Referenced by CardRegion(), DoFlash(), Flash(), and StopFlash().

◆ width

int CardRegion::width
private

Definition at line 154 of file cardregion.h.

Referenced by CardWindow::DistributeStacks(), and Quilt::getRange().

◆ xadjust

int CardRegion::xadjust
private

◆ xjustify

int CardRegion::xjustify
private

◆ xoffset

int CardRegion::xoffset
private

Definition at line 151 of file cardregion.h.

Referenced by GetNumDragCards(), RedrawIfNotDim(), and ZoomCard().

◆ xpos

◆ yadjust

int CardRegion::yadjust
private

Definition at line 162 of file cardregion.h.

Referenced by AdjustPosition(), CardRegion(), and SetPlacement().

◆ yjustify

int CardRegion::yjustify
private

Definition at line 160 of file cardregion.h.

Referenced by AdjustPosition(), CardRegion(), and SetPlacement().

◆ yoffset

int CardRegion::yoffset
private

Definition at line 152 of file cardregion.h.

Referenced by GetNumDragCards(), RedrawIfNotDim(), and ZoomCard().

◆ ypos


The documentation for this class was generated from the following files: