Salome HOME
Part of code inserting data model of new loaded module now is described as method...
[modules/gui.git] / src / SUPERVGraph / SUPERVGraph_ViewFrame.cxx
1 //  SALOME SUPERVGraph : build Supervisor viewer into 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   : SUPERVGraph_ViewFrame.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 #include "SUPERVGraph_ViewFrame.h"
30
31 #include "utilities.h"
32
33 //QT Include
34 #include <qlayout.h>
35 #include <qcolordialog.h>
36
37 using namespace std;
38
39
40 SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
41 {
42   init(theParent);
43 }
44
45 SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
46 {
47   init(theParent);
48 }
49
50 void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
51 {
52   // to be implemented
53 }
54
55 void SUPERVGraph_View::init( QWidget* theParent )
56 {
57   if ( theParent->inherits( "QMainWindow" ) ) {
58     ( ( QMainWindow* )theParent )->setCentralWidget( this );
59   }
60   else {
61     QBoxLayout* layout = new QVBoxLayout( theParent );
62     layout->addWidget( this );
63   }
64
65 }
66
67 /*!
68     Constructor
69 */
70 SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop ) 
71   : SUIT_ViewWindow( theDesktop )
72 {
73   myView = 0;
74
75   //myView = new SUPERVGraph_View(this); 
76   // Set BackgroundColor
77   /*
78   int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
79   int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
80   int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
81   setBackgroundColor(QColor(R,G,B));*/
82 }
83
84 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
85
86 /*!
87   Returns widget containing 3D-Viewer
88 */
89 SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget()
90 {
91   return myView;
92 }
93
94
95 void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
96 {
97   myView = theView;
98 }
99
100
101 /*!
102   Display/hide Trihedron
103 */
104 void SUPERVGraph_ViewFrame::onViewTrihedron()
105 {
106   MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
107 }
108
109 /*!
110   Provides top projection of the active view
111 */
112 void SUPERVGraph_ViewFrame::onViewTop()
113 {
114   MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
115 }
116
117 /*!
118   Provides bottom projection of the active view
119 */
120 void SUPERVGraph_ViewFrame::onViewBottom()
121 {
122   MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
123 }
124
125 /*!
126   Provides left projection of the active view
127 */
128 void SUPERVGraph_ViewFrame::onViewLeft()    
129 {
130   MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
131 }
132
133 /*!
134   Provides right projection of the active view
135 */
136 void SUPERVGraph_ViewFrame::onViewRight()
137 {
138   MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
139 }
140
141 /*!
142   Provides back projection of the active view
143 */
144 void SUPERVGraph_ViewFrame::onViewBack()
145 {
146   MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
147 }
148
149 /*!
150   Provides front projection of the active view
151 */
152 void SUPERVGraph_ViewFrame::onViewFront()
153 {
154   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
155 }
156
157 /*!
158   Reset the active view
159 */
160 void SUPERVGraph_ViewFrame::onViewReset()    
161 {
162   MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
163     if (myView)
164       myView->ResetView();
165 }
166
167 /*!
168   Rotates the active view
169 */
170 void SUPERVGraph_ViewFrame::onViewRotate()
171 {
172    MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
173 }
174
175 /*!
176   Sets a new center of the active view
177 */
178 void SUPERVGraph_ViewFrame::onViewGlobalPan()
179 {
180    MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
181 }
182
183 /*!
184   Zooms the active view
185 */
186 void SUPERVGraph_ViewFrame::onViewZoom()
187 {
188   MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
189 }
190
191 /*!
192   Moves the active view
193 */
194 void SUPERVGraph_ViewFrame::onViewPan()
195 {
196   MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
197     if (myView != NULL)
198       myView->ActivatePanning();
199 }
200
201 /*!
202   Fits all obejcts within a rectangular area of the active view
203 */
204 void SUPERVGraph_ViewFrame::onViewFitArea()
205 {
206   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
207 }
208
209 /*!
210   Fits all objects in the active view
211 */
212 void SUPERVGraph_ViewFrame::onViewFitAll()
213 {
214   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
215 }
216
217 /*!
218     Set background of the viewport
219 */
220 void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color )
221 {
222     if (myView)
223       myView->setPaletteBackgroundColor(color);
224 }
225
226 /*!
227     Returns background of the viewport
228 */
229 QColor SUPERVGraph_ViewFrame::backgroundColor() const
230 {
231   if (myView)
232     return myView->paletteBackgroundColor();
233   return QMainWindow::backgroundColor();
234 }
235
236 void SUPERVGraph_ViewFrame::onAdjustTrihedron()
237 {
238   MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )  
239 }
240
241 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, 
242                                     QString newName )
243 {
244   MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
245 }
246
247 void SUPERVGraph_ViewFrame::unHighlightAll() 
248 {
249   MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
250 }
251
252 void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject, 
253                                        bool highlight, bool immediatly ) 
254 {
255   MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
256 }
257
258 bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) 
259 {
260   MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
261   return false;
262 }
263
264 bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject ) 
265 {
266   MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
267   return false;
268 }
269
270 void SUPERVGraph_ViewFrame::undo( const _PTR(Study)& aStudy,
271                                   const char* StudyFrameEntry )
272 {
273   MESSAGE ( "SUPERVGraph_ViewFrame::undo" )
274 }
275
276 void SUPERVGraph_ViewFrame::redo( const _PTR(Study)& aStudy,
277                                   const char* StudyFrameEntry )
278 {
279   MESSAGE ( "SUPERVGraph_ViewFrame::redo" )
280 }
281
282 void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent )
283 {
284   QMainWindow::resizeEvent( theEvent );
285   if ( myView ) myView->resizeView( theEvent );
286 }