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;
23 class XGUI_ViewWindow: public QFrame
47 XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType);
49 virtual ~XGUI_ViewWindow();
51 XGUI_ViewPort* viewPort() const
56 XGUI::InteractionStyle interactionStyle() const
58 return myInteractionStyle;
61 void setTransformEnabled(const OperationType, const bool);
62 bool transformEnabled(const OperationType) const;
64 XGUI_ViewBackground background() const;
65 void setBackground(const XGUI_ViewBackground& theBackground);
67 bool closable() const { return myClosable; }
68 void setClosable( const bool isClosable ) { myClosable = isClosable; }
71 void vpTransformationStarted(XGUI_ViewWindow::OperationType type);
72 void vpTransformationFinished(XGUI_ViewWindow::OperationType type);
74 void Show(QShowEvent *);
75 void Hide(QHideEvent *);
76 void maximized(XGUI_ViewWindow*, bool);
79 void tryClosing(XGUI_ViewWindow*);
80 void closed( QMdiSubWindow* );
81 void mousePressed(XGUI_ViewWindow*, QMouseEvent*);
82 void mouseReleased(XGUI_ViewWindow*, QMouseEvent*);
83 void mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*);
84 void mouseMoving(XGUI_ViewWindow*, QMouseEvent*);
85 void keyPressed(XGUI_ViewWindow*, QKeyEvent*);
86 void keyReleased(XGUI_ViewWindow*, QKeyEvent*);
87 void contextMenuRequested(QContextMenuEvent *e);
89 void viewModified(XGUI_ViewWindow*);
90 void viewCloned( QMdiSubWindow* theView );
94 void activateRotation();
95 void activatePanning();
96 void activateWindowFit();
97 void activateGlobalPanning();
114 virtual void resizeEvent(QResizeEvent* theEvent);
116 virtual void changeEvent(QEvent* theEvent);
118 virtual void enterEvent(QEvent* theEvent);
119 virtual void leaveEvent(QEvent* theEvent);
121 virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
128 void updateToolBar();
129 // void repaintToolBar();
134 MinimizedState, MaximizedState, NormalState
137 bool processWindowControls(QObject *theObj, QEvent *theEvent);
138 bool processViewPort(QEvent *theEvent);
140 void vpMousePressEvent(QMouseEvent* theEvent);
141 void vpMouseReleaseEvent(QMouseEvent* theEvent);
142 void vpMouseMoveEvent(QMouseEvent* theEvent);
144 OperationType getButtonState(QMouseEvent* theEvent, XGUI::InteractionStyle theInteractionStyle);
150 bool transformRequested() const;
151 bool setTransformRequested(OperationType);
153 // Transformation is selected and already started
154 bool transformInProcess() const
156 return myEventStarted;
158 void setTransformInProcess(bool bOn)
160 myEventStarted = bOn;
164 XGUI_Viewer* myViewer;
167 ViewerLabel* myGripWgt;
168 XGUI_ViewPort* myViewPort;
169 ViewerToolbar* myViewBar;
170 ViewerToolbar* myWindowBar;
171 QAction* myMinimizeBtn;
172 QAction* myMaximizeBtn;
182 WindowState myLastState;
189 XGUI::InteractionStyle myInteractionStyle;
190 OperationType myOperation;
191 XGUI::Mode2dType my2dMode;
194 bool myDrawRect; // set when a rect is used for selection or magnify
195 bool myEnableDrawMode;
196 bool myRotationPointSelection;
199 bool myEventStarted; // set when transformation is in process
204 XGUI::RotationPointType myCurrPointType;
205 XGUI::RotationPointType myPrevPointType;
207 gp_Pnt mySelectedPoint;
209 XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band
211 typedef QMap<OperationType, bool> MapOfTransformStatus;
212 MapOfTransformStatus myStatus;
217 //******************************************************
218 class ViewerToolbar: public QToolBar
222 ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort)
223 : QToolBar(theParent), myVPort(thePort)
225 setBackgroundRole(QPalette::NoRole);
226 setAttribute(Qt::WA_NoSystemBackground);
227 setAttribute(Qt::WA_PaintOnScreen);
230 void repaintBackground();
233 virtual void paintEvent(QPaintEvent* theEvent);
236 XGUI_ViewPort* myVPort;
239 //******************************************************
240 class ViewerLabel: public QLabel
244 ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort)
245 : QLabel(theParent), myVPort(thePort)
247 setAttribute(Qt::WA_NoSystemBackground);
250 void repaintBackground();
253 virtual void paintEvent(QPaintEvent* theEvent);
256 XGUI_ViewPort* myVPort;