]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx
creaButtonContainer & creaPanelButtonContainer: Updates in doxygen documentation...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaPanelButtonContainer / buttonContainerSettings.cxx
index 7dcd9a42cc24fb862ee7949874359585bcec92c6..80dee9a41172b129d35786b893cc58862311e880 100644 (file)
@@ -2,11 +2,10 @@
  * @file buttonContainerSettings.cxx
  * @brief Implements the ButtonContainerSettings class.
  * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
- * @date  2011-05-24
+ * @date  2011-06-02
  */
 
 #include "buttonContainerSettings.h"
-#include <iostream>
 
 namespace creaPanelButtonContainer
 {
@@ -33,7 +32,7 @@ namespace creaPanelButtonContainer
        // ----------------------------------------------------------------------------------
        //GetButtonPanel returns the panel associated to the buttonAction
        ButtonContainerSettings::PanelButton
-       ButtonContainerSettings::GetPanelButton( const std::string &buttonName )
+       ButtonContainerSettings::GetPanelButton( const StringType &buttonName )
        {
                try
                {
@@ -53,18 +52,18 @@ namespace creaPanelButtonContainer
                catch ( std::exception& e )
                {
                        std::cerr
-                           << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) "
+                           << "ButtonContainerSettings::GetPanelButton( const StringType &buttonName ) "
                            << "exception: " << e.what( ) << std::endl;
-                       return ( NULL );
                }//hctac
+               return ( NULL );
        }
        // ----------------------------------------------------------------------------------
        ButtonContainerSettings::ButtonGroupSettings*
        ButtonContainerSettings::GetButtonGroupSettings( TFunctor* functor )
        {
-               ButtonGroupSettings* settings = new ButtonGroupSettings( );
                try
                {
+                       ButtonGroupSettings* settings = new ButtonGroupSettings( );
                        for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
                            != this->m_GroupNameList.end( ); ++it )
                        {
@@ -80,9 +79,8 @@ namespace creaPanelButtonContainer
                catch ( std::exception& e )
                {
                        std::cerr
-                           << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) "
+                           << "ButtonContainerSettings::GetPanelButton( const StringType &buttonName ) "
                            << "exception: " << e.what( ) << std::endl;
-                       return ( NULL );
                }//hctac
        }
        // ----------------------------------------------------------------------------------
@@ -100,13 +98,20 @@ namespace creaPanelButtonContainer
        }
        // ----------------------------------------------------------------------------------
        void
-       ButtonContainerSettings::AddButton( const std::string & groupName,
-           const std::string &buttonName, const std::string &iconpath,
-           const std::string &buttonDescription, PanelButton panel )
+       ButtonContainerSettings::AddButton( const StringType & groupName,
+           const StringType &buttonName, const StringType &iconpath,
+           const StringType &buttonDescription, PanelButton panel )
        {
                try
                {
                        //builds the button information
+                       //I don't know the try catch doesn't work!!
+                       if ( panel == NULL )
+                       {
+                               std::cerr << "ButtonContainerSettings::AddButton"
+                                   << "exception: NULL Pointer in panel " << std::endl;
+                               exit( 1 );
+                       }
                        panel->Show( false );
                        ButtonPair* pair = new ButtonPair(
                            new ButtonInfo( buttonName, iconpath ),
@@ -123,12 +128,12 @@ namespace creaPanelButtonContainer
                        this->m_GroupNameList.push_back( groupName );
                        this->m_ButtonGroupContainer[ groupName ].push_back( pair );
                }//yrt
-               catch ( std::exception& e )
+               catch ( const std::exception& e )
                {
                        std::cerr
-                           << "ButtonContainerSettings::AddButton( const std::string & groupName,"
-                           << "const std::string &buttonName, const std::string &iconpath,"
-                           << "const std::string &buttonDescription, PanelButton panel ) "
+                           << "ButtonContainerSettings::AddButton( const StringType & groupName,"
+                           << "const StringType &buttonName, const StringType &iconpath,"
+                           << "const StringType &buttonDescription, PanelButton panel ) "
                            << "exception: " << e.what( ) << std::endl;
                }//hctac
        }
@@ -139,6 +144,13 @@ namespace creaPanelButtonContainer
                try
                {
                        //builds the button information
+                       //I don't know the try catch doesn't work!!
+                       if ( info->panel == NULL )
+                       {
+                               std::cerr << "ButtonContainerSettings::AddButton"
+                                   << "exception: NULL Pointer in panel " << std::endl;
+                               exit( 1 );
+                       }
                        info->panel->Show( false );
                        ButtonPair* pair = new ButtonPair(
                            new ButtonInfo( info->buttonName, info->iconpath ),
@@ -154,12 +166,13 @@ namespace creaPanelButtonContainer
                        }//rof
                        this->m_GroupNameList.push_back( info->groupName );
                        this->m_ButtonGroupContainer[ info->groupName ].push_back( pair );
-               }
-               catch ( std::exception& e )
+               }//yrt
+               catch ( const std::exception& e )
                {
                        std::cerr
                            << "ButtonContainerSettings::AddButton( BCPSettingsStruct* info )"
                            << "exception: " << e.what( ) << std::endl;
+                       exit( 1 );
                }//hctac
        }
        // ----------------------------------------------------------------------------------
@@ -173,7 +186,7 @@ namespace creaPanelButtonContainer
                        {
                                this->AddButton( *it );
                        }//rof
-               }
+               }//yrt
                catch ( std::exception& e )
                {
                        std::cerr