1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "QxScene_ViewModel.h"
21 #include "QxScene_ViewWindow.h"
22 #include "QxScene_ViewManager.h"
23 #include "QxScene_Def.h"
25 #include "SUIT_Desktop.h"
26 #include "SUIT_ViewWindow.h"
27 #include "SUIT_Session.h"
29 #include <qcolordialog.h>
34 #include "DebTrace.hxx"
39 QxScene_Viewer::QxScene_Viewer()
42 DEBTRACE("QxScene_Viewer::QxScene_Viewer");
48 QxScene_Viewer::~QxScene_Viewer()
50 DEBTRACE("QxScene_Viewer::~QxScene_Viewer");
53 void QxScene_Viewer::setViewManager( SUIT_ViewManager* mgr)
55 DEBTRACE("QxScene_Viewer::setViewManager");
56 SUIT_ViewModel::setViewManager( mgr );
60 Start initialization of view window
61 \param view - view window to be initialized
63 void QxScene_Viewer::initView( QxScene_ViewWindow* view )
65 DEBTRACE("QxScene_Viewer::initView");
73 Creates new view window
74 \param theDesktop - main window of application
76 SUIT_ViewWindow* QxScene_Viewer::createView(SUIT_Desktop* theDesktop)
78 DEBTRACE("QxScene_Viewer::createView");
79 QxScene_ViewWindow* aRes = new QxScene_ViewWindow( theDesktop, this );
85 Builds popup for QxScene viewer
87 void QxScene_Viewer::contextMenuPopup(QMenu* thePopup)
89 DEBTRACE("QxScene_Viewer::contextMenuPopup");
93 SLOT: called if background color is to be changed changed, passes new color to current canvas view
95 void QxScene_Viewer::onChangeBgColor()
97 QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView());
100 QColor aColorActive = aView->backgroundColor();
102 QColor selColor = QColorDialog::getColor( aColorActive, aView);
103 if ( selColor.isValid() )
104 aView->setBackgroundColor(selColor);
108 SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
110 void QxScene_Viewer::onShowToolbar()
112 QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView());
114 aView->getToolBar()->show();