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_VIEWPORT_H
20 #define OCCVIEWER_VIEWPORT_H
22 #include "OCCViewer.h"
24 #include "QtxAction.h"
30 #include <Aspect_Window.hxx>
35 class OCCViewer_ViewSketcher;
36 class OCCViewer_ViewTransformer;
38 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
42 friend class OCCViewer_ViewSketcher;
45 OCCViewer_ViewPort( QWidget* parent );
46 virtual ~OCCViewer_ViewPort();
49 void setSketchingEnabled( bool );
50 bool isSketchingEnabled() const;
51 void setTransformEnabled( bool );
52 bool isTransformEnabled() const;
54 virtual QColor backgroundColor() const;
55 virtual void setBackgroundColor( const QColor& );
57 void redrawPainters();
59 virtual void onUpdate();
62 // enum ViewType { Type2D, Type3D };
63 void selectVisualId();
66 virtual void paintEvent( QPaintEvent *);
67 virtual void mouseMoveEvent( QMouseEvent *);
68 virtual void mouseReleaseEvent( QMouseEvent *);
69 virtual void mousePressEvent( QMouseEvent *);
70 virtual void mouseDoubleClickEvent( QMouseEvent *);
71 virtual void keyPressEvent( QKeyEvent *);
72 virtual void keyReleaseEvent( QKeyEvent *);
75 virtual void reset() = 0;
76 virtual void pan( int, int ) = 0;
77 virtual void setCenter( int, int ) = 0;
78 virtual void fitRect( const QRect& ) = 0;
79 virtual void zoom( int, int, int, int ) = 0;
80 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
83 // void onCreatePopup( QPopupMenu* );
84 // void onDestroyPopup( QPopupMenu* );
87 virtual void onChangeBgColor();
90 void vpKeyEvent( QKeyEvent* );
91 void vpMouseEvent( QMouseEvent* );
92 void vpDrawExternal( QPainter* );
93 void vpChangeBGColor( QColor );
100 Handle(Aspect_Window) myWindow;
101 bool myEnableSketching;
102 bool myEnableTransform;
103 bool myPaintersRedrawing; /* set to draw externally */
104 QPtrList<QtxAction> myPopupActions;
107 static int nCounter; /* objects counter */