Salome HOME
Copyrights update 2015.
[modules/gui.git] / src / QxScene / QxScene_ViewManager.cxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "QxScene_ViewManager.h"
21 #include "QxScene_ViewWindow.h"
22
23 //#define _DEVDEBUG_
24 #include "DebTrace.hxx"
25
26 /*!
27   Constructor
28 */
29 QxScene_ViewManager::QxScene_ViewManager( SUIT_Study* theStudy, 
30                                           SUIT_Desktop* theDesktop, 
31                                           SUIT_ViewModel* theViewModel )
32   : SUIT_ViewManager( theStudy, theDesktop, theViewModel )
33 {
34   DEBTRACE("QxScene_ViewManager::QxScene_ViewManager");
35   setTitle( tr( "QXSCENE_VIEW_TITLE" ) );
36 }
37
38 /*!
39   Destructor
40 */
41 QxScene_ViewManager::~QxScene_ViewManager()
42 {
43   DEBTRACE("QxScene_ViewManager::~QxScene_ViewManager");
44 }
45
46
47 /*!
48   Adds new view
49   \param theView - view to be added
50 */
51 bool QxScene_ViewManager::insertView( SUIT_ViewWindow* theView )
52 {
53   DEBTRACE("QxScene_ViewManager::insertView");
54   bool res = SUIT_ViewManager::insertView( theView );
55   return res;
56 }
57
58 /*!
59   Creates new view
60 */
61 void QxScene_ViewManager::createView()
62 {
63   DEBTRACE("QxScene_ViewManager::createView");
64   createViewWindow();
65 }
66
67 /*!
68  *  Method redefined here to allow some housekeeping before closing
69  *  the view (delete a loded schema and everything related).
70  *  If this is not possible, the view is not closed 
71  */
72 void QxScene_ViewManager::closeView(SUIT_ViewWindow* theView)
73 {
74   DEBTRACE("QxScene_ViewManager::closeView");
75   QxScene_ViewWindow *qxview = dynamic_cast<QxScene_ViewWindow*>(theView);
76   bool OKToClose = true;
77   if (!qxview)
78     OKToClose = true;
79   else
80     OKToClose = qxview->closeRequested();
81    if (OKToClose)
82      {
83        DEBTRACE("SUIT View to close");
84        SUIT_ViewManager::closeView(theView);
85        DEBTRACE("SUIT View closed");
86      }
87 }