]> Creatis software - creaMaracasVisu.git/blobdiff - 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
index c06d5d4c56af4db5d89df101fdc3747430a801bf..7acc0d9a4700a9af19fb78ade28be1d2059f535d 100644 (file)
@@ -1,53 +1,80 @@
-/***************************************************************
- * Name:      ButtonGroupFactory
- * Purpose:   Implements ButtonGroupFactory
- * Author:    Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
- * Modified:  2011-05-09
- * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/)
+/************************************************************************************//*!
+ * Name:      @file buttonGroupFactory.cxx
+ * Purpose:   @brief This contains the ButtonGroupFactory class implementation
+ * Author:    @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * Modified:  2011-05-17
+ * Copyright:
  * License:
- **************************************************************/
+ ***************************************************************************************/
 
+//! @include "buttonGroupFactory.h"
 #include "buttonGroupFactory.h"
 
+//!    @namespace<creaButtonContainer>
 namespace creaButtonContainer
 {
+       //!     @namespace<model>
        namespace model
        {
+               // ----------------------------------------------------------------------------------
                ButtonGroupFactory::ButtonGroupFactory( )
                {
                }
+               // ----------------------------------------------------------------------------------
                ButtonGroupFactory::~ButtonGroupFactory( )
                {
                }
-               ButtonGroupContainer
+               // ----------------------------------------------------------------------------------
+               ButtonGroupFactory::ButtonGroupContainer
                ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
                    ButtonGroupModel* settings )
                {
                        ButtonGroupContainer groupView;
-                       ButtonGroupMap map = settings->GetButtonGroupContainer( );
-                       for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
+                       try
                        {
-                               wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
-                               wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux,
-                                   wxDefaultPosition, wxDefaultSize, 0, _T("GroupText") );
-                               ButtonGroup* group = new ButtonGroup( wxGroupName,
-                                   this->GetButtons( parent, ( *it ).second ) );
-                               groupView.push_back( group );
+                               ButtonGroupMap map = settings->GetButtonGroupContainer( );
+                               for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
+                               {
+                                       wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
+                                       wxStaticText* wxGroupName = new wxStaticText( parent, -1,
+                                           groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
+                                           _T( "GroupText" ) );
+                                       ButtonGroup* group = new ButtonGroup( wxGroupName,
+                                           this->GetButtons( parent, ( *it ).second ) );
+                                       groupView.push_back( group );
+                               }
+                       }
+                       catch ( std::exception& e )
+                       {
+                               std::cerr
+                                   << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
+                                   << e.what( ) << std::endl;
                        }
                        return ( groupView );
                }
-               ButtonContainer
+               // ----------------------------------------------------------------------------------
+               ButtonGroupFactory::ButtonContainer
                ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
                {
                        ButtonContainer buttonList;
-                       for( ButtonList::iterator it = buttonModel.begin( ); it
-                           != buttonModel.end( ); ++it )
+                       try
+                       {
+                               for( ButtonList::iterator it = buttonModel.begin( ); it
+                                   != buttonModel.end( ); ++it )
+                               {
+                                       long id = wxNewId( );
+                                       buttonList[ id ] = new Button( parent, id, *it );
+                               }
+                               return ( buttonList );
+                       }
+                       catch ( std::exception& e )
                        {
-                               long id = wxNewId( );
-                               buttonList[ id ] = new Button( parent, id, *it );
+                               std::cerr
+                                   << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
+                                   << e.what( ) << std::endl;
                        }
-                       return ( buttonList );
                }
+       // ----------------------------------------------------------------------------------
        }//ecapseman
 }//ecapseman