1 #ifndef XGUI_ViewWindow_H
2 #define XGUI_ViewWindow_H
4 #include "XGUI_Constants.h"
5 #include "XGUI_ViewBackground.h"
13 #include <V3d_View.hxx>
14 #include <V3d_Viewer.hxx>
20 class XGUI_RectRubberBand;
22 class XGUI_ViewWindow: public QFrame
46 XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType);
48 virtual ~XGUI_ViewWindow();
50 XGUI_ViewPort* viewPort() const
55 XGUI::InteractionStyle interactionStyle() const
57 return myInteractionStyle;
60 void setTransformEnabled(const OperationType, const bool);
61 bool transformEnabled(const OperationType) const;
63 XGUI_ViewBackground background() const;
64 void setBackground(const XGUI_ViewBackground& theBackground);
67 void vpTransformationStarted(XGUI_ViewWindow::OperationType type);
68 void vpTransformationFinished(XGUI_ViewWindow::OperationType type);
69 //void viewCloned( XGUI_ViewWindow* );
71 void Show(QShowEvent *);
72 void Hide(QHideEvent *);
73 void maximized(XGUI_ViewWindow*, bool);
76 void tryClosing(XGUI_ViewWindow*);
77 void closing(XGUI_ViewWindow*);
78 void mousePressed(XGUI_ViewWindow*, QMouseEvent*);
79 void mouseReleased(XGUI_ViewWindow*, QMouseEvent*);
80 void mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*);
81 void mouseMoving(XGUI_ViewWindow*, QMouseEvent*);
82 void wheeling(XGUI_ViewWindow*, QWheelEvent*);
83 void keyPressed(XGUI_ViewWindow*, QKeyEvent*);
84 void keyReleased(XGUI_ViewWindow*, QKeyEvent*);
85 void contextMenuRequested(QContextMenuEvent *e);
86 void viewModified(XGUI_ViewWindow*);
90 void activateRotation();
91 void activatePanning();
94 virtual void resizeEvent(QResizeEvent* theEvent);
96 virtual void changeEvent(QEvent* theEvent);
98 virtual void enterEvent(QEvent* theEvent);
99 virtual void leaveEvent(QEvent* theEvent);
101 virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
111 MinimizedState, MaximizedState, NormalState
114 bool processWindowControls(QObject *theObj, QEvent *theEvent);
115 bool processViewPort(QEvent *theEvent);
117 void vpMousePressEvent(QMouseEvent* theEvent);
118 void vpMouseReleaseEvent(QMouseEvent* theEvent);
119 void vpMouseMoveEvent(QMouseEvent* theEvent);
121 OperationType getButtonState(QMouseEvent* theEvent, XGUI::InteractionStyle theInteractionStyle);
127 bool transformRequested() const;
128 bool setTransformRequested(OperationType);
130 // Transformation is selected and already started
131 bool transformInProcess() const
133 return myEventStarted;
135 void setTransformInProcess(bool bOn)
137 myEventStarted = bOn;
141 XGUI_Viewer* myViewer;
144 ViewerLabel* myGripWgt;
145 XGUI_ViewPort* myViewPort;
146 ViewerToolbar* myViewBar;
147 ViewerToolbar* myWindowBar;
148 QAction* myMinimizeBtn;
149 QAction* myMaximizeBtn;
159 WindowState myLastState;
166 XGUI::InteractionStyle myInteractionStyle;
167 OperationType myOperation;
168 XGUI::Mode2dType my2dMode;
171 bool myDrawRect; // set when a rect is used for selection or magnify
172 bool myEnableDrawMode;
173 bool myRotationPointSelection;
176 bool myEventStarted; // set when transformation is in process
180 XGUI::RotationPointType myCurrPointType;
181 XGUI::RotationPointType myPrevPointType;
183 gp_Pnt mySelectedPoint;
185 XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band
187 typedef QMap<OperationType, bool> MapOfTransformStatus;
188 MapOfTransformStatus myStatus;
193 //******************************************************
194 class ViewerToolbar: public QToolBar
198 ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort)
199 : QToolBar(theParent), myVPort(thePort)
204 virtual void paintEvent(QPaintEvent* theEvent);
207 XGUI_ViewPort* myVPort;
210 //******************************************************
211 class ViewerLabel: public QLabel
215 ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort)
216 : QLabel(theParent), myVPort(thePort)
221 virtual void paintEvent(QPaintEvent* theEvent);
224 XGUI_ViewPort* myVPort;