]> Shamusworld >> Repos - architektonas/blob - src/line.h
Beginnings of visual feedback for editing shapes.
[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(QPainter *);
15                 virtual Vector Center(void);
16                 virtual bool Collided(Vector);
17                 virtual void PointerMoved(Vector);
18                 virtual void PointerReleased(void);
19                 void SetDimensionOnPoint1(Dimension *);
20                 void SetDimensionOnPoint2(Dimension *);
21
22         protected:
23                 bool HitTest(Point);
24                 void SaveState(void);
25                 bool StateChanged(void);
26
27         protected:
28                 Vector endpoint;                                        // Starting point is Object::position
29                 Vector oldPoint;                                        // Used for dragging
30
31         private:
32                 bool dragging;
33                 bool draggingHandle1;
34                 bool draggingHandle2;
35                 bool objectWasDragged;
36                 double length;
37                 bool hitPoint1, hitPoint2, hitLine;
38                 bool oldHitPoint1, oldHitPoint2, oldHitLine;
39 };
40
41 #endif  // __LINE_H__