1 #ifndef XGUI_ViewWindow_H
2 #define XGUI_ViewWindow_H
4 #include "XGUI_Constants.h"
12 #include <V3d_View.hxx>
13 #include <V3d_Viewer.hxx>
19 class XGUI_RectRubberBand;
21 class XGUI_ViewWindow : public QFrame
25 enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
26 PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
27 FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW,
28 CLOCKWISEVIEW, ANTICLOCKWISEVIEW };
30 XGUI_ViewWindow(XGUI_Viewer* theViewer,
31 V3d_TypeOfView theType);
33 virtual ~XGUI_ViewWindow();
35 XGUI_ViewPort* viewPort() const { return myViewPort; }
38 XGUI::InteractionStyle interactionStyle() const { return myInteractionStyle; }
40 void setTransformEnabled( const OperationType, const bool );
41 bool transformEnabled( const OperationType ) const;
44 void vpTransformationStarted(XGUI_ViewWindow::OperationType type);
45 void vpTransformationFinished(XGUI_ViewWindow::OperationType type);
46 //void viewCloned( XGUI_ViewWindow* );
48 void Show( QShowEvent * );
49 void Hide( QHideEvent * );
50 void maximized( XGUI_ViewWindow*, bool );
54 void tryClosing( XGUI_ViewWindow* );
55 void closing( XGUI_ViewWindow* );
56 void mousePressed( XGUI_ViewWindow*, QMouseEvent* );
57 void mouseReleased( XGUI_ViewWindow*, QMouseEvent* );
58 void mouseDoubleClicked( XGUI_ViewWindow*, QMouseEvent* );
59 void mouseMoving( XGUI_ViewWindow*, QMouseEvent* );
60 void wheeling( XGUI_ViewWindow*, QWheelEvent* );
61 void keyPressed( XGUI_ViewWindow*, QKeyEvent* );
62 void keyReleased( XGUI_ViewWindow*, QKeyEvent* );
63 void contextMenuRequested( QContextMenuEvent *e );
64 void viewModified( XGUI_ViewWindow* );
68 void activateRotation();
69 void activatePanning();
72 virtual void resizeEvent(QResizeEvent* theEvent);
74 virtual void changeEvent(QEvent* theEvent);
76 virtual void enterEvent(QEvent* theEvent);
77 virtual void leaveEvent(QEvent* theEvent);
79 virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
87 enum WindowState { MinimizedState, MaximizedState, NormalState };
89 bool processWindowControls(QObject *theObj, QEvent *theEvent);
90 bool processViewPort(QEvent *theEvent);
92 void vpMousePressEvent(QMouseEvent* theEvent);
93 void vpMouseReleaseEvent(QMouseEvent* theEvent);
94 void vpMouseMoveEvent(QMouseEvent* theEvent);
96 OperationType getButtonState(QMouseEvent* theEvent, XGUI::InteractionStyle theInteractionStyle);
102 bool transformRequested() const;
103 bool setTransformRequested ( OperationType );
105 // Transformation is selected and already started
106 bool transformInProcess() const { return myEventStarted; }
107 void setTransformInProcess( bool bOn ) { myEventStarted = bOn; }
110 XGUI_Viewer* myViewer;
113 ViewerLabel* myGripWgt;
114 XGUI_ViewPort* myViewPort;
115 ViewerToolbar* myViewBar;
116 ViewerToolbar* myWindowBar;
117 QAction* myMinimizeBtn;
118 QAction* myMaximizeBtn;
128 WindowState myLastState;
135 XGUI::InteractionStyle myInteractionStyle;
136 OperationType myOperation;
137 XGUI::Mode2dType my2dMode;
140 bool myDrawRect; // set when a rect is used for selection or magnify
141 bool myEnableDrawMode;
142 bool myRotationPointSelection;
145 bool myEventStarted; // set when transformation is in process
149 XGUI::RotationPointType myCurrPointType;
150 XGUI::RotationPointType myPrevPointType;
152 gp_Pnt mySelectedPoint;
154 XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band
156 typedef QMap<OperationType, bool> MapOfTransformStatus;
157 MapOfTransformStatus myStatus;
163 //******************************************************
164 class ViewerToolbar : public QToolBar
168 ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort) :
169 QToolBar(theParent), myVPort(thePort) {}
172 virtual void paintEvent( QPaintEvent* theEvent);
175 XGUI_ViewPort* myVPort;
178 //******************************************************
179 class ViewerLabel : public QLabel
183 ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort) :
184 QLabel(theParent), myVPort(thePort) {}
187 virtual void paintEvent( QPaintEvent* theEvent);
190 XGUI_ViewPort* myVPort;