1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
27 * @file creaPanelButtonContainer.h
28 * @brief implements PanelButtonContainer class
29 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
33 #include "creaPanelButtonContainer.h"
35 namespace creaPanelButtonContainer
37 BEGIN_EVENT_TABLE(PanelButtonContainer,wxPanel)
38 //(*EventTable(ButtonContainerPanel)
41 // ----------------------------------------------------------------------------------
42 typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer > TConcreteFunctor;
43 // ----------------------------------------------------------------------------------
44 PanelButtonContainer::PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings, std::string type )
45 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") )
47 std::cout<< std::endl << " MLER creaPanelButtonContainer.cxx / PanelButtonContainer() " << std::endl;
49 this->m_ButtonContainerSettings = bcSettings;
50 this->m_ButtonPanel = new wxPanel( this );
52 //Class that manages the event!!!
54 TConcreteFunctor* functor = new TConcreteFunctor( this, &PanelButtonContainer::GenericButtonEvent );
55 // TConcreteFunctor* functor = new TConcreteFunctor( this->m_ButtonPanel, &PanelButtonContainer::GenericButtonEvent );
56 //end of the event definition
58 this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ),type );
60 //Using AuiManager to Manage the Panels
61 this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
63 this->m_AuiManager->AddPane(this->m_ButtonPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
64 //CartoButtonPanel Management
65 this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(_("creaButtonContainer") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );
66 this->m_AuiManager->Update( );
68 // ----------------------------------------------------------------------------------
69 PanelButtonContainer::~PanelButtonContainer( )
72 // ----------------------------------------------------------------------------------
74 PanelButtonContainer::UpdatePanel( const std::string &buttonName )
78 //Hiding the last CartoSettingsPanel
79 this->m_ButtonPanel->Show( false );
80 //Finding the CartoSettingsPanel of the ButtonClicket
81 this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(buttonName );
82 //changing the parent of the panel!
83 if ( this->m_ButtonPanel->GetParent( ) != this )
85 this->m_ButtonPanel->Reparent( this );
87 //CartoSettingsPanel Management
88 this->m_AuiManager->GetPane( _T("ButtonPanel") ).window = this->m_ButtonPanel;
89 //Updating the manager
90 this->m_AuiManager->Update( );
92 catch ( const std::exception& e )
95 << "PanelButtonContainer::UpdatePanel( const std::string &buttonName )"
96 << "exception: " << e.what( ) << std::endl;
97 std::cout << "Maybe the panel of the button is NULL" << std::endl;
101 // ----------------------------------------------------------------------------------
103 PanelButtonContainer::GenericButtonEvent( const std::string &buttonName )
105 this->UpdatePanel( buttonName );
107 // ----------------------------------------------------------------------------------