]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx
creaButtonContainer: exceptions added, doxygen documentation added :)
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / model / buttonGroupFactory.cxx
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)
5  * Modified:  2011-05-17
6  * Copyright:
7  * License:
8  ***************************************************************************************/
9
10 //! @include "buttonGroupFactory.h"
11 #include "buttonGroupFactory.h"
12
13 //!     @namespace<creaButtonContainer>
14 namespace creaButtonContainer
15 {
16         //!     @namespace<model>
17         namespace model
18         {
19                 // ----------------------------------------------------------------------------------
20                 ButtonGroupFactory::ButtonGroupFactory( )
21                 {
22                 }
23                 // ----------------------------------------------------------------------------------
24                 ButtonGroupFactory::~ButtonGroupFactory( )
25                 {
26                 }
27                 // ----------------------------------------------------------------------------------
28                 ButtonGroupFactory::ButtonGroupContainer
29                 ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
30                     ButtonGroupModel* settings )
31                 {
32                         ButtonGroupContainer groupView;
33                         try
34                         {
35                                 ButtonGroupMap map = settings->GetButtonGroupContainer( );
36                                 for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
37                                 {
38                                         wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
39                                         wxStaticText* wxGroupName = new wxStaticText( parent, -1,
40                                             groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
41                                             _T( "GroupText" ) );
42                                         ButtonGroup* group = new ButtonGroup( wxGroupName,
43                                             this->GetButtons( parent, ( *it ).second ) );
44                                         groupView.push_back( group );
45                                 }
46                         }
47                         catch ( std::exception& e )
48                         {
49                                 std::cerr
50                                     << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
51                                     << e.what( ) << std::endl;
52                         }
53                         return ( groupView );
54                 }
55                 // ----------------------------------------------------------------------------------
56                 ButtonGroupFactory::ButtonContainer
57                 ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
58                 {
59                         ButtonContainer buttonList;
60                         try
61                         {
62                                 for( ButtonList::iterator it = buttonModel.begin( ); it
63                                     != buttonModel.end( ); ++it )
64                                 {
65                                         long id = wxNewId( );
66                                         buttonList[ id ] = new Button( parent, id, *it );
67                                 }
68                                 return ( buttonList );
69                         }
70                         catch ( std::exception& e )
71                         {
72                                 std::cerr
73                                     << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
74                                     << e.what( ) << std::endl;
75                         }
76                 }
77         // ----------------------------------------------------------------------------------
78         }//ecapseman
79 }//ecapseman
80