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