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