]> Shamusworld >> Repos - architektonas/blob - src/object.h
Initial stab at proper grid display using background image.
[architektonas] / src / object.h
1 #ifndef __OBJECT_H__
2 #define __OBJECT_H__
3
4 #include <vector>                                                       // This is a container
5 #include "vector.h"                                                     // This is the mathematical construct
6
7 class Painter;
8 class QFont;
9 class Dimension;
10
11 enum ObjectState { OSInactive, OSSelected };
12
13 class Object
14 {
15         public:
16                 Object();
17                 Object(Vector, Object * passedInParent = 0);
18                 ~Object();
19
20                 virtual void Draw(Painter *);
21                 virtual Vector Center(void);
22                 virtual bool Collided(Vector);
23                 virtual void PointerMoved(Vector);
24                 virtual void PointerReleased(void);
25                 virtual bool NeedsUpdate(void);
26                 virtual void Transmute(Object *, Object *);
27                 virtual Object * GetParent(void);
28                 virtual void Add(Object *);
29                 ObjectState GetState(void);
30                 void Reparent(Object *);
31 //Hm.           Object * Connect(Object *);
32
33                 // Class methods
34                 static void SetFixedAngle(bool state = true);
35                 static void SetFixedLength(bool state = true);
36                 static void SetFont(QFont *);
37                 static void SetViewportHeight(int);
38                 static void SetDeleteActive(bool state = true);
39                 static void SetDimensionActive(bool state = true);
40                 static void SetSnapMode(bool state = true);
41
42         protected:
43                 Vector position;                                        // All objects have a position (doubles as reference point)
44                 Object * parent;
45 //              Pen pen;
46 //              Fill fill;
47                 ObjectState state;
48                 ObjectState oldState;
49                 bool needUpdate;
50                 Dimension * attachedDimension;
51                 std::vector<Object *> connected;
52
53                 // Class variables
54                 static QFont * font;
55                 static bool fixedAngle;
56                 static bool fixedLength;
57                 static int viewportHeight;
58                 static bool deleteActive;
59                 static bool dimensionActive;
60                 static bool snapToGrid;
61 };
62
63 #endif  // __OBJECT_H__