Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dropzone.cpp

Go to the documentation of this file.
00001 //
00002 //    CardLib - DropZone class
00003 //
00004 //    Freeware
00005 //    Copyright J Brown 2001
00006 //
00007 #include <windows.h>
00008 
00009 #include "cardlib.h"
00010 #include "cardwindow.h"
00011 #include "dropzone.h"
00012 
00013 bool CardWindow::RegisterDropZone(int id, RECT *rect, pDropZoneProc proc)
00014 {
00015     if(nNumDropZones == MAXDROPZONES)
00016         return false;
00017 
00018     DropZone *dz = new DropZone(id, rect, proc);
00019 
00020     dropzone[nNumDropZones++] = dz;
00021 
00022     return false;
00023 }
00024 
00025 DropZone *CardWindow::GetDropZoneFromRect(RECT *rect)
00026 {
00027     for(int i = 0; i < nNumDropZones; i++)
00028     {
00029         RECT inter;
00030         RECT zone;
00031 
00032         //if any part of the drag rectangle falls within a drop zone,
00033         //let that take priority over any other card stack.
00034         dropzone[i]->GetZone(&zone);
00035 
00036         if(IntersectRect(&inter, rect, &zone))
00037         {
00038             //see if the callback wants us to drop a card on
00039             //a particular stack
00040             return dropzone[i];
00041         }
00042     }
00043 
00044     return 0;
00045 }
00046 
00047 bool CardWindow::DeleteDropZone(int id)
00048 {
00049     for(int i = 0; i < nNumDropZones; i++)
00050     {
00051         if(dropzone[i]->id == id)
00052         {
00053             DropZone *dz = dropzone[i];
00054 
00055             //shift any after this one backwards
00056             for(int j = i; j < nNumDropZones - 1; j++)
00057             {
00058                 dropzone[j] = dropzone[j + 1];
00059             }
00060 
00061             delete dz;
00062             nNumDropZones--;
00063             return true;
00064         }
00065     }
00066 
00067     return false;
00068 }
00069 

Generated on Thu Feb 9 04:59:29 2012 for ReactOS by doxygen 1.6.3

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.