1 /************************************************************************************//*!
2 * Name: @file buttonContainerController.cxx
3 * Purpose: @brief This contains the ButtonContainerController class implementation
4 * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 ***************************************************************************************/
10 //! @include "buttonContainerController.h"
11 #include "buttonContainerController.h"
13 //! @namespace<creaButtonContainer>
14 namespace creaButtonContainer
16 //! @namespace<controller>
19 // ----------------------------------------------------------------------------------
20 ButtonContainerController::ButtonContainerController( BCPanel* panel )
22 this->m_BCPanel = panel;
24 // ----------------------------------------------------------------------------------
25 ButtonContainerController::~ButtonContainerController( )
28 // ----------------------------------------------------------------------------------
30 ButtonContainerController::AddEvents( )
34 //Adding ButtonManagerEvents
35 for( GroupManagerList::iterator it =
36 this->m_BCPanel->m_GroupManagerList.begin( ); it
37 != this->m_BCPanel->m_GroupManagerList.end( ); ++it )
41 wxEVT_COMMAND_BUTTON_CLICKED,
42 ( wxObjectEventFunction )
43 & ButtonContainerController::ButtonExpEvent );
47 for( ButtonGroupList::iterator it =
48 this->m_BCPanel->m_ButtonGroupList.begin( ); it
49 != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
51 KeyList keylist = ( *it )->GetButtonIdContainer( );
52 for( KeyList::iterator it2 = keylist.begin( ); it2 != keylist.end( ); ++it2 )
56 wxEVT_COMMAND_BUTTON_CLICKED,
57 ( wxObjectEventFunction )
58 & ButtonContainerController::ButtonEvent );
62 catch ( std::exception& e )
65 << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
66 << e.what( ) << std::endl;
69 // ----------------------------------------------------------------------------------
71 ButtonContainerController::ButtonExpEvent( wxCommandEvent& event )
73 long id = event.GetId( );
76 if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp(
79 this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel(
81 this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( false );
83 else if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp(
86 this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel(
88 this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( true );
90 this->m_BCPanel->FitSizer( );
92 catch ( std::exception& e )
94 std::cerr << "ButtonContainerController::AddEvents( ) exception: "
95 << e.what( ) << std::endl;
98 // ----------------------------------------------------------------------------------
100 ButtonContainerController::ButtonEvent( wxCommandEvent& event )
102 for( ButtonGroupList::iterator it =
103 this->m_BCPanel->m_ButtonGroupList.begin( ); it
104 != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
108 ( *it )->GetButton( event.GetId( ) )->Execute( );
110 catch ( std::exception& e )
113 << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
114 << e.what( ) << std::endl;
118 // ----------------------------------------------------------------------------------