2 * @file creaPanelButtonContainer.h
3 * @brief implements PanelButtonContainer class
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 #include "creaPanelButtonContainer.h"
10 namespace creaPanelButtonContainer
12 BEGIN_EVENT_TABLE(PanelButtonContainer,wxPanel)
13 //(*EventTable(ButtonContainerPanel)
16 // ----------------------------------------------------------------------------------
17 typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer > TConcreteFunctor;
18 // ----------------------------------------------------------------------------------
19 PanelButtonContainer::PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings )
20 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
22 this->m_ButtonContainerSettings = bcSettings;
23 this->m_ButtonPanel = new wxPanel( this );
25 //Class that manages the event!!!
27 TConcreteFunctor* functor = new TConcreteFunctor( this, &PanelButtonContainer::GenericButtonEvent );
28 // TConcreteFunctor* functor = new TConcreteFunctor( this->m_ButtonPanel, &PanelButtonContainer::GenericButtonEvent );
29 //end of the event definition
31 this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
33 //Using AuiManager to Manage the Panels
34 this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
36 this->m_AuiManager->AddPane(this->m_ButtonPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
37 //CartoButtonPanel Management
38 this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(_("creaButtonContainer") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );
39 this->m_AuiManager->Update( );
41 // ----------------------------------------------------------------------------------
42 PanelButtonContainer::~PanelButtonContainer( )
45 // ----------------------------------------------------------------------------------
47 PanelButtonContainer::UpdatePanel( const std::string &buttonName )
51 //Hiding the last CartoSettingsPanel
52 this->m_ButtonPanel->Show( false );
53 //Finding the CartoSettingsPanel of the ButtonClicket
54 this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(buttonName );
55 //changing the parent of the panel!
56 if ( this->m_ButtonPanel->GetParent( ) != this )
58 this->m_ButtonPanel->Reparent( this );
60 //CartoSettingsPanel Management
61 this->m_AuiManager->GetPane( _T("ButtonPanel") ).window = this->m_ButtonPanel;
62 //Updating the manager
63 this->m_AuiManager->Update( );
65 catch ( const std::exception& e )
68 << "PanelButtonContainer::UpdatePanel( const std::string &buttonName )"
69 << "exception: " << e.what( ) << std::endl;
70 std::cout << "Maybe the panel of the button is NULL" << std::endl;
74 // ----------------------------------------------------------------------------------
76 PanelButtonContainer::GenericButtonEvent( const std::string &buttonName )
78 this->UpdatePanel( buttonName );
80 // ----------------------------------------------------------------------------------