void PaintRect(HDC hdc, RECT *rect, COLORREF colour);
-CardRegion::CardRegion(CardWindow &parent, int Id, bool visible, int x, int y, int xOffset, int yOffset)
+CardRegion::CardRegion(CardWindow &parent, int Id, bool visible, int x, int y, int xOffset, int yOffset)
: id(Id), parentWnd(parent), xpos(x), ypos(y), xoffset(xOffset), yoffset(yOffset), fVisible(visible)
{
width = __cardwidth;
nDragCardWidth = 0;
nDragCardHeight = 0;
-
+
CanDragCallback = 0;
CanDropCallback = 0;
AddCallback = 0;
cr->SetBackCardIdx(nBackCardIdx);
Regions[nNumCardRegions++] = cr;
-
+
return cr;
}
}
bool CardRegion::SetDragRule(UINT uDragType, pCanDragProc proc)
-{
+{
switch(uDragType)
{
case CS_DRAG_NONE: case CS_DRAG_ALL: case CS_DRAG_TOP:
}
bool CardRegion::SetDropRule(UINT uDropType, pCanDropProc proc)
-{
+{
switch(uDropType)
{
- case CS_DROP_NONE: case CS_DROP_ALL:
+ case CS_DROP_NONE: case CS_DROP_ALL:
uDropRule = uDropType;
return true;
void CardRegion::Update()
{
CalcApparentCards();
- UpdateSize();
+ UpdateSize();
UpdateFaceDir(cardstack);
}
bool CardRegion::SetThreedCount(int count)
{
- if(count < 1)
+ if(count < 1)
{
return false;
}
}
bool CardRegion::IsVisible()
-{
+{
return fVisible;
}
switch(xjustify)
{
default: case CS_XJUST_NONE: break;
-
+
case CS_XJUST_CENTER: //centered
xpos = (winwidth - (width & ~0x1)) / 2;
xpos += xadjust;
if(xoffset < 0) xpos += (width - __cardwidth);
-
+
break;
case CS_XJUST_RIGHT: //right-aligned
switch(yjustify)
{
default: case CS_YJUST_NONE: break;
-
+
case CS_YJUST_CENTER: //centered
ypos = (winheight - height) / 2;
ypos += yadjust;
nFlashCount = count;
fFlashVisible = false;
uFlashTimer = SetTimer((HWND)parentWnd, (WPARAM)this, milliseconds, 0);
-
+
parentWnd.Redraw();
}
uFlashTimer = (UINT)-1;
fFlashVisible = true;
}
-
+
parentWnd.Redraw();
}
}
uEmptyImage = CS_EI_NONE;
break;
}
-
+
}
void CardRegion::SetBackCardIdx(UINT uBackIdx)
}
void CardRegion::SetCardStack(const CardStack &cs)
-{
+{
//make a complete copy of the specified stack..
- cardstack = cs;
+ cardstack = cs;
// Update the face-direction and stack-size
Update();
}
const CardStack & CardRegion::GetCardStack()
-{
+{
//return reference to our internal stack
- return cardstack;
+ return cardstack;
}
//
oldx = x;
oldy = y;
-
+
dragstack = cardstack.Pop(nNumCards);
//Alter the drag-stack so that it's cards are the same way up
hdc = GetDC((HWND)parentWnd);
ZoomCard(hdc, x, y, pDestStack);
-
+
ReleaseDC((HWND)parentWnd, hdc);
ReleaseDragBitmaps();
}
// Get a copy of the cardstack
CardStack cs = pDestStack->GetCardStack();
cs.Push(dragstack);
-
+
pDestStack->SetCardStack(cs);
-
+
//cs = pDestStack->GetCardStack();
//pDestStack->Update();
//pDestStack->UpdateFaceDir(cs);
if(fMouseDragging)
return cardstack.NumCards() + dragstack.NumCards();
else
- return cardstack.NumCards();
+ return cardstack.NumCards();
}
bool CardRegion::Lock()
if(dw == WAIT_OBJECT_0)
{
//TRACE("LockStack succeeded\n");
- return true;
+ return true;
}
else
{
}
else
{
- //TRACE("Unlocking stack failed\n");
+ //TRACE("Unlocking stack failed\n");
return false;
}
}
//
//
//
- if( pCompare->xoffset != xoffset ||
- pCompare->yoffset != yoffset ||
+ if( pCompare->xoffset != xoffset ||
+ pCompare->yoffset != yoffset ||
pCompare->nThreedCount != nThreedCount ||
pCompare->uFaceDirType != uFaceDirType ||
pCompare->uFaceDirType != CS_FACE_ANY
else
pCompare->Redraw();
}
-
+
}
//
//make a list of the cards that would be in the drag list
CardStack tempstack = cardstack.Top(iNumDragCards);
- if(pDestStack->CanDropCards(tempstack))
+ if(pDestStack->CanDropCards(tempstack))
{
- MoveCard(pDestStack, iNumDragCards, fAnimate);
-
+ MoveCard(pDestStack, iNumDragCards, fAnimate);
+
if(RemoveCallback)
RemoveCallback(*this, iNumDragCards);
if(pDestStack->AddCallback)
pDestStack->AddCallback(*pDestStack, pDestStack->cardstack);
-
+
RedrawIfNotDim(pDestStack, true);
- }
+ }
}