]> Shamusworld >> Repos - architektonas/blob - src/object.h
Added Architektonas drawing file loading/saving infrastructure.
[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                 virtual Vector * GetPointAt(Vector);
30                 ObjectState GetState(void);
31                 void Reparent(Object *);
32                 Dimension * GetAttachedDimension(void);
33 //Hm.           Object * Connect(Object *);
34
35                 // Class methods
36                 static void SetFixedAngle(bool state = true);
37                 static void SetFixedLength(bool state = true);
38                 static void SetFont(QFont *);
39                 static void SetViewportHeight(int);
40                 static void SetDeleteActive(bool state = true);
41                 static void SetDimensionActive(bool state = true);
42                 static void SetSnapMode(bool state = true);
43
44         protected:
45                 Vector position;                                        // All objects have a position (doubles as reference point)
46                 Object * parent;
47 //              Pen pen;
48 //              Fill fill;
49                 ObjectState state;
50                 ObjectState oldState;
51                 bool needUpdate;
52                 Dimension * attachedDimension;
53                 std::vector<Object *> connected;
54
55                 // Class variables
56                 static QFont * font;
57                 static bool fixedAngle;
58                 static bool fixedLength;
59                 static int viewportHeight;
60                 static bool deleteActive;
61                 static bool dimensionActive;
62                 static bool snapToGrid;
63 };
64
65 #endif  // __OBJECT_H__