Salome HOME
Memory Leaks
[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 fitWithinRect();
48     void changeBackground();
49
50   protected:
51     void contentsMouseMoveEvent(QMouseEvent* theEvent);
52     void contentsMouseReleaseEvent(QMouseEvent* theEvent); 
53     void contentsMousePressEvent(QMouseEvent* theEvent); 
54     void contentsMouseDoubleClickEvent(QMouseEvent* theEvent); 
55
56   private slots:
57     void onDestroyed(QObject* theObject);
58   // new link creation
59     void cancelSketch();
60     void deletePoint();
61     void setOrthoMode();
62
63   private:
64     void setHilighted(SUPERVGUI_CanvasLink* theLink);
65     void endSketch(SUPERVGUI_CanvasPort* thePort);
66
67     SUPERVGUI_Main* myMain;
68     QPopupMenu*     myPopup;
69     int             myAddStudyItem;
70     int             myPasteNodeItem;
71     QPopupMenu*     mySketchPopup;
72     int             myDelPntItem;
73     int             myOrtoItem;
74
75     bool         myIsPanBtnClicked;
76     bool         myIsPanActivated;
77     bool         myIsFitWRActivated;
78     bool         myIsZoomActivated;
79     bool         myIsLinkCreating;
80
81     QCanvasItem*      myCurrentItem;
82     QPoint            myPoint;
83     QCanvasRectangle* mySelectedRect;
84     QCursor           myCursor;
85
86     QTimer*  myTimer;   
87     QPoint   myGlobalPoint;
88     int myDX;
89     int myDY;
90
91     SUPERVGUI_CanvasLink* myHilighted;
92     SUPERVGUI_CanvasLinkBuilder* myLinkBuilder;
93 };
94
95 #endif