1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #ifndef OCCVIEWER_VIEWWINDOW_H
20 #define OCCVIEWER_VIEWWINDOW_H
22 #include "OCCViewer_ViewModel.h"
24 #include "SUIT_ViewWindow.h"
26 #include "QtxAction.h"
29 #include <qvaluelist.h>
32 class OCCViewer_ViewPort3d;
35 #pragma warning( disable:4251 )
38 class OCCVIEWER_EXPORT OCCViewer_ViewWindow : public SUIT_ViewWindow
43 enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
44 FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW };
46 OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
47 virtual ~OCCViewer_ViewWindow() {};
49 OCCViewer_ViewPort3d* getViewPort() { return myViewPort; }
51 bool eventFilter(QObject* watched, QEvent* e);
53 QToolBar* getToolBar() { return myToolBar; }
55 void performRestoring( const viewAspect& );
57 virtual void initLayout();
70 void activateWindowFit();
71 void activateRotation();
72 void activatePanning();
73 void activateGlobalPanning();
75 void onMemorizeView();
77 void onTrihedronShow();
78 void setRestoreFlag();
81 void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type);
82 void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type);
86 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
87 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, MemId, RestoreId,
90 typedef QMap<int, QtxAction*> ActionsMap;
94 /* Transformation selected but not started yet */
95 bool transformRequested() const { return ( myOperation != NOTHING ); }
96 void setTransformRequested ( OperationType op );
98 /* Transformation is selected and already started */
99 bool transformInProcess() const { return myEventStarted; }
100 void setTransformInProcess( bool bOn ) { myEventStarted = bOn; }
102 void vpMousePressEvent(QMouseEvent* theEvent);
103 void vpMouseReleaseEvent(QMouseEvent* theEvent);
104 void vpMouseMoveEvent(QMouseEvent* theEvent);
109 void createActions();
110 void createToolBar();
112 virtual OperationType getButtonState(QMouseEvent* theEvent);
114 OperationType myOperation;
115 OCCViewer_Viewer* myModel;
116 OCCViewer_ViewPort3d* myViewPort;
125 bool myEventStarted; // set when transformation is in process
127 bool myDrawRect; // set when a rect is used for selection or magnify
128 bool myEnableDrawMode;
129 bool myPaintersRedrawing; // set to draw with external painters
135 ActionsMap myActionsMap;
141 #pragma warning( default:4251 )