1 /***************************************************************
2 * Name: @file buttonContainerController.h
3 * Purpose: @brief This contains ContainerSettings class
4 * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
6 * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/)
8 **************************************************************/
10 #include "buttonContainerController.h"
13 namespace creaButtonContainer
17 ButtonContainerController::ButtonContainerController( BCPanel* panel )
19 this->m_BCPanel = panel;
21 ButtonContainerController::~ButtonContainerController( )
25 ButtonContainerController::AddEvents( )
27 //Adding ButtonManagerEvents
28 for( GroupManagerList::iterator it =
29 this->m_BCPanel->m_GroupManagerList.begin( ); it
30 != this->m_BCPanel->m_GroupManagerList.end( ); ++it )
32 this->Connect( ( *it ).first, wxEVT_COMMAND_BUTTON_CLICKED,
33 (wxObjectEventFunction) &ButtonContainerController::ButtonExpEvent );
37 for( ButtonGroupList::iterator it =
38 this->m_BCPanel->m_ButtonGroupList.begin( ); it
39 != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
41 KeyList keylist = ( *it )->GetButtonIdContainer( );
42 for( KeyList::iterator it2 = keylist.begin( ); it2 != keylist.end( ); ++it2 )
44 this->Connect( ( *it2 ), wxEVT_COMMAND_BUTTON_CLICKED,
45 (wxObjectEventFunction) &ButtonContainerController::ButtonEvent );
49 // -------------------------------------------------------------------
51 ButtonContainerController::ButtonExpEvent( wxCommandEvent& event )
53 long id = event.GetId( );
55 if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp(
58 this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel(
60 this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( false );
62 else if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp(
65 this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel(
67 this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( true );
69 this->m_BCPanel->FitSizer( );
71 // -------------------------------------------------------------------
73 ButtonContainerController::ButtonEvent( wxCommandEvent& event )
75 for( ButtonGroupList::iterator it =
76 this->m_BCPanel->m_ButtonGroupList.begin( ); it
77 != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
79 if ( ( *it )->GetButton( event.GetId( ) ) != NULL )
80 ( *it )->GetButton( event.GetId( ) )->Execute( );