]> Shamusworld >> Repos - architektonas/blob - src/object.h
Fixed Line rendering to keep attached Dimensions correct length with 'Fix Len'
[architektonas] / src / object.h
1 #ifndef __OBJECT_H__
2 #define __OBJECT_H__
3
4 #include "vector.h"
5
6 class QPainter;
7 class QFont;
8 class Dimension;
9
10 enum ObjectState { OSInactive, OSSelected };
11
12 class Object
13 {
14         public:
15                 Object();
16                 Object(Vector, Object * passedInParent = 0);
17                 ~Object();
18
19                 virtual void Draw(QPainter *);
20                 virtual Vector Center(void);
21                 virtual bool Collided(Vector);
22                 virtual void PointerMoved(Vector);
23                 virtual void PointerReleased(void);
24                 virtual bool NeedsUpdate(void);
25                 virtual void Transmute(Object *, Object *);
26                 ObjectState GetState(void);
27
28                 // Class methods
29                 static void SetFixedAngle(bool state = true);
30                 static void SetFixedLength(bool state = true);
31                 static void SetFont(QFont *);
32                 static void SetViewportHeight(int);
33
34         protected:
35                 Vector position;                                        // All objects have a position (doubles as reference point)
36                 Object * parent;
37 //              Pen pen;
38 //              Fill fill;
39                 ObjectState state;
40                 ObjectState oldState;
41                 bool needUpdate;
42                 Dimension * dimPoint1;
43                 Dimension * dimPoint2;
44
45                 // Class variables
46                 static QFont * font;
47                 static bool fixedAngle;
48                 static bool fixedLength;
49                 static int viewportHeight;
50 };
51
52 #endif  // __OBJECT_H__