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