Salome HOME
Porting to Mandrake 10.1 and new products:
[modules/kernel.git] / src / SALOMEGUI / QAD_ViewFrame.h
1 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
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   : QAD_ViewFrame.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef QAD_ViewFrame_H
30 #define QAD_ViewFrame_H
31
32 #include "QAD.h"
33 #include "QAD_Application.h"
34 #include "QAD_StudyFrame.h"
35 #include "SALOME_InteractiveObject.hxx"
36 #include "SALOME_Selection.h"
37 #include "SALOME_Prs.h"
38
39 class QAD_Study;
40
41 // QT Include
42 #include <qmainwindow.h>
43
44
45 class QAD_EXPORT QAD_ViewFrame : public QMainWindow, public SALOME_View
46 {
47   Q_OBJECT
48
49 public:
50   QAD_ViewFrame(QWidget* parent, const QString& title);
51   QAD_ViewFrame(QWidget* parent = 0);
52   virtual ~QAD_ViewFrame();
53
54   bool                   event ( QEvent* e );
55
56   void                   cleanup();
57
58   virtual ViewType       getTypeView() const = 0; 
59   virtual QWidget*       getViewWidget() = 0;
60
61   virtual void           setBackgroundColor( const QColor& ) = 0;
62   virtual QColor         backgroundColor() const = 0;
63
64   virtual void           SetSelectionMode( Selection_Mode mode ) = 0;
65   
66   virtual void           onAdjustTrihedron() = 0; 
67
68   /*  popup management */
69   virtual void           setPopupServer( QAD_Application* ) = 0;
70
71   /*  interactive object management */
72   virtual void           highlight( const Handle(SALOME_InteractiveObject)& IObject, 
73                                     bool highlight, bool immediatly = true ) = 0;
74   virtual void           unHighlightAll() = 0;
75   virtual void           rename( const Handle(SALOME_InteractiveObject)& IObject,
76                                  QString newName ) = 0;
77   virtual bool           isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) = 0;
78   virtual bool           isVisible( const Handle(SALOME_InteractiveObject)& IObject ) = 0;
79
80   /*  undo/redo management */
81   virtual void           undo(QAD_Study* aStudy, const char* StudyFrameEntry) {}
82   virtual void           redo(QAD_Study* aStudy, const char* StudyFrameEntry) {}
83
84   /* selection */
85   virtual Handle(SALOME_InteractiveObject)   FindIObject(const char* Entry) = 0;
86
87   /* display */         
88   virtual void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true) = 0;
89   virtual void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject) = 0;
90   virtual void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true) = 0;
91   virtual void           DisplayAll() = 0;
92   virtual void           EraseAll() = 0;
93   virtual void           Repaint() = 0;
94
95   /* activation */
96   virtual void           Activate( QAD_Study* ) {}
97   // this method is called when parent window of view frame is activated
98
99 public slots:
100   /* basic view operations,
101      most of them are pure virtual
102      and should be redefined in derived classes
103   */
104   virtual void           onViewPan() = 0; 
105   virtual void           onViewZoom() = 0;
106   virtual void           onViewFitAll() = 0;
107   virtual void           onViewFitArea() = 0;
108   virtual void           onViewGlobalPan() = 0; 
109   virtual void           onViewRotate() = 0;
110   virtual void           onViewReset() = 0;     
111   virtual void           onViewFront() = 0; 
112   virtual void           onViewBack() = 0; 
113   virtual void           onViewRight() = 0; 
114   virtual void           onViewLeft() = 0;     
115   virtual void           onViewBottom() = 0;
116   virtual void           onViewTop() = 0;
117   virtual void           onViewTrihedron() = 0; 
118   virtual void           onViewDump();
119
120   /* view incremental transformation operations.
121      virtual, can be redefined in derived classes
122   */
123   virtual void           onPanLeft()     {}
124   virtual void           onPanRight()    {}
125   virtual void           onPanUp()       {}
126   virtual void           onPanDown()     {}
127   virtual void           onZoomIn()      {}
128   virtual void           onZoomOut()     {}
129   virtual void           onRotateLeft()  {}
130   virtual void           onRotateRight() {}
131   virtual void           onRotateUp()    {}
132   virtual void           onRotateDown()  {}
133
134   /* the next slot is used for dumping viewer contents to the image file;
135      called from the context popup menu
136   */
137   void                   onProcessViewDump();
138 };
139
140 #endif
141