1 // Copyright (C) 2007-2010 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.
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 // VISU VISUGUI : GUI of VISU component
21 // File : VisuGUI_InputPanel.cxx
22 // Author : Oleg Uvarov
25 #include "VisuGUI_InputPanel.h"
26 #include "VisuGUI_BasePanel.h"
28 #include <QVBoxLayout>
31 * \brief Constructor creates enmpty docable window with invisible QVBox
32 to be used as container of child widgets
34 VisuGUI_InputPanel::VisuGUI_InputPanel( QWidget* theParent )
35 : QtxDockWidget( tr( "WINDOW_TITLE" ), theParent ),
38 myGrp = new QWidget( this );
39 new QVBoxLayout( myGrp );
44 * \brief Destructor: VisuGUI_InputPanel
46 VisuGUI_InputPanel::~VisuGUI_InputPanel()
51 \brief Shows thePanel in input panel. If there is visible
52 panel then it is hidden
53 \param thePanel widget
55 void VisuGUI_InputPanel::showPanel( VisuGUI_BasePanel* thePanel )
60 setUpdatesEnabled( false );
63 myCurrentPanel->hide();
68 if ( !myPanels.contains( thePanel ) )
70 myPanels.insert( thePanel, true );
71 thePanel->setParent( myGrp );
72 myGrp->layout()->addWidget( thePanel );
73 connect( thePanel, SIGNAL( bpClose() ), this, SLOT( onClosePanel() ) );
77 myCurrentPanel = thePanel;
78 myPanels[ thePanel ] = true;
80 setUpdatesEnabled( true );
85 \brief Hides thePanel in input panel.
86 \param thePanel widget
88 void VisuGUI_InputPanel::hidePanel( VisuGUI_BasePanel* thePanel )
90 if ( !thePanel || myCurrentPanel != thePanel )
95 myPanels[ thePanel ] = false;
102 \brief Hide all children panels
104 void VisuGUI_InputPanel::clear()
106 if ( myCurrentPanel )
107 hidePanel( myCurrentPanel );
111 \brief Returns true if no panels are shown
113 bool VisuGUI_InputPanel::isEmpty() const
115 QMap<VisuGUI_BasePanel*, bool>::const_iterator it = myPanels.begin(), itEnd = myPanels.end();
116 for( ; it != itEnd; ++it )
125 \brief Returns true if the panel is shown
127 bool VisuGUI_InputPanel::isShown( VisuGUI_BasePanel* thePanel ) const
129 return myPanels[ thePanel ];
133 \brief Close panel which emits signal close().
135 void VisuGUI_InputPanel::onClosePanel()
137 if( VisuGUI_BasePanel* aPanel = dynamic_cast<VisuGUI_BasePanel*>( sender() ) )