Salome HOME
Fix for problem with table of contents resizing.
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewPort3d.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
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.
7 // 
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef OCCVIEWER_VIEWPORT3D_H
20 #define OCCVIEWER_VIEWPORT3D_H
21
22 #include "OCCViewer_ViewPort.h"
23
24 #include <qcolor.h>
25
26 #include <V3d_View.hxx>
27 #include <V3d_Viewer.hxx>
28
29 class QRect;
30
31 class OCCVIEWER_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort
32 {
33         Q_OBJECT
34
35   friend class OCCViewer_ViewTransformer;
36
37 public:
38         OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC );
39         virtual ~OCCViewer_ViewPort3d();
40
41 public:
42         Handle(V3d_View)        getView() const;
43   Handle(V3d_View)                  setView( const Handle(V3d_View)& );
44         Handle(V3d_Viewer)      getViewer() const;
45
46   void setAnimationMode(bool theDegenerated);
47
48         virtual void                    setBackgroundColor( const QColor& color);
49   virtual QColor        backgroundColor() const;
50
51 //   void         setActive( V3d_TypeOfView );
52   virtual bool syncronize( const OCCViewer_ViewPort3d* );
53
54   double getZSize() const;
55   void   setZSize( double );
56
57   virtual void onUpdate();
58
59   // TRANSFORMATIONS
60   virtual void          reset();
61   virtual void          pan( int , int );
62         virtual void            setCenter( int , int );
63         virtual void            fitRect( const QRect& );
64         virtual void            zoom( int, int, int, int );
65   virtual void          fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
66
67         void                    startRotation( int, int );
68         void                    rotate( int, int );
69         void                    endRotation();
70
71 protected:
72     // EVENTS
73         virtual void                    paintEvent( QPaintEvent* );
74   virtual void      resizeEvent( QResizeEvent* );
75
76 private:
77         Handle(V3d_View) activeView() const;
78         Handle(V3d_View) inactiveView() const;
79         bool             mapView( const Handle(V3d_View)& );
80         bool               setWindow( const Handle(V3d_View)& );
81         bool                                       mapped( const Handle(V3d_View)& ) const;
82
83 private:
84   Handle(V3d_View)              myOrthoView;
85   Handle(V3d_View)              myPerspView;
86   Handle(V3d_View)              myActiveView;
87         bool            myDegenerated;
88   bool    myAnimate;
89         double  myScale;
90 };
91
92 #endif