1 #ifndef DROPZONE_INCLUDED 2 #define DROPZONE_INCLUDED 3 4 // 5 // define a drop-zone, which can be used to over-ride 6 // drop-behaviour for any card stacks which fall under it 7 // 8 9 class CardStack; 10 11 class DropZone 12 { 13 friend class CardWindow; 14 15 DropZone(int Id, RECT *rect, pDropZoneProc proc) : 16 id(Id), DropZoneCallback(proc) { CopyRect(&zone, rect); } 17 18 public: 19 20 void SetZone(RECT *rect) { CopyRect(&zone, rect); } 21 void GetZone(RECT *rect) { CopyRect(rect, &zone); } 22 void SetCallback(pDropZoneProc callback) { DropZoneCallback = callback; } 23 24 int DropCards(CardStack &cardstack) 25 { 26 if(DropZoneCallback) 27 return DropZoneCallback(id, cardstack); 28 else 29 return -1; 30 } 31 32 private: 33 34 int id; 35 RECT zone; 36 pDropZoneProc DropZoneCallback; 37 }; 38 39 #endif /* DROPZONE_INCLUDED */ 40