Salome HOME
Bug fix: don't set "Loading" state for MacroNodes in InitialState() function (called...
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasView.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE
4 //
5 //  File   : SUPERVGUI_CanvasView.h
6 //  Author : Natalia KOPNOVA
7 //  Module : SUPERV
8
9 #ifndef SUPERVGUI_CanvasView_H
10 #define SUPERVGUI_CanvasView_H
11
12 #include "SUPERVGUI_Canvas.h"
13 #include <qpopupmenu.h>
14
15 //VRV: porting on Qt 3.0.5
16 #if QT_VERSION >= 0x030005
17 #include <qcursor.h> 
18 #endif
19 //VRV: porting on Qt 3.0.5
20
21 class SUPERVGUI_Main;
22 class SUPERVGUI_CanvasLink;
23 class SUPERVGUI_CanvasLinkBuilder;
24
25 class SUPERVGUI_CanvasView: public QCanvasView {
26   Q_OBJECT
27
28   public:
29     SUPERVGUI_CanvasView(SUPERVGUI_Canvas* theCanvas, SUPERVGUI_Main* theMain);
30     virtual ~SUPERVGUI_CanvasView();
31
32     SUPERVGUI_Main* getMain() const { return myMain; }
33     
34     void ActivatePanning();
35     void ResetView();
36
37     bool isAnyLinkCreating() const { return myIsLinkCreating; }
38     void startSketch(SUPERVGUI_CanvasPort* thePort);
39
40   public slots:
41     void addToStudy();
42     void onTimeout();
43     void zoomIn();
44     void zoomOut();
45     void zoomReset();
46     void fitAll();
47     void changeBackground();
48
49   protected:
50     void contentsMouseMoveEvent(QMouseEvent* theEvent);
51     void contentsMouseReleaseEvent(QMouseEvent* theEvent); 
52     void contentsMousePressEvent(QMouseEvent* theEvent); 
53     void contentsMouseDoubleClickEvent(QMouseEvent* theEvent); 
54
55   private slots:
56     void onDestroyed(QObject* theObject);
57   // new link creation
58     void cancelSketch();
59     void deletePoint();
60     void setOrthoMode();
61
62   private:
63     void setHilighted(SUPERVGUI_CanvasLink* theLink);
64     void endSketch(SUPERVGUI_CanvasPort* thePort);
65
66     SUPERVGUI_Main* myMain;
67     QPopupMenu*     myPopup;
68     int             myAddStudyItem;
69     QPopupMenu*     mySketchPopup;
70     int             myDelPntItem;
71     int             myOrtoItem;
72
73     bool         myIsPanBtnClicked;
74     bool         myIsPanActivated;
75     bool         myIsZoomActivated;
76     bool         myIsLinkCreating;
77
78     QCanvasItem* myCurrentItem;
79     QPoint       myPoint;
80     QCursor      myCursor;
81
82     QTimer*  myTimer;   
83     QPoint   myGlobalPoint;
84     int myDX;
85     int myDY;
86
87     SUPERVGUI_CanvasLink* myHilighted;
88     SUPERVGUI_CanvasLinkBuilder* myLinkBuilder;
89 };
90
91 #endif