Salome HOME
082a6c7f4e4b262ced20870a2fdeffabbd512d91
[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   signals:
41     void objectCreated(); // mkr : PAL8237
42
43   public slots:
44     void addToStudy();
45     void onTimeout();
46     void zoomIn();
47     void zoomOut();
48     void zoomReset();
49     void fitAll();
50     void fitWithinRect();
51     void changeBackground();
52
53   protected:
54     void contentsMouseMoveEvent(QMouseEvent* theEvent);
55     void contentsMouseReleaseEvent(QMouseEvent* theEvent); 
56     void contentsMousePressEvent(QMouseEvent* theEvent); 
57     void contentsMouseDoubleClickEvent(QMouseEvent* theEvent); 
58
59   private slots:
60     void onDestroyed(QObject* theObject);
61   // new link creation
62     void cancelSketch();
63     void deletePoint();
64     void setOrthoMode();
65
66   private:
67     void setHilighted(SUPERVGUI_CanvasLink* theLink);
68     void endSketch(SUPERVGUI_CanvasPort* thePort);
69
70     bool isHavingStreamPort() const;
71
72     SUPERVGUI_Main* myMain;
73     QPopupMenu*     myPopup;
74     int             myAddStudyItem;
75     int             myPasteNodeItem;
76     int             myDSParamsItem;
77     QPopupMenu*     mySketchPopup;
78     int             myDelPntItem;
79     int             myOrtoItem;
80     int             myShowToolBarItem;
81
82     bool         myIsPanBtnClicked;
83     bool         myIsPanActivated;
84     bool         myIsFitWRActivated;
85     bool         myIsZoomActivated;
86     bool         myIsLinkCreating;
87
88     QCanvasItem*      myCurrentItem;
89     QPoint            myPoint;
90     QCanvasRectangle* mySelectedRect;
91     QCursor           myCursor;
92
93     QTimer*  myTimer;   
94     QPoint   myGlobalPoint;
95     int myDX;
96     int myDY;
97
98     SUPERVGUI_CanvasLink* myHilighted;
99     SUPERVGUI_CanvasLinkBuilder* myLinkBuilder;
100 };
101
102 #endif