Salome HOME
NRI : Merge from V1_2.
[modules/kernel.git] / src / OCCViewer / OCCViewer_ViewFrame.h
1 //  SALOME OCCViewer : build OCC Viewer into Salome desktop
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : OCCViewer_ViewFrame.h
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef OCCViewer_ViewFrame_H
30 #define OCCViewer_ViewFrame_H
31
32 #include "OCCViewer_ViewPort.h"
33 #include "QAD_ViewFrame.h"
34
35 class OCCViewer_Viewer3d;
36 class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
37 {
38   Q_OBJECT
39
40  public:
41   OCCViewer_ViewFrame(QWidget* parent, const QString& title);
42   OCCViewer_ViewFrame(QWidget* parent = 0);
43   virtual ~OCCViewer_ViewFrame();
44
45  protected:
46   virtual void      initViewPort();
47   void              initialize();
48   void              cleanup();
49
50  public:
51   ViewType          getTypeView() const{ return VIEW_OCC;};
52   QWidget*          getViewWidget();
53   void              setViewPort(OCCViewer_ViewPort* view);
54   OCCViewer_ViewPort*       getViewPort() const;
55
56   void              setViewer(OCCViewer_Viewer3d* viewer);
57   OCCViewer_Viewer3d*     getViewer() const;
58
59   void              setVisible( bool isVisible = true );
60
61   void              setBackgroundColor( const QColor& );
62   QColor            backgroundColor() const;
63
64   void              setCursor( const QCursor& );
65   QCursor           cursor() const;
66
67   void              SetSelectionMode( int mode ) {};
68
69   void              SetTrihedronSize( int dim );
70
71   /*  popup management */
72   void              setPopupServer( QAD_Application* );
73
74
75   /*  interactive object management */
76   void              highlight( const Handle(SALOME_InteractiveObject)& IObject, 
77                                bool highlight, bool update = true );
78   void              unHighlightAll();
79   void              rename( const Handle(SALOME_InteractiveObject)& IObject,
80                             QString newName );
81   bool              isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
82   bool              isVisible( const Handle(SALOME_InteractiveObject)& IObject );
83
84   /*  undo/redo management */
85   void              undo(SALOMEDS::Study_var aStudy,
86                          const char* StudyFrameEntry);
87   void              redo(SALOMEDS::Study_var aStudy,
88                          const char* StudyFrameEntry);
89
90   /* selection */
91   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
92
93   /* display */         
94   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool update = true);
95   void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject);
96   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update = true);
97   void           DisplayAll();
98   void           EraseAll();
99   void           Repaint();
100
101  protected:     
102   void              closeEvent(QCloseEvent* e);
103   void              resizeEvent(QResizeEvent* e);
104   void              keyPressEvent( QKeyEvent *k );
105
106  signals:
107   void              vfTransformationStarted ( OCCViewer_ViewPort::OperationType );
108   void              vfTransformationFinished( OCCViewer_ViewPort::OperationType );
109   void              vfDrawExternal(QPainter* painter);
110   void              vfMousePress(QMouseEvent*);
111   void              vfMouseRelease(QMouseEvent*);
112   void              vfMouseMove(QMouseEvent*);
113   void              vfMouseDoubleClick(QMouseEvent*);
114   void              vfKeyPress(QKeyEvent*);
115   void              vfKeyRelease(QKeyEvent*);
116   void              vfResize(QResizeEvent*);
117   void              vfPrint(QPaintEvent*);
118   void              vfViewClosing(QCloseEvent*);
119   void              vfMoved (QMoveEvent*);
120
121   public slots:
122
123   void           onViewPan(); 
124   void           onViewZoom();
125   void           onViewFitAll();
126   void           onViewFitArea();
127   void           onViewGlobalPan(); 
128   void           onViewRotate();
129   void           onViewReset();     
130   void           onViewFront(); 
131   void           onViewBack(); 
132   void           onViewRight(); 
133   void           onViewLeft();     
134   void           onViewBottom();
135   void           onViewTop();
136   void           onViewTrihedron(); 
137  
138  protected:
139   OCCViewer_Viewer3d*      myViewer;     // my owner
140   OCCViewer_ViewPort*      myViewPort; // child viewport
141 };
142
143 #endif
144