]> Shamusworld >> Repos - architektonas/blob - src/object.h
In the middle of refactoring objects for loading/saving.
[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 #include <stdio.h>
7
8 class Painter;
9 class QFont;
10 class Dimension;
11 //class FILE;
12
13 enum ObjectState { OSInactive, OSSelected };
14
15 class Object
16 {
17         public:
18                 Object();
19                 Object(Vector, Object * passedInParent = 0);
20                 ~Object();
21
22                 virtual void Draw(Painter *);
23                 virtual Vector Center(void);
24                 virtual bool Collided(Vector);
25                 virtual void PointerMoved(Vector);
26                 virtual void PointerReleased(void);
27                 virtual bool NeedsUpdate(void);
28                 virtual void Transmute(Object *, Object *);
29                 virtual Object * GetParent(void);
30                 virtual void Add(Object *);
31                 virtual Vector * GetPointAt(Vector);
32                 virtual void Enumerate(FILE *);
33                 virtual Object * Copy(void);
34                 ObjectState GetState(void);
35                 void Reparent(Object *);
36                 Dimension * GetAttachedDimension(void);
37 //Hm.           Object * Connect(Object *);
38
39                 // Class methods
40                 static void SetFixedAngle(bool state = true);
41                 static void SetFixedLength(bool state = true);
42                 static void SetFont(QFont *);
43                 static void SetViewportHeight(int);
44                 static void SetDeleteActive(bool state = true);
45                 static void SetDimensionActive(bool state = true);
46                 static void SetSnapMode(bool state = true);
47
48         protected:
49                 Vector position;                                        // All objects have a position (doubles as reference point)
50                 Object * parent;
51 //              Pen pen;
52 //              Fill fill;
53                 ObjectState state;
54                 ObjectState oldState;
55                 bool needUpdate;
56                 Dimension * attachedDimension;
57                 std::vector<Object *> connected;
58
59                 // Class variables
60                 static QFont * font;
61                 static bool fixedAngle;
62                 static bool fixedLength;
63                 static int viewportHeight;
64                 static bool deleteActive;
65                 static bool dimensionActive;
66                 static bool snapToGrid;
67 };
68
69 #endif  // __OBJECT_H__