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 // ----------------------------------------------------------------------------------
13 typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer >
15 // ----------------------------------------------------------------------------------
16 PanelButtonContainer::PanelButtonContainer( wxWindow* parent,
17 ButtonContainerSettings* bcSettings ) :
18 wxPanel( parent, -1, wxDefaultPosition, wxSize( 300, 700 ),
19 wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
21 this->m_ButtonContainerSettings = bcSettings;
22 this->m_ButtonPanel = new wxPanel( this );
24 //Class that manages the cartobutton event!!!
25 TConcreteFunctor* functor = new TConcreteFunctor( this,
26 &PanelButtonContainer::GenericButtonEvent );
27 //end of the event definition
29 this->m_ButtonContainerPanel = new ButtonContainerPanel( this,
30 this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
32 //Using AuiManager to Manage the Panels
33 this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
35 // CartoSettingsPanel Management
36 this->m_AuiManager->AddPane(
38 wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible( ).CloseButton(
39 false ).Left( ).MinSize( wxSize( 300, 300 ) ) );
41 //CartoButtonPanel Management
42 this->m_AuiManager->AddPane(
43 this->m_ButtonContainerPanel,
44 wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(
45 _("creaButtonContainer") ). CaptionVisible( ).CloseButton( false ).Left( ) .MinSize(
46 wxSize( 300, 300 ) ) );
47 this->m_AuiManager->Update( );
49 // ----------------------------------------------------------------------------------
50 PanelButtonContainer::~PanelButtonContainer( )
53 // ----------------------------------------------------------------------------------
55 PanelButtonContainer::UpdatePanel( const std::string &buttonName )
59 //Hiding the last CartoSettingsPanel
60 this->m_ButtonPanel->Show( false );
61 //Finding the CartoSettingsPanel of the ButtonClicket
62 this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(
64 //CartoSettingsPanel Management
65 this->m_AuiManager->GetPane( _T("ButtonPanel") ).window
66 = this->m_ButtonPanel;
67 //Updating the manager
68 this->m_AuiManager->Update( );
70 catch ( const std::exception& e )
73 << "PanelButtonContainer::UpdatePanel( const std::string &buttonName )"
74 << "exception: " << e.what( ) << std::endl;
75 std::cout<<"Maybe the panel of the button is NULL"<<std::endl;
79 // ----------------------------------------------------------------------------------
81 PanelButtonContainer::GenericButtonEvent( const std::string &buttonName )
83 this->UpdatePanel( buttonName );
85 // ----------------------------------------------------------------------------------