1 #pragma once
2 
3 #include "igrid.h"
4 
5 class GridItem
6 {
7 		// The grid size this item is representing
8 		GridSize _gridSize;
9 
10 		IGridManager* _manager;
11 
12 	public:
GridItem()13 		GridItem () :
14 			_gridSize(GRID_8), _manager(NULL)
15 		{
16 		}
17 
18 		// Construct this object with a gridsize as argument
GridItem(GridSize gridSize,IGridManager * manager)19 		GridItem (GridSize gridSize, IGridManager* manager) :
20 			_gridSize(gridSize), _manager(manager)
21 		{
22 		}
23 
GridItem(const GridItem & other)24 		GridItem (const GridItem& other) :
25 			_gridSize(other._gridSize), _manager(other._manager)
26 		{
27 		}
28 
29 		// Returns the gridsize of this item
getGridSize()30 		GridSize getGridSize () const
31 		{
32 			return _gridSize;
33 		}
34 
35 		// The callback that triggers the activation of the gridsize contained in this object
activate()36 		void activate ()
37 		{
38 			if (_manager != NULL) {
39 				_manager->setGridSize(_gridSize);
40 			}
41 		}
42 		typedef MemberCaller<GridItem, &GridItem::activate> ActivateCaller;
43 
44 }; // class GridItem
45