]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx
creaButtonContainer: new structure to make easy the button settings
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaPanelButtonContainer / creaPanelButtonContainer.cxx
1 /*!
2  * @file creaPanelButtonContainer.h
3  * @brief implements PanelButtonContainer class
4  * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
5  * @date  2011-05-24
6  */
7
8 #include "creaPanelButtonContainer.h"
9
10 namespace creaPanelButtonContainer
11 {
12         // ----------------------------------------------------------------------------------
13         typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer >
14             TConcreteFunctor;
15         // ----------------------------------------------------------------------------------
16         PanelButtonContainer::PanelButtonContainer( wxWindow* parent,
17             ButtonContainerSettings* bcSettings ) :
18                     wxPanel( parent, -1, wxDefaultPosition, wxSize( 300, 700 ),
19                         wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
20         {
21                 this->m_ButtonContainerSettings = bcSettings;
22                 this->m_ButtonPanel = new wxPanel( this );
23                 //Class that manages the cartobutton event!!!
24                 TConcreteFunctor* functor = new TConcreteFunctor( this,
25                     &PanelButtonContainer::GenericButtonEvent );
26                 //end of the event definition
27                 this->m_ButtonContainerPanel = new ButtonContainerPanel( this,
28                     this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
29                 //Using AuiManager to Manage the Panels
30                 this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
31                 // CartoSettingsPanel Management
32                 this->m_AuiManager->AddPane(
33                     this->m_ButtonPanel,
34                     wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible( ).CloseButton(
35                         false ).Left( ).MinSize( wxSize( 300, 300 ) ) );
36                 //CartoButtonPanel Management
37                 this->m_AuiManager->AddPane(
38                     this->m_ButtonContainerPanel,
39                     wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(
40                         _("creaButtonContainer") ). CaptionVisible( ).CloseButton( false ).Left( ) .MinSize(
41                         wxSize( 300, 300 ) ) );
42                 this->m_AuiManager->Update( );
43                 //this->createGimmick();
44         }
45         // ----------------------------------------------------------------------------------
46         PanelButtonContainer::~PanelButtonContainer( )
47         {
48         }
49         // ----------------------------------------------------------------------------------
50         void
51         PanelButtonContainer::UpdatePanel( const std::string &buttonName )
52         {
53                 //Hiding the last CartoSettingsPanel
54                 this->m_ButtonPanel->Show( false );
55                 //Finding the CartoSettingsPanel of the ButtonClicket
56                 this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(
57                     buttonName );
58                 //CartoSettingsPanel Management
59                 this->m_AuiManager->GetPane( _T("ButtonPanel") ).window
60                     = this->m_ButtonPanel;
61                 //Updating the manager
62                 this->m_AuiManager->Update( );
63         }
64         // ----------------------------------------------------------------------------------
65         void
66         PanelButtonContainer::GenericButtonEvent( const std::string &buttonName )
67         {
68                 this->UpdatePanel( buttonName );
69         }
70 // ----------------------------------------------------------------------------------
71 }//ecapseman
72
73