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 \class OCCViewer_ViewPort
40 Visualisation canvas of SUIT-based application
42 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
46 friend class OCCViewer_ViewSketcher;
49 OCCViewer_ViewPort( QWidget* parent );
50 virtual ~OCCViewer_ViewPort();
53 void setSketchingEnabled( bool );
54 bool isSketchingEnabled() const;
55 void setTransformEnabled( bool );
56 bool isTransformEnabled() const;
58 virtual QColor backgroundColor() const;
59 virtual void setBackgroundColor( const QColor& );
61 void redrawPainters();
63 virtual void onUpdate();
66 // enum ViewType { Type2D, Type3D };
67 void selectVisualId();
70 virtual void paintEvent( QPaintEvent *);
71 virtual void mouseMoveEvent( QMouseEvent *);
72 virtual void mouseReleaseEvent( QMouseEvent *);
73 virtual void mousePressEvent( QMouseEvent *);
74 virtual void mouseDoubleClickEvent( QMouseEvent *);
75 virtual void keyPressEvent( QKeyEvent *);
76 virtual void keyReleaseEvent( QKeyEvent *);
79 virtual void reset() = 0;
80 virtual void pan( int, int ) = 0;
81 virtual void setCenter( int, int ) = 0;
82 virtual void fitRect( const QRect& ) = 0;
83 virtual void zoom( int, int, int, int ) = 0;
84 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
87 // void onCreatePopup( QPopupMenu* );
88 // void onDestroyPopup( QPopupMenu* );
91 virtual void onChangeBgColor();
94 void vpKeyEvent( QKeyEvent* );
95 void vpMouseEvent( QMouseEvent* );
96 void vpDrawExternal( QPainter* );
97 void vpChangeBGColor( QColor );
104 Handle(Aspect_Window) myWindow;
105 bool myEnableSketching;
106 bool myEnableTransform;
107 bool myPaintersRedrawing; /* set to draw externally */
108 QPtrList<QtxAction> myPopupActions;
111 static int nCounter; /* objects counter */