Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/gui.git] / src / GLViewer / GLViewer_ViewFrame.h
1 //  Copyright (C) 2005 OPEN CASCADE
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
18 //
19 //  Author : OPEN CASCADE
20 //
21
22 // File:      GLViewer_ViewFrame.h
23 // Created:   November, 2004
24
25 /***************************************************************************
26 **  Class:   GLViewer_ViewFrame
27 **  Descr:   Frame window for viewport in QAD-based application
28 **  Module:  QAD
29 **  Created: UI team, 05.09.00
30 ****************************************************************************/
31 #ifndef GLVIEWER_VIEWFRAME_H
32 #define GLVIEWER_VIEWFRAME_H
33
34 #include "SUIT_ViewWindow.h"
35 #include "GLViewer.h"
36
37 class QColor;
38
39 class SUIT_Desktop;
40
41 class GLViewer_Viewer;
42 class GLViewer_ViewPort;
43
44 #include <qaction.h>
45
46 #ifdef WNT
47 #pragma warning( disable:4251 )
48 #endif
49
50 /*! Class GLViewer_ViewFrame
51 *   Frame window for viewport in GLViewer
52 */
53
54 class GLVIEWER_API GLViewer_ViewFrame: public SUIT_ViewWindow
55 {
56   Q_OBJECT
57     
58 public:
59   GLViewer_ViewFrame( SUIT_Desktop* , GLViewer_Viewer* );
60   ~GLViewer_ViewFrame();
61   
62 public:  
63   void                    setViewer( GLViewer_Viewer* );
64   GLViewer_Viewer*        getViewer() const;
65   
66   void                    setViewPort( GLViewer_ViewPort* );
67   GLViewer_ViewPort*      getViewPort() const;
68   
69   void                    setBackgroundColor( const QColor& );
70   QColor                  backgroundColor() const;
71   
72   QSize                   sizeHint() const;
73   
74   virtual void            onUpdate( int );
75
76   virtual QString         getVisualParameters();
77   virtual void            setVisualParameters( const QString& parameters );  
78   
79 signals:
80   void                    vfDrawExternal( QPainter* );
81   void                    vfViewClosing( QCloseEvent* );
82   
83 protected:
84   GLViewer_Viewer*        myViewer;
85   GLViewer_ViewPort*      myVP;
86   
87 public:
88   //ViewType       getTypeView() const { return VIEW_GL; }; 
89   QWidget*       getViewWidget() { return ( QWidget* )getViewPort(); };
90   
91 protected slots:
92   void           onViewDump();
93   void           onViewPan();
94   void           onViewZoom();
95   void           onViewFitAll();
96   void           onViewFitArea();
97   void           onViewFitSelect();
98   void           onViewGlobalPan(); 
99   void           onViewRotate();
100   void           onViewReset();
101   void           onViewFront() {}; 
102   void           onViewBack() {}; 
103   void           onViewRight() {}; 
104   void           onViewLeft() {};     
105   void           onViewBottom() {};
106   void           onViewTop() {};
107   void           onViewTrihedron() {}; 
108   
109 private slots:
110   void           keyEvent( QKeyEvent* );
111   void           mouseEvent( QMouseEvent* );
112   void           wheelEvent( QWheelEvent* );
113   
114 private:
115   void           createActions();
116   void           createToolBar();
117   
118 private:
119   //! Actions ID
120   enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
121   typedef QMap<int, QAction*> ActionsMap;
122   
123 private:
124   ActionsMap       myActionsMap;
125   QToolBar*        myToolBar;
126 };
127
128
129 #ifdef WNT
130 #pragma warning ( default:4251 )
131 #endif
132
133 #endif