Back to index

salome-gui  6.5.0
QxScene_ViewModel.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "QxScene_ViewModel.h"
00021 #include "QxScene_ViewWindow.h"
00022 #include "QxScene_ViewManager.h"
00023 #include "QxScene_Def.h"
00024 
00025 #include "SUIT_Desktop.h"
00026 #include "SUIT_ViewWindow.h"
00027 #include "SUIT_Session.h"
00028 
00029 #include <qcolordialog.h>
00030 #include <QMenu>
00031 #include <QToolBar>
00032 
00033 //#define _DEVDEBUG_
00034 #include "DebTrace.hxx"
00035 
00039 QxScene_Viewer::QxScene_Viewer()
00040   :SUIT_ViewModel()
00041 {
00042   DEBTRACE("QxScene_Viewer::QxScene_Viewer");
00043 }
00044 
00048 QxScene_Viewer::~QxScene_Viewer() 
00049 {
00050   DEBTRACE("QxScene_Viewer::~QxScene_Viewer");
00051 }
00052 
00053 void QxScene_Viewer::setViewManager( SUIT_ViewManager* mgr)
00054 {
00055   DEBTRACE("QxScene_Viewer::setViewManager");
00056    SUIT_ViewModel::setViewManager( mgr );
00057 }
00058 
00063 void QxScene_Viewer::initView( QxScene_ViewWindow* view )
00064 {
00065   DEBTRACE("QxScene_Viewer::initView");
00066   if ( view )
00067   {
00068     view->initLayout();
00069   }
00070 }
00071 
00076 SUIT_ViewWindow* QxScene_Viewer::createView(SUIT_Desktop* theDesktop)
00077 {
00078   DEBTRACE("QxScene_Viewer::createView");
00079   QxScene_ViewWindow* aRes = new QxScene_ViewWindow( theDesktop, this );
00080   initView( aRes );
00081   return aRes;
00082 }
00083 
00087 void QxScene_Viewer::contextMenuPopup(QMenu* thePopup)
00088 {
00089   DEBTRACE("QxScene_Viewer::contextMenuPopup");
00090 }
00091 
00095 void QxScene_Viewer::onChangeBgColor()
00096 {
00097   QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView());
00098   if( !aView )
00099     return;
00100   QColor aColorActive = aView->backgroundColor();
00101 
00102   QColor selColor = QColorDialog::getColor( aColorActive, aView);
00103   if ( selColor.isValid() )
00104     aView->setBackgroundColor(selColor);
00105 }
00106 
00110 void QxScene_Viewer::onShowToolbar()
00111 {
00112   QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView());
00113   if ( aView )
00114     aView->getToolBar()->show();    
00115 }