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( )
23 // ----------------------------------------------------------------------------------
24 ButtonGroupFactory::ButtonGroupContainer ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings )
26 ButtonGroupContainer groupView;
29 ButtonGroupMap map = settings->GetButtonGroupContainer( );
30 for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
32 wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
33 wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux, wxDefaultPosition, wxDefaultSize, 0, _T("GroupText") );
34 ButtonGroup* group = new ButtonGroup( wxGroupName, this->GetButtons( parent, ( *it ).second ) );
35 groupView.push_back( group );
38 catch ( const std::exception& e )
41 << "ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings )"
42 << " exception: " << e.what( ) << std::endl;
47 // ----------------------------------------------------------------------------------
48 ButtonGroupFactory::ButtonContainer ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
50 ButtonContainer buttonList;
53 for( ButtonList::iterator it = buttonModel.begin( ); it
54 != buttonModel.end( ); ++it )
57 buttonList[ id ] = new Button( parent, id, *it );
59 //return ( buttonList ); // JPR
61 catch ( const std::exception& e )
64 << "ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )"
65 << "exception: " << e.what( ) << std::endl;
68 return ( buttonList ); // JPR
70 // ----------------------------------------------------------------------------------