1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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
23 #ifndef OCCVIEWER_VIEWPORT_H
24 #define OCCVIEWER_VIEWPORT_H
26 #include "OCCViewer.h"
28 #include "QtxAction.h"
33 #include <Aspect_Window.hxx>
38 class OCCViewer_ViewSketcher;
41 #pragma warning ( disable:4251 )
45 \class OCCViewer_ViewPort
46 Visualisation canvas of SUIT-based application
48 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
52 friend class OCCViewer_ViewSketcher;
55 OCCViewer_ViewPort( QWidget* parent );
56 virtual ~OCCViewer_ViewPort();
59 void setSketchingEnabled( bool );
60 bool isSketchingEnabled() const;
61 void setTransformEnabled( bool );
62 bool isTransformEnabled() const;
64 virtual QColor backgroundColor() const;
65 virtual void setBackgroundColor( const QColor& );
67 void redrawPainters();
69 virtual void onUpdate();
71 virtual QPaintEngine* paintEngine() const;
74 // enum ViewType { Type2D, Type3D };
75 void selectVisualId();
78 virtual void paintEvent( QPaintEvent *);
79 virtual void mouseMoveEvent( QMouseEvent *);
80 virtual void mouseReleaseEvent( QMouseEvent *);
81 virtual void mousePressEvent( QMouseEvent *);
82 virtual void mouseDoubleClickEvent( QMouseEvent *);
83 virtual void keyPressEvent( QKeyEvent *);
84 virtual void keyReleaseEvent( QKeyEvent *);
87 virtual void reset() = 0;
88 virtual void pan( int, int ) = 0;
89 virtual void setCenter( int, int ) = 0;
90 virtual void fitRect( const QRect& ) = 0;
91 virtual void zoom( int, int, int, int ) = 0;
92 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
95 virtual bool synchronize( OCCViewer_ViewPort* );
98 virtual void onChangeBackground();
101 void vpKeyEvent( QKeyEvent* );
102 void vpMouseEvent( QMouseEvent* );
103 void vpDrawExternal( QPainter* );
104 void vpChangeBGColor( QColor );
105 void vpTransformed( OCCViewer_ViewPort* );
112 Handle(Aspect_Window) myWindow;
113 bool myEnableSketching;
114 bool myEnableTransform;
115 bool myPaintersRedrawing; /* set to draw externally */
116 QList<QtxAction*> myPopupActions;
119 static int nCounter; /* objects counter */
123 #pragma warning ( default:4251 )