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 // VISU VISUGUI : GUI of VISU component
23 // File : VisuGUI_InputPanel.cxx
24 // Author : Oleg Uvarov
27 #include "VisuGUI_InputPanel.h"
28 #include "VisuGUI_BasePanel.h"
30 #include <QVBoxLayout>
33 * \brief Constructor creates enmpty docable window with invisible QVBox
34 to be used as container of child widgets
36 VisuGUI_InputPanel::VisuGUI_InputPanel( QWidget* theParent )
37 : QtxDockWidget( tr( "WINDOW_TITLE" ), theParent ),
40 myGrp = new QWidget( this );
41 new QVBoxLayout( myGrp );
46 * \brief Destructor: VisuGUI_InputPanel
48 VisuGUI_InputPanel::~VisuGUI_InputPanel()
53 \brief Shows thePanel in input panel. If there is visible
54 panel then it is hidden
55 \param thePanel widget
57 void VisuGUI_InputPanel::showPanel( VisuGUI_BasePanel* thePanel )
62 setUpdatesEnabled( false );
65 myCurrentPanel->hide();
70 if ( !myPanels.contains( thePanel ) )
72 myPanels.insert( thePanel, true );
73 thePanel->setParent( myGrp );
74 myGrp->layout()->addWidget( thePanel );
75 connect( thePanel, SIGNAL( bpClose() ), this, SLOT( onClosePanel() ) );
79 myCurrentPanel = thePanel;
80 myPanels[ thePanel ] = true;
82 setUpdatesEnabled( true );
87 \brief Hides thePanel in input panel.
88 \param thePanel widget
90 void VisuGUI_InputPanel::hidePanel( VisuGUI_BasePanel* thePanel )
92 if ( !thePanel || myCurrentPanel != thePanel )
97 myPanels[ thePanel ] = false;
104 \brief Hide all children panels
106 void VisuGUI_InputPanel::clear()
108 if ( myCurrentPanel )
109 hidePanel( myCurrentPanel );
113 \brief Returns true if no panels are shown
115 bool VisuGUI_InputPanel::isEmpty() const
117 QMap<VisuGUI_BasePanel*, bool>::const_iterator it = myPanels.begin(), itEnd = myPanels.end();
118 for( ; it != itEnd; ++it )
127 \brief Returns true if the panel is shown
129 bool VisuGUI_InputPanel::isShown( VisuGUI_BasePanel* thePanel ) const
131 return myPanels[ thePanel ];
135 \brief Close panel which emits signal close().
137 void VisuGUI_InputPanel::onClosePanel()
139 if( VisuGUI_BasePanel* aPanel = dynamic_cast<VisuGUI_BasePanel*>( sender() ) )