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 >
19 // ----------------------------------------------------------------------------------
20 PanelButtonContainer::PanelButtonContainer( wxWindow* parent,
21 ButtonContainerSettings* bcSettings ) :
22 wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize,
23 wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
25 this->m_ButtonContainerSettings = bcSettings;
26 this->m_ButtonPanel = new wxPanel( this );
28 //Class that manages the event!!!
29 TConcreteFunctor* functor = new TConcreteFunctor( this,
30 &PanelButtonContainer::GenericButtonEvent );
31 //end of the event definition
33 this->m_ButtonContainerPanel = new ButtonContainerPanel( this,
34 this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
36 //Using AuiManager to Manage the Panels
37 this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
39 this->m_AuiManager->AddPane(
41 wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(
42 true ).CloseButton( false ).Bottom( ).Resizable( true ) );
43 //CartoButtonPanel Management
44 this->m_AuiManager->AddPane(
45 this->m_ButtonContainerPanel,
46 wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(
47 _("creaButtonContainer") ). CaptionVisible( false ).CloseButton(
48 false ).Center( ).Resizable( true ) );
49 this->m_AuiManager->Update( );
51 // ----------------------------------------------------------------------------------
52 PanelButtonContainer::~PanelButtonContainer( )
55 // ----------------------------------------------------------------------------------
57 PanelButtonContainer::UpdatePanel( const std::string &buttonName )
61 //Hiding the last CartoSettingsPanel
62 this->m_ButtonPanel->Show( false );
63 //Finding the CartoSettingsPanel of the ButtonClicket
64 this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(
66 //changing the parent of the panel!
67 if ( this->m_ButtonPanel->GetParent( ) != this )
69 this->m_ButtonPanel->Reparent( this );
71 //CartoSettingsPanel Management
72 this->m_AuiManager->GetPane( _T("ButtonPanel") ).window
73 = this->m_ButtonPanel;
74 //Updating the manager
75 this->m_AuiManager->Update( );
77 catch ( const std::exception& e )
80 << "PanelButtonContainer::UpdatePanel( const std::string &buttonName )"
81 << "exception: " << e.what( ) << std::endl;
82 std::cout << "Maybe the panel of the button is NULL" << std::endl;
86 // ----------------------------------------------------------------------------------
88 PanelButtonContainer::GenericButtonEvent( const std::string &buttonName )
90 this->UpdatePanel( buttonName );
92 // ----------------------------------------------------------------------------------