GME  13
ModelGrid.h
Go to the documentation of this file.
00001 #ifndef _MODELGRID_INCLUDED_
00002 #define _MODELGRID_INCLUDED_
00003 
00004 class CModelGrid {
00005 public:
00006         CModelGrid();
00007 private:
00008         CGMEView *view;
00009 #ifdef GRIDBITS
00010         unsigned int grid[GME_MAX_GRID_DIM][GME_MAX_GRID_DIM / (8 * sizeof(int))];
00011 #else
00012         bool grid[GME_MAX_GRID_DIM][GME_MAX_GRID_DIM];
00013 #endif
00014         int width;
00015         int height;
00016 public:
00017         CGMEView *GetSource()                           { return view; }
00018         void SetSource(CGMEView *vw)            { view = vw; }
00019 
00020         void Clear();
00021         
00022         void Set(CGuiObject *model,bool reset = FALSE, int aspIdx = -1);//last param introd by zolmol
00023         void Reset(CGuiObject *model);
00024 
00025         bool IsAvailable(CGuiObject *model, int aspIdx = -1);
00026         bool GetClosestAvailable(CGuiObject *model, CRect &pt, int aspIdx = -1);//last param introd by zolmol
00027         
00028         bool CanNudge(CGuiObject *model,int right,int down);    
00029 
00030 private:
00031         
00032         void Set(int x,int y);
00033         void Reset(int x,int y);
00034         bool IsAvailable(int x,int y);
00035 
00036         void Set(CRect& rect, bool reset = FALSE);
00037         bool IsAvailable(const CRect& rect);
00038         bool IsAvailableG(CPoint &pt,CSize &size);
00039 
00040         bool GetClosestAvailable(CRect& rect);
00041 };
00042 
00043 #endif // whole file