1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "QxScene_ViewModel.h"
23 #include "QxScene_ViewWindow.h"
24 #include "QxScene_ViewManager.h"
25 #include "QxScene_Def.h"
27 #include "SUIT_Desktop.h"
28 #include "SUIT_ViewWindow.h"
29 #include "SUIT_Session.h"
31 #include <qcolordialog.h>
36 #include "DebTrace.hxx"
41 QxScene_Viewer::QxScene_Viewer()
44 DEBTRACE("QxScene_Viewer::QxScene_Viewer");
50 QxScene_Viewer::~QxScene_Viewer()
52 DEBTRACE("QxScene_Viewer::~QxScene_Viewer");
55 void QxScene_Viewer::setViewManager( SUIT_ViewManager* mgr)
57 DEBTRACE("QxScene_Viewer::setViewManager");
58 SUIT_ViewModel::setViewManager( mgr );
62 Start initialization of view window
63 \param view - view window to be initialized
65 void QxScene_Viewer::initView( QxScene_ViewWindow* view )
67 DEBTRACE("QxScene_Viewer::initView");
75 Creates new view window
76 \param theDesktop - main window of application
78 SUIT_ViewWindow* QxScene_Viewer::createView(SUIT_Desktop* theDesktop)
80 DEBTRACE("QxScene_Viewer::createView");
81 QxScene_ViewWindow* aRes = new QxScene_ViewWindow( theDesktop, this );
87 Builds popup for QxScene viewer
89 void QxScene_Viewer::contextMenuPopup(QMenu* thePopup)
91 DEBTRACE("QxScene_Viewer::contextMenuPopup");
95 SLOT: called if background color is to be changed changed, passes new color to current canvas view
97 void QxScene_Viewer::onChangeBgColor()
99 QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView());
102 QColor aColorActive = aView->backgroundColor();
104 QColor selColor = QColorDialog::getColor( aColorActive, aView);
105 if ( selColor.isValid() )
106 aView->setBackgroundColor(selColor);
110 SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
112 void QxScene_Viewer::onShowToolbar()
114 QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView());
116 aView->getToolBar()->show();