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