1 /************************************************************************************//*!
2 * Name: @file buttonGroupFactory.cxx
3 * Purpose: @brief This contains the ButtonGroupFactory class implementation
4 * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 ***************************************************************************************/
10 //! @include "buttonGroupFactory.h"
11 #include "buttonGroupFactory.h"
13 //! @namespace<creaButtonContainer>
14 namespace creaButtonContainer
19 // ----------------------------------------------------------------------------------
20 ButtonGroupFactory::ButtonGroupFactory( )
23 // ----------------------------------------------------------------------------------
24 ButtonGroupFactory::~ButtonGroupFactory( )
27 // ----------------------------------------------------------------------------------
28 ButtonGroupFactory::ButtonGroupContainer
29 ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
30 ButtonGroupModel* settings )
32 ButtonGroupContainer groupView;
35 ButtonGroupMap map = settings->GetButtonGroupContainer( );
36 for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
39 wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
40 wxStaticText* wxGroupName = new wxStaticText( parent, -1,
41 groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
43 //creating a wxButtonGroup.
44 ButtonGroup* group = new ButtonGroup( wxGroupName,
45 this->GetButtons( parent, ( *it ).second ) );
46 //adding the group to the container.
47 groupView.push_back( group );
50 catch ( std::exception& e )
53 << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
54 << e.what( ) << std::endl;
58 // ----------------------------------------------------------------------------------
59 ButtonGroupFactory::ButtonContainer
60 ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
62 ButtonContainer buttonList;
65 for( ButtonList::iterator it = buttonModel.begin( ); it
66 != buttonModel.end( ); ++it )
69 buttonList[ id ] = new Button( parent, id, *it );
71 return ( buttonList );
73 catch ( std::exception& e )
76 << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
77 << e.what( ) << std::endl;
80 // ----------------------------------------------------------------------------------