1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef OCCVIEWER_VIEWPORT_H
23 #define OCCVIEWER_VIEWPORT_H
25 #include "OCCViewer.h"
27 #include "QtxAction.h"
32 #include <Aspect_Window.hxx>
37 class OCCViewer_ViewSketcher;
40 #pragma warning ( disable:4251 )
44 \class OCCViewer_ViewPort
45 Visualisation canvas of SUIT-based application
47 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
51 friend class OCCViewer_ViewSketcher;
54 OCCViewer_ViewPort( QWidget* parent );
55 virtual ~OCCViewer_ViewPort();
58 void setSketchingEnabled( bool );
59 bool isSketchingEnabled() const;
60 void setTransformEnabled( bool );
61 bool isTransformEnabled() const;
63 virtual QColor backgroundColor() const;
64 virtual void setBackgroundColor( const QColor& );
66 void redrawPainters();
68 virtual void onUpdate();
71 // enum ViewType { Type2D, Type3D };
72 void selectVisualId();
75 virtual void paintEvent( QPaintEvent *);
76 virtual void mouseMoveEvent( QMouseEvent *);
77 virtual void mouseReleaseEvent( QMouseEvent *);
78 virtual void mousePressEvent( QMouseEvent *);
79 virtual void mouseDoubleClickEvent( QMouseEvent *);
80 virtual void keyPressEvent( QKeyEvent *);
81 virtual void keyReleaseEvent( QKeyEvent *);
84 virtual void reset() = 0;
85 virtual void pan( int, int ) = 0;
86 virtual void setCenter( int, int ) = 0;
87 virtual void fitRect( const QRect& ) = 0;
88 virtual void zoom( int, int, int, int ) = 0;
89 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
92 // void onCreatePopup( QPopupMenu* );
93 // void onDestroyPopup( QPopupMenu* );
96 virtual void onChangeBgColor();
99 void vpKeyEvent( QKeyEvent* );
100 void vpMouseEvent( QMouseEvent* );
101 void vpDrawExternal( QPainter* );
102 void vpChangeBGColor( QColor );
109 Handle(Aspect_Window) myWindow;
110 bool myEnableSketching;
111 bool myEnableTransform;
112 bool myPaintersRedrawing; /* set to draw externally */
113 QList<QtxAction*> myPopupActions;
116 static int nCounter; /* objects counter */
120 #pragma warning ( default:4251 )