]> Shamusworld >> Repos - architektonas/blob - src/object.h
Added new About logo, beginnings of generic rotation tool.
[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 QPainter;
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(QPainter *);
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 //Hm.           Object * Connect(Object *);
31
32                 // Class methods
33                 static void SetFixedAngle(bool state = true);
34                 static void SetFixedLength(bool state = true);
35                 static void SetFont(QFont *);
36                 static void SetViewportHeight(int);
37                 static void SetDeleteActive(bool state = true);
38                 static void SetDimensionActive(bool state = true);
39
40         protected:
41                 Vector position;                                        // All objects have a position (doubles as reference point)
42                 Object * parent;
43 //              Pen pen;
44 //              Fill fill;
45                 ObjectState state;
46                 ObjectState oldState;
47                 bool needUpdate;
48                 Dimension * attachedDimension;
49                 std::vector<Object *> connected;
50
51                 // Class variables
52                 static QFont * font;
53                 static bool fixedAngle;
54                 static bool fixedLength;
55                 static int viewportHeight;
56                 static bool deleteActive;
57                 static bool dimensionActive;
58 };
59
60 #endif  // __OBJECT_H__