Salome HOME
18d17263197423caab66e78174ebefd8267635d7
[modules/gui.git] / 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 class QtxAction;
22 class GLViewer_Viewer;
23 class GLViewer_ViewPort;
24
25 #ifdef WNT
26 #pragma warning( disable:4251 )
27 #endif
28
29 class GLVIEWER_EXPORT GLViewer_ViewFrame: public SUIT_ViewWindow
30 {
31   Q_OBJECT
32     
33 public:
34   GLViewer_ViewFrame( SUIT_Desktop* , GLViewer_Viewer* );
35   ~GLViewer_ViewFrame();
36   
37 public:
38   void                    setViewer( GLViewer_Viewer* );
39   GLViewer_Viewer*        getViewer() const;
40   
41   void                    setViewPort( GLViewer_ViewPort* );
42   GLViewer_ViewPort*      getViewPort() const;
43   
44   void                    setBackgroundColor( const QColor& );
45   QColor                  backgroundColor() const;
46   
47   QSize                   sizeHint() const;
48   
49   virtual void            onUpdate( int );
50   
51 signals:
52   void                    vfDrawExternal( QPainter* );
53   void                    vfViewClosing( QCloseEvent* );
54   
55 protected:
56   GLViewer_Viewer*        myViewer;
57   GLViewer_ViewPort*      myVP;
58   
59 public:
60   //ViewType       getTypeView() const { return VIEW_GL; }; 
61   QWidget*       getViewWidget() { return ( QWidget* )getViewPort(); };
62   
63 protected slots:
64   void           onViewDump();
65   void           onViewPan();
66   void           onViewZoom();
67   void           onViewFitAll();
68   void           onViewFitArea();
69   void           onViewFitSelect();
70   void           onViewGlobalPan(); 
71   void           onViewRotate();
72   void           onViewReset();
73   void           onViewFront() {}; 
74   void           onViewBack() {}; 
75   void           onViewRight() {}; 
76   void           onViewLeft() {};     
77   void           onViewBottom() {};
78   void           onViewTop() {};
79   void           onViewTrihedron() {}; 
80   
81 private slots:
82   void           keyEvent( QKeyEvent* );
83   void           mouseEvent( QMouseEvent* );
84   void           wheelEvent( QWheelEvent* );
85   
86 private:
87   void           createActions();
88   void           createToolBar();
89   
90 private:
91   enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
92   typedef QMap<int, QtxAction*> ActionsMap;
93   
94 private:
95   ActionsMap       myActionsMap;
96   QToolBar*        myToolBar;
97 };
98
99
100 #ifdef WNT
101 #pragma warning ( default:4251 )
102 #endif
103
104 #endif