2 * @file buttonGroupFactory.cxx
3 * @brief Implements the ButtonGroupFactory class.
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 #include "buttonGroupFactory.h"
10 namespace creaButtonContainer
14 // ----------------------------------------------------------------------------------
15 ButtonGroupFactory::ButtonGroupFactory( )
18 // ----------------------------------------------------------------------------------
19 ButtonGroupFactory::~ButtonGroupFactory( )
22 // ----------------------------------------------------------------------------------
23 ButtonGroupFactory::ButtonGroupContainer
24 ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
25 ButtonGroupModel* settings )
29 ButtonGroupContainer groupView;
30 ButtonGroupMap map = settings->GetButtonGroupContainer( );
31 for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
33 wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
34 wxStaticText* wxGroupName = new wxStaticText( parent, -1,
35 groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
37 ButtonGroup* group = new ButtonGroup( wxGroupName,
38 this->GetButtons( parent, ( *it ).second ) );
39 groupView.push_back( group );
43 catch ( const std::exception& e )
46 << "ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings )"
47 << " exception: " << e.what( ) << std::endl;
50 // ----------------------------------------------------------------------------------
51 ButtonGroupFactory::ButtonContainer
52 ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
54 ButtonContainer buttonList;
57 ButtonContainer buttonList;
58 for( ButtonList::iterator it = buttonModel.begin( ); it
59 != buttonModel.end( ); ++it )
62 buttonList[ id ] = new Button( parent, id, *it );
64 return ( buttonList );
66 catch ( const std::exception& e )
69 << "ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )"
70 << "exception: " << e.what( ) << std::endl;
73 // ----------------------------------------------------------------------------------