2 // CardLib - DropZone class
5 // Copyright J Brown 2001
10 #include "cardwindow.h"
13 bool CardWindow::RegisterDropZone(int id
, RECT
*rect
, pDropZoneProc proc
)
15 if(nNumDropZones
== MAXDROPZONES
)
18 DropZone
*dz
= new DropZone(id
, rect
, proc
);
20 dropzone
[nNumDropZones
++] = dz
;
25 DropZone
*CardWindow::GetDropZoneFromRect(RECT
*rect
)
27 for(int i
= 0; i
< nNumDropZones
; i
++)
32 //if any part of the drag rectangle falls within a drop zone,
33 //let that take priority over any other card stack.
34 dropzone
[i
]->GetZone(&zone
);
36 if(IntersectRect(&inter
, rect
, &zone
))
38 //see if the callback wants us to drop a card on
47 bool CardWindow::DeleteDropZone(int id
)
49 for(int i
= 0; i
< nNumDropZones
; i
++)
51 if(dropzone
[i
]->id
== id
)
53 DropZone
*dz
= dropzone
[i
];
55 //shift any after this one backwards
56 for(int j
= i
; j
< nNumDropZones
- 1; j
++)
58 dropzone
[j
] = dropzone
[j
+ 1];