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/ or email : webmaster.salome@opencascade.com
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;
39 #pragma warning ( disable:4251 )
43 \class OCCViewer_ViewPort
44 Visualisation canvas of SUIT-based application
46 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
50 friend class OCCViewer_ViewSketcher;
53 OCCViewer_ViewPort( QWidget* parent );
54 virtual ~OCCViewer_ViewPort();
57 void setSketchingEnabled( bool );
58 bool isSketchingEnabled() const;
59 void setTransformEnabled( bool );
60 bool isTransformEnabled() const;
62 virtual QColor backgroundColor() const;
63 virtual void setBackgroundColor( const QColor& );
65 void redrawPainters();
67 virtual void onUpdate();
70 // enum ViewType { Type2D, Type3D };
71 void selectVisualId();
74 virtual void paintEvent( QPaintEvent *);
75 virtual void mouseMoveEvent( QMouseEvent *);
76 virtual void mouseReleaseEvent( QMouseEvent *);
77 virtual void mousePressEvent( QMouseEvent *);
78 virtual void mouseDoubleClickEvent( QMouseEvent *);
79 virtual void keyPressEvent( QKeyEvent *);
80 virtual void keyReleaseEvent( QKeyEvent *);
83 virtual void reset() = 0;
84 virtual void pan( int, int ) = 0;
85 virtual void setCenter( int, int ) = 0;
86 virtual void fitRect( const QRect& ) = 0;
87 virtual void zoom( int, int, int, int ) = 0;
88 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
91 // void onCreatePopup( QPopupMenu* );
92 // void onDestroyPopup( QPopupMenu* );
95 virtual void onChangeBgColor();
98 void vpKeyEvent( QKeyEvent* );
99 void vpMouseEvent( QMouseEvent* );
100 void vpDrawExternal( QPainter* );
101 void vpChangeBGColor( QColor );
108 Handle(Aspect_Window) myWindow;
109 bool myEnableSketching;
110 bool myEnableTransform;
111 bool myPaintersRedrawing; /* set to draw externally */
112 QPtrList<QtxAction> myPopupActions;
115 static int nCounter; /* objects counter */
119 #pragma warning ( default:4251 )