Salome HOME
updated copyright message
[modules/gui.git] / src / PV3DViewer / PV3DViewer_ViewWindow.cxx
1 // Copyright (C) 2023  CEA, EDF
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 "PV3DViewer_ViewWindow.h"
21 //#include "PV3DViewer_Core.h"
22 //#include "PV3DViewer_GUIElements.h"
23 #include "PV3DViewer_ViewModel.h"
24 #include "PV3DViewer_ViewManager.h"
25
26 #include "SUIT_ViewManager.h"
27 #include "SUIT_ResourceMgr.h"
28 #include "SUIT_Session.h"
29 #include "SUIT_Desktop.h"
30 #include "SUIT_Application.h"
31
32 #include <pqTabbedMultiViewWidget.h>
33 #include <pqApplicationCore.h>
34
35 /*!
36   \brief Constructor.
37   \param theDesktop parent desktop window
38   \param theModel view model
39 */
40 PV3DViewer_ViewWindow::PV3DViewer_ViewWindow( SUIT_Desktop* theDesktop, PV3DViewer_ViewModel* theModel )
41   : SUIT_ViewWindow( theDesktop ), myPVMgr( 0 )
42 {
43   myDesktop = theDesktop;
44   myModel = theModel;
45   setViewManager(myModel->getViewManager());
46 }
47
48 /*!
49   \brief Destructor.
50   As pqViewManager persists through the whole session,
51   the destructor first removes it from the children of this PV3DViewer_ViewWindow
52   to prevent its unexpected deletion.
53 */
54 PV3DViewer_ViewWindow::~PV3DViewer_ViewWindow()
55 {
56   if ( myPVMgr ) {
57     myPVMgr->setParent( nullptr );
58     myPVMgr->hide();
59     myPVMgr = nullptr;
60     setCentralWidget( nullptr );
61   }
62 }
63
64 void PV3DViewer_ViewWindow::removePVMgr()
65 {
66   pqTabbedMultiViewWidget* aPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
67   delete aPVMgr;
68 }
69
70
71 /*!
72   \brief Returns the ParaView multi-view manager previously set with setPVManager()
73 */
74 pqTabbedMultiViewWidget *PV3DViewer_ViewWindow::getMultiViewManager() const
75 {
76   return myPVMgr;
77 }