]> Shamusworld >> Repos - architektonas/blob - src/line.h
Added Architektonas drawing file loading/saving infrastructure.
[architektonas] / src / line.h
1 #ifndef __LINE_H__
2 #define __LINE_H__
3
4 #include "object.h"
5
6 class Dimension;
7
8 class Line: public Object
9 {
10         public:
11                 Line(Vector, Vector, Object * p = 0);
12                 ~Line();
13
14                 virtual void Draw(Painter *);
15                 virtual Vector Center(void);
16                 virtual bool Collided(Vector);
17                 virtual void PointerMoved(Vector);
18                 virtual void PointerReleased(void);
19                 virtual Vector * GetPointAt(Vector);
20 //              void SetDimensionOnPoint1(Dimension *);
21 //              void SetDimensionOnPoint2(Dimension *);
22                 void SetDimensionOnLine(Dimension * d = 0);
23
24         protected:
25                 bool HitTest(Point);
26                 void SaveState(void);
27                 bool StateChanged(void);
28
29         protected:
30                 Vector endpoint;                                        // Starting point is Object::position
31                 Vector oldPoint;                                        // Used for dragging
32
33         private:
34                 bool draggingLine;
35                 bool draggingHandle1;
36                 bool draggingHandle2;
37                 bool objectWasDragged;
38                 double length;
39                 Vector angle;
40                 bool hitPoint1, hitPoint2, hitLine;
41                 bool oldHitPoint1, oldHitPoint2, oldHitLine;
42 };
43
44 #endif  // __LINE_H__