From de7a931d43b373fdbaba530ae326a64d45148ae9 Mon Sep 17 00:00:00 2001 From: Diego Caceres Date: Mon, 23 May 2011 23:58:03 +0000 Subject: [PATCH] creaButtonContainer: new structure to make easy the button settings creaButtonContainer & creaPanelButtonContainer doxygen documentation 99% some changes in the boxes (not big) the two libraries are ready to be usables :) There are 1 bug to solve!! (wxScrolledWindow) Good job!!! :) :) :) :D :D :D --- .../bbcreaMaracasVisuPanelButtonContainer.h | 5 +- ...aracasVisuPanelButtonContainerSettings.cxx | 2 +- ...aMaracasVisuPanelButtonContainerSettings.h | 7 +- .../controller/buttonContainerController.cxx | 13 +- .../controller/buttonContainerController.h | 10 +- .../model/buttonGroupFactory.cxx | 10 +- .../model/buttonGroupFactory.h | 7 +- .../model/containerSettings.cxx | 55 ++++- .../model/containerSettings.h | 45 +++- .../creaButtonContainer/model/functor.h | 4 +- .../creaButtonContainer/model/functor.txx | 76 ++++--- .../model/structBCSettings.h | 38 ++++ .../creaButtonContainer/model/system.h | 2 +- .../creaButtonContainer/view/button.cxx | 19 +- .../widgets/creaButtonContainer/view/button.h | 17 +- .../view/buttonContainerPanel.cxx | 54 ++--- .../view/buttonContainerPanel.h | 19 +- .../creaButtonContainer/view/buttonGroup.cxx | 47 +++-- .../creaButtonContainer/view/buttonGroup.h | 8 +- .../view/buttonManager.cxx | 53 +++-- .../creaButtonContainer/view/buttonManager.h | 15 +- .../creaButtonContainer/view/groupManager.cxx | 22 +- .../creaButtonContainer/view/groupManager.h | 7 +- .../buttonContainerSettings.cxx | 192 +++++++++++------- .../buttonContainerSettings.h | 171 +++++++++++++--- .../creaPanelButtonContainer.cxx | 35 ++-- .../creaPanelButtonContainer.h | 70 +++++-- .../structBCPSettings.h | 31 +++ .../structButtonContainerSettings.h | 27 --- 29 files changed, 731 insertions(+), 330 deletions(-) create mode 100755 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h create mode 100755 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h delete mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structButtonContainerSettings.h diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h index 1534987..ac0c968 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h @@ -6,15 +6,16 @@ #define __bbcreaMaracasVisuPanelButtonContainer_h_INCLUDED__ #include "bbcreaMaracasVisu_EXPORT.h" #include "bbtkWxBlackBox.h" -#include +#include #include #include namespace bbcreaMaracasVisu { + typedef creaPanelButtonContainer::BCPSettingsStruct BCPSettingsStruct; typedef creaPanelButtonContainer::ButtonContainerSettings ButtonContainerSettings; typedef creaPanelButtonContainer::PanelButtonContainer PBContainer; - typedef std::vector< BCSettingsStruct* > BCStructVectorType; + typedef std::vector< BCPSettingsStruct* > BCStructVectorType; class bbcreaMaracasVisu_EXPORT PanelButtonContainer : public bbtk::WxBlackBox diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.cxx b/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.cxx index 7498673..1911c21 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.cxx +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.cxx @@ -66,7 +66,7 @@ PanelButtonContainerSettings::bbUserSetDefaultValues( ) void PanelButtonContainerSettings::bbUserInitializeProcessing( ) { - this->m_BSettings = new BCSettingsStruct(); + this->m_BSettings = new BCPSettingsStruct(); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.h b/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.h index 9db1bd9..af9f02a 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.h +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainerSettings.h @@ -10,11 +10,12 @@ #include #include -#include +#include namespace bbcreaMaracasVisu { - typedef std::vector< BCSettingsStruct* > BCStructVectorType; + typedef creaPanelButtonContainer::BCPSettingsStruct BCPSettingsStruct; + typedef std::vector< BCPSettingsStruct* > BCStructVectorType; class bbcreaMaracasVisu_EXPORT PanelButtonContainerSettings : public bbtk::WxBlackBox { @@ -38,7 +39,7 @@ namespace bbcreaMaracasVisu CreateWidget( wxWindow* ); private: - BCSettingsStruct* m_BSettings; + BCPSettingsStruct* m_BSettings; BCStructVectorType m_BCSettingsVector; wxPanel* myPanel; //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx index 83560a4..bb28d53 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx @@ -2,7 +2,7 @@ * @file buttonContainerController.cxx * @brief This contains the ButtonContainerController class implementation * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "buttonContainerController.h" @@ -53,8 +53,7 @@ namespace creaButtonContainer }//yrt catch ( std::exception& e ) { - std::cerr - << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " + std::cerr << "ButtonContainerController::AddEvents( ) exception: " << e.what( ) << std::endl; }//hctac } @@ -65,6 +64,7 @@ namespace creaButtonContainer long id = event.GetId( ); try { + //changing the button label when its clicked and then hide the buttons of the group. if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp( _( "+" ) ) == 0 ) { @@ -83,7 +83,8 @@ namespace creaButtonContainer }//yrt catch ( std::exception& e ) { - std::cerr << "ButtonContainerController::AddEvents( ) exception: " + std::cerr + << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " << e.what( ) << std::endl; }//hctac } @@ -97,15 +98,13 @@ namespace creaButtonContainer this->m_BCPanel->m_ButtonGroupList.begin( ); it != this->m_BCPanel->m_ButtonGroupList.end( ); ++it ) { - ( *it )->GetButton( event.GetId( ) )->Execute( ); - }//rof }//yrt catch ( std::exception& e ) { std::cerr - << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " + << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: " << e.what( ) << std::endl; }//hctac } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h index 3ca492a..2ccadcc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h @@ -2,7 +2,7 @@ * @file buttonContainerController.h * @brief This contains the ButtonContainerController class * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef BUTTONCONTAINERCONTROLLER_H_ @@ -25,7 +25,7 @@ namespace creaButtonContainer namespace view { //Predefinition of ButtonContainerPanel FriendClass!! - /*! @class ButtonContainerPanel : public wxScrolledWindow buttonContainerPanel.h "buttonContainerPanel.h" + /*! @class ButtonContainerPanel buttonContainerPanel.h "buttonContainerPanel.h" * @brief This class is the container of the creaButtonContainer. * @details This class derives from wxScrolledWindow and manages the view of the buttonContainer. * @see wxScrolledWindow @@ -105,14 +105,14 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- /*! @fn void AddEvents( ); - * @brief This function connect every buttonEvent to the view. + * @brief This method connect every buttonEvent to the view. * @exception std::bad_alloc */ void AddEvents( ); // ---------------------------------------------------------------------------------- /*! @fn void ButtonExpEvent( wxCommandEvent& event ); - * @brief This function is the button group "+" "-" event. + * @brief This method is the button group "+" "-" event. * @exception std::bad_alloc * @param event Button action event. */ @@ -120,7 +120,7 @@ namespace creaButtonContainer ButtonExpEvent( wxCommandEvent& event ); // ---------------------------------------------------------------------------------- /*! @fn void ButtonEvent( wxCommandEvent& event ); - * @brief This function calls the events of the buttonContainer buttons + * @brief This method calls the events of the buttonContainer buttons * @exception std::bad_alloc * @param event Button action event. */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx index 62287f3..167bade 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx @@ -2,7 +2,7 @@ * @file buttonGroupFactory.cxx * @brief Implements the ButtonGroupFactory class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "buttonGroupFactory.h" @@ -45,8 +45,8 @@ namespace creaButtonContainer catch ( std::exception& e ) { std::cerr - << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " - << e.what( ) << std::endl; + << "ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings )" + << " exception: " << e.what( ) << std::endl; }//chtac return ( groupView ); } @@ -68,8 +68,8 @@ namespace creaButtonContainer catch ( std::exception& e ) { std::cerr - << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " - << e.what( ) << std::endl; + << "ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )" + << "exception: " << e.what( ) << std::endl; }//chtac } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.h index e9825bb..b12cfb5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.h @@ -2,7 +2,7 @@ * @file buttonGroupFactory.h * @brief Contains ButtonGroupFactory class * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef BUTTONGROUPFACTORY_H @@ -31,7 +31,6 @@ namespace creaButtonContainer */ namespace model { - /*! @class ButtonGroupFactory buttonGroupFactory.h "buttonGroupFactory.h" * @brief This class contains the ButtonGroup factory. * @details This class creates a container of group of buttons. @@ -79,7 +78,7 @@ namespace creaButtonContainer virtual ~ButtonGroupFactory( ); /*! @fn ButtonGroupContainer ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings ); - * @brief This function allows to create the ButtonGroupContainer. + * @brief This method allows to create the ButtonGroupContainer. * @param parent the wxWindow* parent to be attached. * @param settings The Container settings. * @exception std::bad_alloc @@ -90,7 +89,7 @@ namespace creaButtonContainer ButtonGroupModel* settings ); private: /*! @fn ButtonContainer ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel ); - * @brief This function allows to create a wx button container for a group. + * @brief This method allows to create a wx button container for a group. * @param parent the wxWindow* parent to be attached. * @param buttonModel The button list with its own information. * @exception std::bad_alloc diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx index 188d089..10e387a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx @@ -2,7 +2,7 @@ * @file containerSettings.cxx * @brief Implements the ContainerSettings class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "containerSettings.h" @@ -49,11 +49,11 @@ namespace creaButtonContainer const std::string buttonName, const std::string iconpath, const std::string buttonDescription, FunctionEventType event ) { - ButtonPair* pair = new ButtonPair( - new ButtonInfo( buttonName, iconpath ), - new ButtonAction( buttonDescription, event ) ); try { + ButtonPair* pair = new ButtonPair( + new ButtonInfo( buttonName, iconpath ), + new ButtonAction( buttonDescription, event ) ); for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it != this->m_GroupNameList.end( ); ++it ) { @@ -75,6 +75,53 @@ namespace creaButtonContainer << e.what( ) << std::endl; }//hctac } + // ---------------------------------------------------------------------------------- + void + ContainerSettings::AddButton( BCSettingsStruct* info ) + { + try + { + ButtonPair* pair = new ButtonPair( + new ButtonInfo( info->buttonName, info->iconpath ), + new ButtonAction( info->buttonDescription, info->eventFunction ) ); + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) + { + if ( ( *it ).compare( info->groupName ) == 0 ) + { + this->m_ButtonGroupContainer[ info->groupName ].push_back( pair ); + return; + }//fi + }//rof + this->m_GroupNameList.push_back( info->groupName ); + this->m_ButtonGroupContainer[ info->groupName ].push_back( pair ); + }//yrt + catch ( std::exception& e ) + { + std::cerr + << "void ContainerSettings::AddButton( BCSettingsStruct* info ) " + << "exception: " << e.what( ) << std::endl; + }//hctac + } + // ---------------------------------------------------------------------------------- + void + ContainerSettings::AddButtons( BCStructVectorType infoList ) + { + try + { + for( BCStructVectorType::iterator it = infoList.begin( ); it + != infoList.end( ); ++it ) + { + this->AddButton( *it ); + }//rof + }//yrt + catch ( std::exception& e ) + { + std::cerr + << "ContainerSettings::AddButtons( BCStructVectorType infoList ) " + << "exception: " << e.what( ) << std::endl; + }//hctac + } // ---------------------------------------------------------------------------------- }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h index 4e259b0..7a84073 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h @@ -2,7 +2,7 @@ * @file containerSettings.h * @brief Contains the ContainerSettings class * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef BUTTONGROUPSETTINGS_H_ @@ -10,7 +10,9 @@ #include #include +#include #include +#include "structBCSettings.h" #include "system.h" #include "functor.h" @@ -30,6 +32,20 @@ namespace creaButtonContainer */ class ContainerSettings { + public: + //typedef definition + // ---------------------------------------------------------------------------------- + /*! @typedef creaButtonContainer::model::BCSettingsStruct BCSettingsStruct; + * @brief Defines the BCSettingsStruct type. + */ + typedef creaButtonContainer::model::BCSettingsStruct BCSettingsStruct; + // ---------------------------------------------------------------------------------- + /*! @typedef std::vector< BCPSettingsStruct* > BCStructVectorType; + * @brief Defines the BCStructVectorType type. + */ + typedef std::vector< BCSettingsStruct* > BCStructVectorType; + // ---------------------------------------------------------------------------------- + //end of typedef definition public: // ---------------------------------------------------------------------------------- /*! @fn ContainerSettings::ContainerSettings( ) @@ -44,28 +60,28 @@ namespace creaButtonContainer ~ContainerSettings( ); // ---------------------------------------------------------------------------------- /*! @fn ButtonGroupMap ContainerSettings::GetButtonGroupContainer( ) - * @brief This function returns a container of buttons ordered by group. + * @brief This method returns a container of buttons ordered by group. * @return ButtonGroupMap A container with buttons */ ButtonGroupMap GetButtonGroupContainer( ); // ---------------------------------------------------------------------------------- /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) - * @brief This function returns a container with the name of the groups. + * @brief This method returns a container with the name of the groups. * @return KeyMapList A list with the name of the button groups. */ KeyMapList GetGroupNameList( ); // ---------------------------------------------------------------------------------- /*! void ContainerSettings::SetButtonGroupContainer( ButtonGroupMap m_ButtonGroupContainer ) - * @brief This function allows to create the ButtonGroupContainer. + * @brief This method allows to create the ButtonGroupContainer. * @param bgContainer The ButtonGroupMap with all buttons. */ void SetButtonGroupContainer( ButtonGroupMap bgContainer ); // ---------------------------------------------------------------------------------- /*! void ContainerSettings::SetGroupNameList( KeyMapList gNameList ) - * @brief This function sets a container with the name of the groups. + * @brief This method sets a container with the name of the groups. * @param gNameList the KeyMapList with all groupNames. */ void @@ -75,7 +91,7 @@ namespace creaButtonContainer * @fn ContainerSettings::AddButton( const std::string & groupName, const std::string buttonName, const std::string iconpath, const std::string buttonDescription, FunctionEventType event ) - * @brief This function adds a new button to the container. + * @brief This method adds a new button to the container. * @param groupName The name of the group of buttons. * @param buttonName The ID of the button. * @param iconpath The path of the button icon. @@ -89,7 +105,22 @@ namespace creaButtonContainer const std::string iconpath, const std::string buttonDescription, FunctionEventType event ); // ---------------------------------------------------------------------------------- - + /*! @fn void AddButton( BCSettingsStruct* info ); + * @brief This method adds a new button to the container. + * @exception std::bad_alloc + * @param info + */ + void + AddButton( BCSettingsStruct* info ); + // ---------------------------------------------------------------------------------- + /*! @fn void AddButtons( BCStructVectorType infoList ); + * @brief This method adds new buttons to the container. + * @exception std::bad_alloc + * @param infoList + */ + void + AddButtons( BCStructVectorType infoList ); + // ---------------------------------------------------------------------------------- private: ButtonGroupMap m_ButtonGroupContainer; //! View pointer. KeyMapList m_GroupNameList; //! - TConcreteFunctor< TClass >::TConcreteFunctor( TClass* _pt2Object, void - (TClass::*_fpt)( const ButtonIDType &buttonName ) ) - { - this->pt2Object = _pt2Object; - this->fpt = _fpt; - } - // ------------------------------------------------------------------------------- - // override operator "()" // execute member functions - template< typename TClass > - void - TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName ) - { - ( *pt2Object.*fpt )( buttonName ); - } - // ------------------------------------------------------------------------------- - // override function "Call" // execute member function - template< typename TClass > - void - TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName ) - { - ( *pt2Object.*fpt )( buttonName ); - } - }//ecapseman + namespace model + { + // constructor - takes pointer to an object and pointer to a member and stores + // them in two private variables + // ------------------------------------------------------------------------------- + template< typename TClass > + TConcreteFunctor< TClass >::TConcreteFunctor( TClass* _pt2Object, void + (TClass::*_fpt)( const ButtonIDType &buttonName ) ) + { + this->pt2Object = _pt2Object; + this->fpt = _fpt; + } + // ------------------------------------------------------------------------------- + // override operator "()" // execute member functions + template< typename TClass > + void + TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName ) + { + try + { + ( *pt2Object.*fpt )( buttonName ); + }//yrt + catch ( std::exception& e ) + { + std::cerr<< "TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName )" + <<" exception: " << e.what( ) << std::endl; + }//hctac + } + // ------------------------------------------------------------------------------- + // override function "Call" // execute member function + template< typename TClass > + void + TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName ) + { + try + { + ( *pt2Object.*fpt )( buttonName ); + }//yrt + catch ( std::exception& e ) + { + std::cerr<< "TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName )" + <<" exception: " << e.what( ) << std::endl; + }//hctac + } + }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h new file mode 100755 index 0000000..b78bdec --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h @@ -0,0 +1,38 @@ +/*! + * @file structBCSettings.h + * @brief Contains BCSettingsStruct structure. + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-05-24 + */ + +#ifndef STRUCTBCSETTINGS_H_ +#define STRUCTBCSETTINGS_H_ + +#include +#include "system.h" + +/*! @namespace + * @brief Contains the creaButtonContainer library included in creaMaracasVisu. + */ +namespace creaButtonContainer +{ + /*! @namespace + * @brief Contains the implementation of the model in creaButtonContainer library. + * @see MVC Software Architecture + */ + namespace model + { + /*! @struct structBCSettings.h "structBCSettings.h" + * @brief This is the Button Container Settings structure. + */ + struct BCSettingsStruct + { + std::string groupName; //! m_ButtonPair->first->first - << std::endl; - TFunctor* vTable[ ] = - { this->m_ButtonPair->second->second }; - vTable[ 0 ]->Call( this->m_ButtonPair->first->first ); + try + { + std::cout << "ButtonAction: " << this->m_ButtonPair->first->first + << std::endl; + TFunctor* vTable[ ] = + { this->m_ButtonPair->second->second }; + vTable[ 0 ]->Call( this->m_ButtonPair->first->first ); + }//yrt + catch ( std::exception& e ) + { + std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl; + }//hctac } // ---------------------------------------------------------------------------------- }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h index 0bcf6ae..71662a2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h @@ -2,7 +2,7 @@ * @file button.h * @brief Contains the Button class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef BUTTON_H @@ -27,9 +27,9 @@ namespace creaButtonContainer */ namespace view { - /*! @class Button : public wxBitmapButton button.h "button.h" + /*! @class Button button.h "button.h" * @brief This class contains the Button in the view perspective. - * @details This class contains the information of a button, it derives from wxBitmapButton + * @details This class contains the information of a button, it derives from wxBitmapButton. * @see wxBitmapButton */ class Button : public wxBitmapButton @@ -58,37 +58,38 @@ namespace creaButtonContainer ~Button( ); // ---------------------------------------------------------------------------------- /*! @fn long Button::GetID( ); - * @brief This function gets the wxID of the button. + * @brief This method gets the wxID of the button. * @return long wxID of the button. */ long GetID( ); // ---------------------------------------------------------------------------------- /*! @fn std::string Button::GetButtonName( ); - * @brief This function returns the name of the button. + * @brief This method returns the name of the button. * @return std::string The name of the button. */ std::string GetButtonName( ); // ---------------------------------------------------------------------------------- /*! @fn std::string Button::GetIconPath( ); - * @brief This function returns the iconPath of the button. + * @brief This method returns the iconPath of the button. * @return std::string The path of the icon. */ std::string GetIconPath( ); // ---------------------------------------------------------------------------------- /*! @fn std::string Button::GetDescription( ); - * @brief This function returns a the description of the button. + * @brief This method returns a the description of the button. * @return std::string The tooltip of the button. */ std::string GetDescription( ); // ---------------------------------------------------------------------------------- /*! @fn void Button::Execute( ); - * @brief This function executes the Functor (Call_Back Function). + * @brief This method executes the Functor (Call_Back Function). * This is the event of the button that it was defined to be called remotely using * call_back functions. In this project it was implemented using Functors. + * @exception std::bad_alloc * @see TFunctor */ void diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx index eb7acca..7aad096 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx @@ -2,7 +2,7 @@ * @file buttonGroup.cxx * @brief Implements the ButtonGroup class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "buttonContainerPanel.h" @@ -11,6 +11,7 @@ namespace creaButtonContainer { namespace view { + // ---------------------------------------------------------------------------------- ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings ) : wxScrolledWindow( @@ -25,47 +26,54 @@ namespace creaButtonContainer this->SetGroupContainer( factory.CreateButtonGroupContainer( this, settings ) ); this->PanelInit( ); - this->m_ButtonCController = new BCController(this); - this->m_ButtonCController->AddEvents(); + this->m_ButtonCController = new BCController( this ); + this->m_ButtonCController->AddEvents( ); this->SetEventHandler( this->m_ButtonCController ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonContainerPanel::~ButtonContainerPanel( ) { } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer ) { this->m_ButtonGroupList = groupContainer; } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonContainerPanel::PanelInit( ) { - this->m_Sizer = new Sizer( 0, 1, 0, 0 ); - for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it - != this->m_ButtonGroupList.end( ); ++it ) + try { - GroupManager* manager = new GroupManager( this, *it ); - this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager; - this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); - std::cout << "creaButtonContainer: New ButtonGroup Sizer Added" - << std::endl; - } - this->SetSizer( this->m_Sizer ); - this->FitSizer( ); + this->m_Sizer = new Sizer( 0, 1, 0, 0 ); + for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it + != this->m_ButtonGroupList.end( ); ++it ) + { + GroupManager* manager = new GroupManager( this, *it ); + this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager; + this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + std::cout << "creaButtonContainer: New ButtonGroup Sizer Added" + << std::endl; + } + this->SetSizer( this->m_Sizer ); + this->FitSizer( ); + }//yrt + catch ( std::exception& e ) + { + std::cerr << "ButtonContainerPanel::PanelInit( ) " << "exception: " + << e.what( ) << std::endl; + }//hctac } - - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonContainerPanel::FitSizer( ) { this->m_Sizer->Fit( this ); - this->m_Sizer->FitInside(this); - this->SetScrollRate(20,20); - this->m_Sizer->SetSizeHints(this); + this->m_Sizer->FitInside( this ); + this->SetScrollRate( 20, 20 ); + this->m_Sizer->SetSizeHints( this ); } - + // ---------------------------------------------------------------------------------- }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h index c65c693..a074b53 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h @@ -2,7 +2,7 @@ * @file buttonContainerController.h * @brief This contains the ButtonContainerController class * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef BUTTONCONTAINERPANEL_H @@ -46,11 +46,11 @@ namespace creaButtonContainer */ namespace view { - /*! @class ButtonContainerController buttonContainerController.h "buttonContainerController.h" - * @brief This class contains the ButtonContainerPanel controller. - * @details This class describes the button events, it derives from wxEvtHandler and it is the - * controller in the MVC. - * @see wxScrolledWindow + /*! @class ButtonContainerPanel buttonContainerPanel.h "buttonContainerPanel.h" + * @brief This class is the container of the creaButtonContainer. + * @details This class derives from wxScrolledWindow and manages the view of the buttonContainer. + * @bug The scrolled it doesn't work! (to be changed soon) + * @see wxScrolledWindow */ class ButtonContainerPanel : public wxScrolledWindow { @@ -121,20 +121,21 @@ namespace creaButtonContainer ~ButtonContainerPanel( ); // ---------------------------------------------------------------------------------- /*! @fn SetGroupContainer( ButtonGroupList groupContainer ); - * @brief This function sets the settings to the container. + * @brief This method sets the settings to the container. * @param groupContainer */ void SetGroupContainer( ButtonGroupList groupContainer ); // ---------------------------------------------------------------------------------- /*! @fn PanelInit( ); - * This function initializes the panel. + * This method initializes the panel. + * @exception std::bad_alloc */ void PanelInit( ); // ---------------------------------------------------------------------------------- /*! @fn FitSizer( ); - * This function fits and organizes the sizer. + * This method fits and organizes the sizer. */ void FitSizer( ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx index a242b91..5a0db8b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx @@ -2,7 +2,7 @@ * @file buttonGroup.cxx * @brief Implements the ButtonGroup class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "buttonGroup.h" @@ -11,46 +11,63 @@ namespace creaButtonContainer { namespace view { - //-------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonGroup::ButtonGroup( wxStaticText* groupName, ButtonContainer cartoButtons ) { this->m_GroupName = groupName; this->m_Buttons = cartoButtons; - } - //-------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonGroup::~ButtonGroup( ) { } - //-------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonGroup::ButtonContainer ButtonGroup::GetButtonContainer( ) { return ( this->m_Buttons ); } - //-------------------------------------------------- + // ---------------------------------------------------------------------------------- wxStaticText* ButtonGroup::GetGroupName( ) { return ( this->m_GroupName ); } - //-------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonGroup::IdButtonContainer ButtonGroup::GetButtonIdContainer( ) { - IdButtonContainer idContainer; - for( ButtonContainer::iterator it = this->m_Buttons.begin( ); it - != this->m_Buttons.end( ); ++it ) - idContainer.push_back( (*it).first ); - return ( idContainer ); + try + { + IdButtonContainer idContainer; + for( ButtonContainer::iterator it = this->m_Buttons.begin( ); it + != this->m_Buttons.end( ); ++it ) + { + idContainer.push_back( ( *it ).first ); + } + return ( idContainer ); + }//yrt + catch ( std::exception& e ) + { + std::cerr << "ButtonGroup::GetButtonIdContainer( )" << "exception: " + << e.what( ) << std::endl; + }//hctac } - //-------------------------------------------------- + // ---------------------------------------------------------------------------------- Button* ButtonGroup::GetButton( long id ) { - return( this->m_Buttons[id] ); + try + { + return ( this->m_Buttons[ id ] ); + }//yrt + catch ( std::exception& e ) + { + std::cerr << "ButtonGroup::GetButton( long id )" << "exception: " + << e.what( ) << std::endl; + }//hctac } - + // ---------------------------------------------------------------------------------- }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h index fd1c3b8..ce06428 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h @@ -2,7 +2,7 @@ * @file buttonGroup.h * @brief This contains the ButtonGroup class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef BUTTONGROUP_H @@ -27,8 +27,8 @@ namespace creaButtonContainer namespace view { /*! @class ButtonGroup buttonGroup.h "buttonGroup.h" - * @brief This class contains the group of buttons. - */ + * @brief This class contains the group of buttons. + */ class ButtonGroup { public: @@ -72,6 +72,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- /*! @fn GetButtonContainer( ); * @brief This method returns the button container. + * @exception std::bad_alloc * @return ButtonContainer. */ ButtonContainer @@ -79,6 +80,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- /*! @fn GetButtonIdContainer( ); * @brief This method returns a list of button IDs. + * @exception std::bad_alloc * @return */ IdButtonContainer diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx index 0461641..d855969 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx @@ -2,7 +2,7 @@ * @file buttonManager.cxx * @brief Implements the ButtonManager class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "buttonManager.h" @@ -11,54 +11,71 @@ namespace creaButtonContainer { namespace view { - + // ---------------------------------------------------------------------------------- ButtonManager::ButtonManager( ) : wxFlexGridSizer( 0, 1, 0, 0 ) { } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonManager::ButtonManager( ButtonGroup* buttonGroup ) : wxFlexGridSizer( 0, 1, 0, 0 ) { - this->SetGroupName( buttonGroup->GetGroupName( ) ); - this->SetButtonManager( buttonGroup->GetButtonContainer( ) ); + try + { + this->SetGroupName( buttonGroup->GetGroupName( ) ); + this->SetButtonManager( buttonGroup->GetButtonContainer( ) ); + }//yrt + catch ( std::exception& e ) + { + std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl; + }//hctac } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonManager::~ButtonManager( ) { } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonManager::SetGroupName( wxStaticText* groupName ) { this->m_GroupName = groupName; this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonManager::SetButtonManager( ButtonContainer buttonContainer ) { - if ( this->m_GroupName != NULL ) + try + { + if ( this->m_GroupName != NULL ) + { + this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 ); + for( ButtonContainer::iterator it = buttonContainer.begin( ); it + != buttonContainer.end( ); ++it ) + this->m_GridSizer->Add( ( *it ).second, -1, + wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + } + }//yrt + catch ( std::exception& e ) { - this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 ); - for( ButtonContainer::iterator it = buttonContainer.begin( ); it - != buttonContainer.end( ); ++it ) - this->m_GridSizer->Add( (*it).second, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, - 5 ); - this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); - } + std::cerr + << "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )" + << "exception: " << e.what( ) << std::endl; + }//hctac } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonManager::ShowButtonManager( ) { this->Show( this->m_GridSizer, true, false ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ButtonManager::HideButtonManager( ) { this->Show( this->m_GridSizer, false, false ); } + // ---------------------------------------------------------------------------------- }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h index 8fe99e5..d08cbdc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h @@ -2,7 +2,7 @@ * @file buttonManager.h * @brief This contains the ButtonManager class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef CARTOBUTTONCONTAINER_H @@ -29,8 +29,7 @@ namespace creaButtonContainer { /*! @class ButtonManager buttonManager.h "buttonManager.h" * @brief This class contains the ButtonManager view. - * @details This class describes a wxFlexGridSizer with the button manager, it derives from wxFlexGridSizer and it is the - * controller in the MVC. + * @details This class describes a wxFlexGridSizer with the button manager. * @see wxFlexGridSizer */ class ButtonManager : public wxFlexGridSizer @@ -56,7 +55,8 @@ namespace creaButtonContainer public: // ---------------------------------------------------------------------------------- /*! @fn ButtonManager( ); - * @brief This is the default construuctor. + * @brief This is the default constructor. + * @exception std::bad_alloc */ ButtonManager( ); // ---------------------------------------------------------------------------------- @@ -80,13 +80,14 @@ namespace creaButtonContainer SetGroupName( wxStaticText* groupName ); // ---------------------------------------------------------------------------------- /*! @fn ShowButtonManager( ); - * @brief This function shows the ButtonManager + * @brief This method shows the ButtonManager */ void ShowButtonManager( ); // ---------------------------------------------------------------------------------- /*! @fn HideButtonManager( ); - * @brief This function hides the ButtonManager. + * @brief This method hides the ButtonManager. + * @exception std::bad_alloc */ void HideButtonManager( ); @@ -94,7 +95,7 @@ namespace creaButtonContainer private: // ---------------------------------------------------------------------------------- /*! @fn SetButtonManager( ButtonContainer buttonContainer ); - * @brief This function set the buttons and it is private. + * @brief This method set the buttons and it is private. * @param buttonContainer */ void diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx index 507fc9e..bdb49d2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx @@ -2,7 +2,7 @@ * @file groupManager.cxx * @brief Implements the GroupManager class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #include "groupManager.h" @@ -11,7 +11,7 @@ namespace creaButtonContainer { namespace view { - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- GroupManager::GroupManager( wxWindow* parent, ButtonGroup* buttonGroup ) : wxFlexGridSizer( 1, 0, 0, 0 ) { @@ -23,47 +23,47 @@ namespace creaButtonContainer this->m_ButtonManager = new ButtonManager( buttonGroup ); this->Add( this->m_ButtonManager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- GroupManager::~GroupManager( ) { } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- long GroupManager::GetButtonID( ) { return ( this->m_IDExpButton ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- GroupManager::ExpansionButton* GroupManager::GetButton( ) { return ( this->m_ExpansionButton ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- ButtonManager* GroupManager::GetButtonManager( ) { return ( this->m_ButtonManager ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void GroupManager::SetButtonID( long id ) { this->m_IDExpButton = id; } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void GroupManager::SetButton( ExpansionButton* button ) { this->m_ExpansionButton = button; } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void GroupManager::SetButtonManager( ButtonManager* container ) { this->m_ButtonManager = container; } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void GroupManager::HideSubPanel( bool hide ) { @@ -72,6 +72,6 @@ namespace creaButtonContainer else this->m_ButtonManager->ShowButtonManager( ); } - // ------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h index aeb8dfd..c7d2ca5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h @@ -2,7 +2,7 @@ * @file groupManager.h * @brief This contains the GroupManager class * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-19 + * @date 2011-05-24 */ #ifndef GROUPMANAGER_H @@ -29,6 +29,11 @@ namespace creaButtonContainer */ namespace view { + /*! @class GroupManager groupManager.h "groupManager.h" + * @brief This class contains the GroupManager. + * @details This class describes a wxFlexGridSizer with the group manager. + * @see wxFlexGridSizer + */ class GroupManager : public wxFlexGridSizer { public: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx index 40701a9..7dcd9a4 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx @@ -1,134 +1,186 @@ -/*************************************************************** - * Name: buttonContainerSettings.cxx - * Purpose: It is the ButtonGroupSettings - * Author: Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * Modified: 2011-05-09 - * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/) - * License: - **************************************************************/ +/*! + * @file buttonContainerSettings.cxx + * @brief Implements the ButtonContainerSettings class. + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-05-24 + */ + #include "buttonContainerSettings.h" #include namespace creaPanelButtonContainer { - + // ---------------------------------------------------------------------------------- ButtonContainerSettings::ButtonContainerSettings( ) { } + // ---------------------------------------------------------------------------------- ButtonContainerSettings::~ButtonContainerSettings( ) { } - ButtonGroupMap + // ---------------------------------------------------------------------------------- + ButtonContainerSettings::ButtonGroupMap ButtonContainerSettings::GetButtonGroupContainer( ) { return m_ButtonGroupContainer; } - - KeyMapList + // ---------------------------------------------------------------------------------- + ButtonContainerSettings::KeyMapList ButtonContainerSettings::GetGroupNameList( ) { return m_GroupNameList; } - - //GetButtonPanel returns the panel asociated to de buttonAction - PanelButton + // ---------------------------------------------------------------------------------- + //GetButtonPanel returns the panel associated to the buttonAction + ButtonContainerSettings::PanelButton ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) { - for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it - != this->m_GroupNameList.end( ); ++it ) + try { - ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; - for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 ) + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) { - if ( ( *it1 )->first->first.compare( buttonName ) == 0 ) + ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; + for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 ) { - return ( ( *it1 )->second->second ); - }//fi + if ( ( *it1 )->first->first.compare( buttonName ) == 0 ) + { + return ( ( *it1 )->second->second ); + }//fi + }//rof }//rof - }//rof - return ( NULL ); + }//yrt + catch ( std::exception& e ) + { + std::cerr + << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) " + << "exception: " << e.what( ) << std::endl; + return ( NULL ); + }//hctac } - ButtonGroupSettings* + // ---------------------------------------------------------------------------------- + ButtonContainerSettings::ButtonGroupSettings* ButtonContainerSettings::GetButtonGroupSettings( TFunctor* functor ) { ButtonGroupSettings* settings = new ButtonGroupSettings( ); - for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it - != this->m_GroupNameList.end( ); ++it ) + try { - ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; - for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 ) + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) { - settings->AddButton( ( *it ), ( *it1 )->first->first, - ( *it1 )->first->second, ( *it1 )->second->first, functor ); + ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; + for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 ) + { + settings->AddButton( ( *it ), ( *it1 )->first->first, + ( *it1 )->first->second, ( *it1 )->second->first, functor ); + }//rof }//rof - }//rof - return ( settings ); + return ( settings ); + }//yrt + catch ( std::exception& e ) + { + std::cerr + << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) " + << "exception: " << e.what( ) << std::endl; + return ( NULL ); + }//hctac } + // ---------------------------------------------------------------------------------- void ButtonContainerSettings::SetButtonGroupContainer( ButtonGroupMap m_ButtonGroupContainer ) { this->m_ButtonGroupContainer = m_ButtonGroupContainer; } - + // ---------------------------------------------------------------------------------- void ButtonContainerSettings::SetGroupNameList( KeyMapList m_GroupNameList ) { this->m_GroupNameList = m_GroupNameList; } - + // ---------------------------------------------------------------------------------- void ButtonContainerSettings::AddButton( const std::string & groupName, const std::string &buttonName, const std::string &iconpath, const std::string &buttonDescription, PanelButton panel ) { - //builds the button information - panel->Show( false ); - ButtonPair* pair = new ButtonPair( new ButtonInfo( buttonName, iconpath ), - new ActionButton( buttonDescription, panel ) ); - for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it - != this->m_GroupNameList.end( ); ++it ) + try { - if ( ( *it ).compare( groupName ) == 0 ) + //builds the button information + panel->Show( false ); + ButtonPair* pair = new ButtonPair( + new ButtonInfo( buttonName, iconpath ), + new ActionButton( buttonDescription, panel ) ); + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) { - this->m_ButtonGroupContainer[ groupName ].push_back( pair ); - return; - }//fi - }//rof - this->m_GroupNameList.push_back( groupName ); - this->m_ButtonGroupContainer[ groupName ].push_back( pair ); + if ( ( *it ).compare( groupName ) == 0 ) + { + this->m_ButtonGroupContainer[ groupName ].push_back( pair ); + return; + }//fi + }//rof + this->m_GroupNameList.push_back( groupName ); + this->m_ButtonGroupContainer[ groupName ].push_back( pair ); + }//yrt + catch ( 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 ) " + << "exception: " << e.what( ) << std::endl; + }//hctac } - + // ---------------------------------------------------------------------------------- void - ButtonContainerSettings::AddButton( BCSettingsStruct* info ) + ButtonContainerSettings::AddButton( BCPSettingsStruct* info ) { - //builds the button information - info->panel->Show( false ); - ButtonPair* pair = new ButtonPair( - new ButtonInfo( info->buttonName, info->iconpath ), - new ActionButton( info->buttonDescription, info->panel ) ); - for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it - != this->m_GroupNameList.end( ); ++it ) + try { - if ( ( *it ).compare( info->groupName ) == 0 ) + //builds the button information + info->panel->Show( false ); + ButtonPair* pair = new ButtonPair( + new ButtonInfo( info->buttonName, info->iconpath ), + new ActionButton( info->buttonDescription, info->panel ) ); + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) { - this->m_ButtonGroupContainer[ info->groupName ].push_back( pair ); - return; - }//fi - }//rof - this->m_GroupNameList.push_back( info->groupName ); - this->m_ButtonGroupContainer[ info->groupName ].push_back( pair ); + if ( ( *it ).compare( info->groupName ) == 0 ) + { + this->m_ButtonGroupContainer[ info->groupName ].push_back( pair ); + return; + }//fi + }//rof + this->m_GroupNameList.push_back( info->groupName ); + this->m_ButtonGroupContainer[ info->groupName ].push_back( pair ); + } + catch ( std::exception& e ) + { + std::cerr + << "ButtonContainerSettings::AddButton( BCPSettingsStruct* info )" + << "exception: " << e.what( ) << std::endl; + }//hctac } - + // ---------------------------------------------------------------------------------- void ButtonContainerSettings::AddButtons( BCStructVectorType infoList ) { - for( BCStructVectorType::iterator it = infoList.begin( ); it - != infoList.end( ); ++it ) + try + { + for( BCStructVectorType::iterator it = infoList.begin( ); it + != infoList.end( ); ++it ) + { + this->AddButton( *it ); + }//rof + } + catch ( std::exception& e ) { - this->AddButton( *it ); - }//rof + std::cerr + << "ButtonContainerSettings::AddButtons( BCStructVectorType infoList )" + << "exception: " << e.what( ) << std::endl; + }//hctac } - +// ---------------------------------------------------------------------------------- }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h index 55b6e2c..ff61b63 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h @@ -1,11 +1,9 @@ -/*************************************************************** - * Name: buttonContainerSettings.h - * Purpose: It is the ButtonGroupSettings - * Author: Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * Modified: 2011-05-09 - * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/) - * License: - **************************************************************/ +/*! + * @file buttonContainerSettings.h + * @brief This contains the ButtonContainerSettings class. + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-05-24 + */ #ifndef BUTTONCONTAINERSETTINGS_H_ #define BUTTONCONTAINERSETTINGS_H_ @@ -15,55 +13,172 @@ #include #include -#include "structButtonContainerSettings.h" +#include "structBCPSettings.h" #include "containerSettings.h" #include "functor.h" +/*! @namespace + * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu. + */ namespace creaPanelButtonContainer { - typedef creaButtonContainer::model::TFunctor TFunctor; - typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings; - typedef wxPanel* PanelButton; - //First is the button description, Second FunctionEventType - typedef std::pair< std::string, PanelButton > ActionButton; - //First is the ButtonName and Second is the ImageIconPath - typedef std::pair< std::string, std::string > ButtonInfo; - typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair; - typedef std::list< std::string > KeyMapList; - typedef std::list< ButtonPair* > ButtonList; - typedef std::map< std::string, ButtonList > ButtonGroupMap; - typedef std::vector< BCSettingsStruct* > BCStructVectorType; + /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h" + * @brief This class contains the settings of the buttons. + */ class ButtonContainerSettings { public: + //typedef definition. + /*! typedef creaButtonContainer::model::TFunctor TFunctor; + * @brief Defines the TFunctor type. + */ + typedef creaButtonContainer::model::TFunctor TFunctor; + // ---------------------------------------------------------------------------------- + /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings; + * @brief Defines the ButtonGroupSettings type. + */ + typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings; + // ---------------------------------------------------------------------------------- + /*! @typedef wxPanel* PanelButton; + * @brief Defines the PanelButton type. + */ + typedef wxPanel* PanelButton; + // ---------------------------------------------------------------------------------- + /*! @typedef std::pair< std::string, PanelButton > ActionButton; + * @brief Defines the ActionButton type. + * First is the button description, Second FunctionEventType + */ + typedef std::pair< std::string, PanelButton > ActionButton; + // ---------------------------------------------------------------------------------- + /*! @typedef std::pair< std::string, std::string > ButtonInfo; + * @brief Defines the ButtonInfo type. + * First is the ButtonName, Second is the ImageIconPath + */ + typedef std::pair< std::string, std::string > ButtonInfo; + // ---------------------------------------------------------------------------------- + /*! @typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair; + * @brief Defines the ButtonPair type. + */ + typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair; + // ---------------------------------------------------------------------------------- + /*! @typedef std::list< std::string > KeyMapList; + * @brief Defines the KeyMapList type. + */ + typedef std::list< std::string > KeyMapList; + // ---------------------------------------------------------------------------------- + /*! @typedef std::list< ButtonPair* > ButtonList; + * @brief Defines the ButtonList type. + */ + typedef std::list< ButtonPair* > ButtonList; + // ---------------------------------------------------------------------------------- + /*! @typedef std::map< std::string, ButtonList > ButtonGroupMap; + * @brief Defines the ButtonGroupMap type. + */ + typedef std::map< std::string, ButtonList > ButtonGroupMap; + // ---------------------------------------------------------------------------------- + /*! @typedef std::vector< BCPSettingsStruct* > BCStructVectorType; + * @brief Defines the BCStructVectorType type. + */ + typedef std::vector< BCPSettingsStruct* > BCStructVectorType; + //end typedef definition + // ---------------------------------------------------------------------------------- + /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h" + * @brief This class contains the settings of the button container. + */ + public: + // ---------------------------------------------------------------------------------- + /*! @fn ButtonContainerSettings( ); + * @brief This is the default constructor. + */ ButtonContainerSettings( ); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~ButtonContainerSettings( ); + * @brief This is the destructor. + */ virtual ~ButtonContainerSettings( ); + // ---------------------------------------------------------------------------------- + /*! @fn ButtonGroupMap GetButtonGroupContainer( ); + * @brief This method returns ButtonGroupMap with all buttons. + * @return + */ ButtonGroupMap GetButtonGroupContainer( ); + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList GetGroupNameList( ); + * @brief This method returns a KeyMapsList with the name of the groups. + * @return + */ KeyMapList GetGroupNameList( ); + // ---------------------------------------------------------------------------------- + /*! @fn PanelButton GetPanelButton( const std::string &buttonName ); + * @brief This method returns the panel of a button. + * @param buttonName + * @exception std::bad_alloc + * @return + */ PanelButton GetPanelButton( const std::string &buttonName ); + // ---------------------------------------------------------------------------------- + /*! @fn ButtonGroupSettings* GetButtonGroupSettings( TFunctor* functor ); + * @brief this method return the settings the generic settings for creaButtonContainer. + * @param functor + * @exception std::bad_alloc + * @return + */ ButtonGroupSettings* GetButtonGroupSettings( TFunctor* functor ); + // ---------------------------------------------------------------------------------- + /*! @fn void SetButtonGroupContainer( ButtonGroupMap bGroupContainer ); + * @brief This method sets the button group container. + * @param bGroupContainer + */ void - SetButtonGroupContainer( ButtonGroupMap m_ButtonGroupContainer ); + SetButtonGroupContainer( ButtonGroupMap bGroupContainer ); + // ---------------------------------------------------------------------------------- + /*! @fn void SetGroupNameList( KeyMapList gNameList ); + * @brief this method sets the groupName list + * @param gNameList + */ void - SetGroupNameList( KeyMapList m_GroupNameList ); + SetGroupNameList( KeyMapList gNameList ); + // ---------------------------------------------------------------------------------- + /*! @fn void AddButton( const std::string &groupName, const std::string &buttonName, + const std::string &iconpath, const std::string &buttonDescription, + PanelButton panel ); + * @brief This method adds a new button into a group of buttons. + * @param groupName + * @param buttonName + * @param iconpath + * @param buttonDescription + * @param panel + * @exception std::bad_alloc + */ void AddButton( const std::string &groupName, const std::string &buttonName, const std::string &iconpath, const std::string &buttonDescription, PanelButton panel ); + // ---------------------------------------------------------------------------------- + /*! @fn void AddButton( BCPSettingsStruct* info ); + * @brief This method adds a new button into a group of buttons. + * @param info + * @exception std::bad_alloc + */ void - AddButton( BCSettingsStruct* info ); - + AddButton( BCPSettingsStruct* info ); + // ---------------------------------------------------------------------------------- + /*! @fn void AddButtons( BCStructVectorType infoList ); + * @brief This method adds new buttons into the container. + * @param infoList + * @exception std::bad_alloc + */ void AddButtons( BCStructVectorType infoList ); - + // ---------------------------------------------------------------------------------- private: - ButtonGroupMap m_ButtonGroupContainer; - KeyMapList m_GroupNameList; + ButtonGroupMap m_ButtonGroupContainer; //! TConcreteFunctor; - + // ---------------------------------------------------------------------------------- PanelButtonContainer::PanelButtonContainer( wxWindow* parent, - ButtonContainerSettings* bcSettings ) : + ButtonContainerSettings* bcSettings ) : wxPanel( parent, -1, wxDefaultPosition, wxSize( 300, 700 ), wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") ) { @@ -33,21 +31,22 @@ namespace creaPanelButtonContainer // CartoSettingsPanel Management this->m_AuiManager->AddPane( this->m_ButtonPanel, - wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( - _("Panel") ). CaptionVisible( ).CloseButton( false ).Left( ).MinSize(wxSize(300,300)) ); + wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible( ).CloseButton( + false ).Left( ).MinSize( wxSize( 300, 300 ) ) ); //CartoButtonPanel Management this->m_AuiManager->AddPane( this->m_ButtonContainerPanel, wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption( - _("creaButtonContainer") ). CaptionVisible( ).CloseButton( false ).Left( ) .MinSize(wxSize(300,300) ) ); + _("creaButtonContainer") ). CaptionVisible( ).CloseButton( false ).Left( ) .MinSize( + wxSize( 300, 300 ) ) ); this->m_AuiManager->Update( ); //this->createGimmick(); } - + // ---------------------------------------------------------------------------------- PanelButtonContainer::~PanelButtonContainer( ) { } - + // ---------------------------------------------------------------------------------- void PanelButtonContainer::UpdatePanel( const std::string &buttonName ) { @@ -62,13 +61,13 @@ namespace creaPanelButtonContainer //Updating the manager this->m_AuiManager->Update( ); } - + // ---------------------------------------------------------------------------------- void PanelButtonContainer::GenericButtonEvent( const std::string &buttonName ) { this->UpdatePanel( buttonName ); } - +// ---------------------------------------------------------------------------------- }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h index d49ac59..6579b63 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h @@ -1,11 +1,9 @@ -/*************************************************************** - * Name: pCartoGUIManager.h - * Purpose: Defines Application Frame - * Author: Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * Modified: 2011-05-09 - * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/) - * License: - **************************************************************/ +/*! + * @file PanelButtonContainer + * @brief This contains the ButtonContainerSettings class. + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-05-24 + */ #ifndef PANELBUTTONCONTAINER_H_ #define PANELBUTTONCONTAINER_H_ @@ -19,30 +17,70 @@ #include "buttonContainerSettings.h" #include "functor.h" +/*! @namespace + * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu. + */ namespace creaPanelButtonContainer { - - typedef creaPanelButtonContainer::ButtonContainerSettings - ButtonContainerSettings; - typedef creaButtonContainer::view::ButtonContainerPanel ButtonContainerPanel; + /*! @class PanelButtonContainer panelButtonContainer.h "panelButtonContainer.h" + * @brief This class contains the PanelButtonContainer. It derives from wxPanel. + * @see wxPanel + */ class PanelButtonContainer : public wxPanel { public: + //typedef definition. + /*! typedef creaButtonContainer::model::TFunctor TFunctor; + * @brief Defines the TFunctor type. + */ + typedef creaPanelButtonContainer::ButtonContainerSettings + ButtonContainerSettings; + /*! typedef creaButtonContainer::model::TFunctor TFunctor; + * @brief Defines the TFunctor type. + */ + typedef creaButtonContainer::view::ButtonContainerPanel + ButtonContainerPanel; + // ---------------------------------------------------------------------------------- + //end of typedef definition. + public: + // ---------------------------------------------------------------------------------- + /*! @fn PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings ); + * @brief This is the parameterized constructor. + * @param parent + * @param bcSettings + */ PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings ); + // ---------------------------------------------------------------------------------- + /*! @fn virtual PanelButtonContainer( ); + * @brief This is the destructor. + */ virtual ~PanelButtonContainer( ); + // ---------------------------------------------------------------------------------- + /*! @fn void UpdatePanel( const std::string &buttonName ); + * @brief This method Updates the m_ButtonPanel for a panel + * of the clicked button in creaButtonContainer. + * @param buttonName + */ void UpdatePanel( const std::string &buttonName ); + // ---------------------------------------------------------------------------------- + /*! @fn void GenericButtonEvent( const std::string &buttonName ); + * @brief This method is the function that calls the panels contained in the buttons + * (in creaButtonContainer is the function contained in the functors to be called back. + * @param buttonName + */ void GenericButtonEvent( const std::string &buttonName ); + // ---------------------------------------------------------------------------------- private: //Settings - ButtonContainerSettings* m_ButtonContainerSettings; + ButtonContainerSettings* m_ButtonContainerSettings; //! +#include + +/*! @namespace + * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu. + */ +namespace creaPanelButtonContainer +{ + /*! @struct structBCPSettings.h "structBCPSettings.h" + * @brief This is the Button Container Settings structure. + */ + struct BCPSettingsStruct + { + std::string groupName; //! -#include - -typedef std::string StringType; -typedef wxPanel PanelButton; - -struct BCSettingsStruct -{ - StringType groupName; - StringType buttonName; - StringType iconpath; - StringType buttonDescription; - PanelButton* panel; -}; -#endif //STRUCTBUTTONCONTAINERSETTINGS_H_ -- 2.45.1