Salome HOME
6c735331690dd9b9c1eb23c8ee7019bdb355d135
[modules/gui.git] / src / GLViewer / GLViewer_ViewFrame.h
1 // File:      GLViewer_ViewFrame.h
2 // Created:   November, 2004
3 // Author:    OCC team
4 // Copyright (C) CEA 2004
5
6 /***************************************************************************
7 **  Class:   GLViewer_ViewFrame
8 **  Descr:   Frame window for viewport in QAD-based application
9 **  Module:  QAD
10 **  Created: UI team, 05.09.00
11 ****************************************************************************/
12 #ifndef GLVIEWER_VIEWFRAME_H
13 #define GLVIEWER_VIEWFRAME_H
14
15 #include "SUIT_ViewWindow.h"
16 #include "GLViewer.h"
17
18 class QColor;
19
20 class SUIT_Desktop;
21
22 class GLViewer_Viewer;
23 class GLViewer_ViewPort;
24
25 #include <qaction.h>
26
27 #ifdef WNT
28 #pragma warning( disable:4251 )
29 #endif
30
31 /*! Class GLViewer_ViewFrame
32 *   Frame window for viewport in GLViewer
33 */
34
35 class GLVIEWER_API GLViewer_ViewFrame: public SUIT_ViewWindow
36 {
37   Q_OBJECT
38     
39 public:
40   GLViewer_ViewFrame( SUIT_Desktop* , GLViewer_Viewer* );
41   ~GLViewer_ViewFrame();
42   
43 public:  
44   void                    setViewer( GLViewer_Viewer* );
45   GLViewer_Viewer*        getViewer() const;
46   
47   void                    setViewPort( GLViewer_ViewPort* );
48   GLViewer_ViewPort*      getViewPort() const;
49   
50   void                    setBackgroundColor( const QColor& );
51   QColor                  backgroundColor() const;
52   
53   QSize                   sizeHint() const;
54   
55   virtual void            onUpdate( int );
56   
57 signals:
58   void                    vfDrawExternal( QPainter* );
59   void                    vfViewClosing( QCloseEvent* );
60   
61 protected:
62   GLViewer_Viewer*        myViewer;
63   GLViewer_ViewPort*      myVP;
64   
65 public:
66   //ViewType       getTypeView() const { return VIEW_GL; }; 
67   QWidget*       getViewWidget() { return ( QWidget* )getViewPort(); };
68   
69 protected slots:
70   void           onViewDump();
71   void           onViewPan();
72   void           onViewZoom();
73   void           onViewFitAll();
74   void           onViewFitArea();
75   void           onViewFitSelect();
76   void           onViewGlobalPan(); 
77   void           onViewRotate();
78   void           onViewReset();
79   void           onViewFront() {}; 
80   void           onViewBack() {}; 
81   void           onViewRight() {}; 
82   void           onViewLeft() {};     
83   void           onViewBottom() {};
84   void           onViewTop() {};
85   void           onViewTrihedron() {}; 
86   
87 private slots:
88   void           keyEvent( QKeyEvent* );
89   void           mouseEvent( QMouseEvent* );
90   void           wheelEvent( QWheelEvent* );
91   
92 private:
93   void           createActions();
94   void           createToolBar();
95   
96 private:
97   //! Actions ID
98   enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
99   typedef QMap<int, QAction*> ActionsMap;
100   
101 private:
102   ActionsMap       myActionsMap;
103   QToolBar*        myToolBar;
104 };
105
106
107 #ifdef WNT
108 #pragma warning ( default:4251 )
109 #endif
110
111 #endif