Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_RubberBand.h
1 #ifndef XGUI_RubberBand_H
2 #define XGUI_RubberBand_H
3
4 #include <QWidget>
5
6 class XGUI_AbstractRubberBand: public QWidget
7 {
8 Q_OBJECT
9 protected:
10   XGUI_AbstractRubberBand(QWidget*);
11
12 public:
13   virtual ~XGUI_AbstractRubberBand();
14
15   virtual void clearGeometry();
16
17   bool isClosed();
18
19 protected:
20   virtual void paintEvent(QPaintEvent*);
21   virtual void showEvent(QShowEvent*);
22   virtual void moveEvent(QMoveEvent*);
23   virtual void resizeEvent(QResizeEvent*);
24
25   virtual bool eventFilter(QObject*, QEvent*);
26
27   virtual void updateMask();
28
29 protected:
30   QPolygon myPoints;
31
32   bool myIsClosed;
33 };
34
35 class XGUI_RectRubberBand: public XGUI_AbstractRubberBand
36 {
37 Q_OBJECT
38
39 public:
40   XGUI_RectRubberBand(QWidget*);
41   virtual ~XGUI_RectRubberBand();
42
43   void initGeometry(const QRect&);
44   void setStartPoint(const QPoint&);
45   void setEndPoint(const QPoint&);
46
47   virtual void clearGeometry();
48 };
49
50 class XGUI_PolyRubberBand: public XGUI_AbstractRubberBand
51 {
52 Q_OBJECT
53
54 public:
55   XGUI_PolyRubberBand(QWidget*);
56   virtual ~XGUI_PolyRubberBand();
57
58   void initGeometry(const QPolygon&);
59   void initGeometry(const QPoint&);
60
61   void addNode(const QPoint&);
62   void replaceLastNode(const QPoint&);
63   void removeLastNode();
64
65   void setClosed(bool);
66 };
67
68 #endif