2 * @file buttonManager.cxx
3 * @brief Implements the ButtonManager class.
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 #include "buttonManager.h"
10 namespace creaButtonContainer
14 // ----------------------------------------------------------------------------------
15 ButtonManager::ButtonManager( ) :
16 wxFlexGridSizer( 0, 1, 0, 0 )
19 // ----------------------------------------------------------------------------------
20 ButtonManager::ButtonManager( ButtonGroup* buttonGroup ) :
21 wxFlexGridSizer( 0, 1, 0, 0 )
25 this->SetGroupName( buttonGroup->GetGroupName( ) );
26 this->SetButtonManager( buttonGroup->GetButtonContainer( ) );
28 catch ( const std::exception& e )
30 std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
33 // ----------------------------------------------------------------------------------
34 ButtonManager::~ButtonManager( )
37 // ----------------------------------------------------------------------------------
39 ButtonManager::SetGroupName( wxStaticText* groupName )
41 this->m_GroupName = groupName;
42 this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
44 // ----------------------------------------------------------------------------------
46 ButtonManager::SetButtonManager( ButtonContainer buttonContainer )
50 if ( this->m_GroupName != NULL )
52 this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 );
53 for( ButtonContainer::iterator it = buttonContainer.begin( ); it
54 != buttonContainer.end( ); ++it )
55 this->m_GridSizer->Add( ( *it ).second, -1,
56 wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
57 this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
60 catch ( const std::exception& e )
63 << "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )"
64 << "exception: " << e.what( ) << std::endl;
67 // ----------------------------------------------------------------------------------
69 ButtonManager::ShowButtonManager( )
71 this->Show( this->m_GridSizer, true, false );
73 // ----------------------------------------------------------------------------------
75 ButtonManager::HideButtonManager( )
77 this->Show( this->m_GridSizer, false, false );
79 // ----------------------------------------------------------------------------------