/*************************************************************** * Name: @file buttonContainerController.h * Purpose: @brief This contains ContainerSettings class * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) * Modified: 2011-05-09 * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/) * License: **************************************************************/ #include "buttonContainerController.h" using namespace std; namespace creaButtonContainer { namespace controller { ButtonContainerController::ButtonContainerController( BCPanel* panel ) { this->m_BCPanel = panel; } ButtonContainerController::~ButtonContainerController( ) { } void ButtonContainerController::AddEvents( ) { //Adding ButtonManagerEvents for( GroupManagerList::iterator it = this->m_BCPanel->m_GroupManagerList.begin( ); it != this->m_BCPanel->m_GroupManagerList.end( ); ++it ) { this->Connect( ( *it ).first, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &ButtonContainerController::ButtonExpEvent ); }//rof //Adding ButtonEvents for( ButtonGroupList::iterator it = this->m_BCPanel->m_ButtonGroupList.begin( ); it != this->m_BCPanel->m_ButtonGroupList.end( ); ++it ) { KeyList keylist = ( *it )->GetButtonIdContainer( ); for( KeyList::iterator it2 = keylist.begin( ); it2 != keylist.end( ); ++it2 ) { this->Connect( ( *it2 ), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &ButtonContainerController::ButtonEvent ); }//rof }//rof } // ------------------------------------------------------------------- void ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) { long id = event.GetId( ); if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp( _("+") ) == 0 ) { this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel( _("-") ); this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( false ); } else if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp( _("-") ) == 0 ) { this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel( _("+") ); this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( true ); } this->m_BCPanel->FitSizer( ); } // ------------------------------------------------------------------- void ButtonContainerController::ButtonEvent( wxCommandEvent& event ) { for( ButtonGroupList::iterator it = this->m_BCPanel->m_ButtonGroupList.begin( ); it != this->m_BCPanel->m_ButtonGroupList.end( ); ++it ) { if ( ( *it )->GetButton( event.GetId( ) ) != NULL ) ( *it )->GetButton( event.GetId( ) )->Execute( ); } } }//ecapsename }//ecapsename