Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencardregion.hGo to the documentation of this file.00001 #ifndef CARDREGION_INCLUDED 00002 #define CARDREGION_INCLUDED 00003 00004 #include "globals.h" 00005 #include "cardstack.h" 00006 #include "cardlib.h" 00007 00008 class CardWindow; 00009 00010 // 00011 // This class defines a physical card-stack, 00012 // which draws the cards, supports 00013 // 00014 00015 class CardRegion 00016 { 00017 friend class CardWindow; 00018 friend class CardStack; 00019 00020 // 00021 // Constructor is PRIVATE - only 00022 // a CardWindow can create cardstacks! 00023 // 00024 CardRegion(CardWindow &parent, int id, bool fVisible, 00025 int x, int y, int xOffset, int yOffset); 00026 00027 ~CardRegion(); 00028 00029 public: 00030 00031 void SetBackColor(COLORREF cr); 00032 00033 void SetCardStack(const CardStack &cs); 00034 const CardStack & GetCardStack(); 00035 00036 // 00037 // Event-callback support 00038 // 00039 bool SetDragRule(UINT uDragType, pCanDragProc proc = 0); 00040 bool SetDropRule(UINT uDropType, pCanDropProc proc = 0); 00041 00042 void SetClickProc (pClickProc proc); 00043 void SetClickReleaseProc (pClickProc proc); 00044 void SetDblClickProc (pClickProc proc); 00045 00046 void SetAddCardProc (pAddProc proc); 00047 void SetRemoveCardProc (pRemoveProc proc); 00048 00049 // 00050 // Physical attribute support 00051 // 00052 bool SetThreedCount (int count); 00053 void SetOffsets (int x, int y); 00054 void SetPos (int x, int y); 00055 void Show (bool fShow); 00056 bool IsVisible (); 00057 00058 void SetEmptyImage (UINT uImage); 00059 void SetBackCardIdx (UINT uBackIdx); 00060 void SetPlacement (UINT xJustify, UINT yJustify, int xAdjust, int yAdjust); 00061 00062 void Update(); 00063 void Redraw(); 00064 00065 void SetFaceDirection(UINT uDirType, int nOption); 00066 UINT GetFaceDirection(int *pnOption); 00067 00068 void Flash(int count, int timeout); 00069 void StopFlash(); 00070 00071 int Id(); 00072 00073 CardWindow &GetCardWindow() { return parentWnd; } 00074 00075 bool PlayCard(CardRegion *pDestStack, int value, int num); 00076 bool MoveCard(CardRegion *pDestStack, int nNumCards, bool fAnimate); 00077 bool SimulateDrag(CardRegion *pDestStack, int nNumCards, bool fAnimate); 00078 00079 bool Lock(); 00080 bool UnLock(); 00081 00082 // 00083 // Common wrappers for the CardStack object 00084 // 00085 int NumCards() const; 00086 void NewDeck() { cardstack.NewDeck(); } 00087 void Shuffle() { cardstack.Shuffle(); } 00088 void Clear() { cardstack.Clear(); } 00089 00090 void Reverse() { cardstack.Reverse(); } 00091 00092 void Push(const Card card) { cardstack.Push(card); } 00093 void Push(const CardStack &cs) { cardstack.Push(cs); } 00094 00095 Card Pop() { return cardstack.Pop(); } 00096 CardStack Pop(int items) { return cardstack.Pop(items); } 00097 00098 Card Top() { return cardstack.Top(); } 00099 CardStack Top(int items) { return cardstack.Top(items); } 00100 00101 00102 private: 00103 00104 void DoFlash(); 00105 void RedrawIfNotDim(CardRegion *compare, bool fFullRedraw); 00106 00107 void UpdateFaceDir(CardStack &cards); 00108 void Clip(HDC hdc); 00109 void Render(HDC hdc); 00110 int GetOverlapRatio(int x, int y, int width, int height); 00111 00112 void MoveDragCardTo(HDC hdc, int x, int y); 00113 void ZoomCard(HDC hdc, int xpos, int ypos, CardRegion *dest); 00114 00115 void RenderBottomMost(HDC hdc, int minustopmost = 0); 00116 void PrepareDragBitmaps(int numtodrag); 00117 void PrepareDragBitmapsThreed(int numtodrag); 00118 void ReleaseDragBitmaps(void); 00119 00120 bool CanDragCards(int iNumCards); 00121 bool CanDropCards(CardStack &cards); 00122 00123 void CalcApparentCards(); 00124 int CalcApparentCards(int realnum); 00125 00126 void UpdateSize(); 00127 void AdjustPosition(int winwidth, int winheight); 00128 00129 bool IsPointInStack(int x, int y); 00130 00131 int GetNumDragCards(int x, int y); 00132 bool OnLButtonDown(int x, int y); 00133 bool OnLButtonDblClk(int x, int y); 00134 bool OnMouseMove(int x, int y); 00135 bool OnLButtonUp(int x, int y); 00136 void ClickRelease(int x, int y); 00137 00138 00139 // 00140 // Private data members 00141 // 00142 00143 int id; 00144 00145 CardWindow &parentWnd; 00146 00147 CardStack cardstack; //cards in this stack 00148 CardStack dragstack; //cards which we might be dragging 00149 00150 bool fMouseDragging; 00151 00152 int xpos; //coordinates of stack 00153 int ypos; 00154 00155 int xoffset; //direction that cards take 00156 int yoffset; 00157 00158 int width; //stack-size of all cards 00159 int height; 00160 00161 // 00162 // justify / placement vars 00163 int xjustify; 00164 int yjustify; 00165 int xadjust; 00166 int yadjust; 00167 00168 // 00169 // Used for mouse-dragging / moving cards 00170 // 00171 int iNumDragCards; 00172 int mousexoffset; 00173 int mouseyoffset; 00174 int oldx; 00175 int oldy; 00176 00177 int nDragCardWidth; 00178 int nDragCardHeight; 00179 00180 HDC hdcBackGnd; 00181 HBITMAP hbmBackGnd; 00182 HDC hdcDragCard; 00183 HBITMAP hbmDragCard; 00184 00185 int nNumApparentCards; 00186 int nThreedCount; 00187 bool fVisible; 00188 00189 int nFlashCount; 00190 bool fFlashVisible; 00191 UINT uFlashTimer; 00192 00193 COLORREF crBackgnd; 00194 00195 UINT uEmptyImage; 00196 UINT uFaceDirType; 00197 int nFaceDirOption; 00198 int nBackCardIdx; 00199 00200 UINT uDragRule; 00201 UINT uDropRule; 00202 00203 // 00204 // Stack callback support 00205 // 00206 pCanDragProc CanDragCallback; 00207 pCanDropProc CanDropCallback; 00208 pClickProc ClickCallback; 00209 pClickProc ClickReleaseCallback; 00210 pClickProc DblClickCallback; 00211 pAddProc AddCallback; 00212 pRemoveProc RemoveCallback; 00213 00214 //locking mechanism to prevent user dragging etc 00215 HANDLE mxlock; 00216 }; 00217 00218 #endif 00219 Generated on Thu Feb 9 04:59:25 2012 for ReactOS by
1.6.3
|