From: Diego Caceres Date: Thu, 19 May 2011 07:43:10 +0000 (+0000) Subject: creaButtonContainer: Updates in documentation, adding try catch clauses and cleaning... X-Git-Tag: v1.0.4~118 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ab19f727dc01a9995b16b2a3c82783050728233e;p=creaMaracasVisu.git creaButtonContainer: Updates in documentation, adding try catch clauses and cleaning code. :) :) --- 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 ecbf950..1750930 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx @@ -58,13 +58,13 @@ namespace creaButtonContainer & ButtonContainerController::ButtonEvent ); }//rof }//rof - } + }//yrt catch ( std::exception& e ) { std::cerr << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " << e.what( ) << std::endl; - } + }//hctac } // ---------------------------------------------------------------------------------- void @@ -79,41 +79,43 @@ namespace creaButtonContainer this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel( _( "-" ) ); this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( false ); - } + }//fi else if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp( _( "-" ) ) == 0 ) { this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel( _( "+" ) ); this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( true ); - } + }//fi esle this->m_BCPanel->FitSizer( ); - } + }//yrt catch ( std::exception& e ) { std::cerr << "ButtonContainerController::AddEvents( ) exception: " << e.what( ) << std::endl; - } + }//hctac } // ---------------------------------------------------------------------------------- void ButtonContainerController::ButtonEvent( wxCommandEvent& event ) { - for( ButtonGroupList::iterator it = - this->m_BCPanel->m_ButtonGroupList.begin( ); it - != this->m_BCPanel->m_ButtonGroupList.end( ); ++it ) + try { - try + for( ButtonGroupList::iterator it = + this->m_BCPanel->m_ButtonGroupList.begin( ); it + != this->m_BCPanel->m_ButtonGroupList.end( ); ++it ) { + ( *it )->GetButton( event.GetId( ) )->Execute( ); - } - catch ( std::exception& e ) - { - std::cerr - << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " - << e.what( ) << std::endl; - } - } + + }//rof + }//yrt + catch ( std::exception& e ) + { + std::cerr + << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " + << e.what( ) << std::endl; + }//hctac } // ---------------------------------------------------------------------------------- }//ecapsename 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 7acc0d9..eda556b 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 @@ * 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 + * Modified: 2011-05-18 * Copyright: * License: ***************************************************************************************/ @@ -35,21 +35,24 @@ namespace creaButtonContainer ButtonGroupMap map = settings->GetButtonGroupContainer( ); for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it ) { + //using wxWidgets. wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 ); wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux, wxDefaultPosition, wxDefaultSize, 0, _T( "GroupText" ) ); + //creating a wxButtonGroup. ButtonGroup* group = new ButtonGroup( wxGroupName, this->GetButtons( parent, ( *it ).second ) ); + //adding the group to the container. groupView.push_back( group ); - } - } + }//rof + }//yrt catch ( std::exception& e ) { std::cerr << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " << e.what( ) << std::endl; - } + }//chtac return ( groupView ); } // ---------------------------------------------------------------------------------- @@ -66,13 +69,13 @@ namespace creaButtonContainer buttonList[ id ] = new Button( parent, id, *it ); } return ( buttonList ); - } + }//yrt catch ( std::exception& e ) { std::cerr << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: " << e.what( ) << std::endl; - } + }//chtac } // ---------------------------------------------------------------------------------- }//ecapseman 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 6160910..cb29a68 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.h @@ -38,8 +38,6 @@ namespace creaButtonContainer //! @namespace namespace model { - //! @class ButtonGroupFactory - //! @brief This class is the factory of a group of wxButtons. /*! @class ButtonGroupFactory buttonGroupFactory.h "buttonGroupFactory.h" * @brief This class contains the ButtonContainer factory. 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 7a7da40..fc12196 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx @@ -1,51 +1,55 @@ -/*************************************************************** - * Name: ButtonGroupSettings.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/) +/************************************************************************************//*! + * Name: @file buttonContainerController.cxx + * Purpose: @brief This contains the ButtonContainerController class implementation + * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * Modified: 2011-05-18 + * Copyright: * License: - **************************************************************/ + ***************************************************************************************/ + +//! @include "containerSettings.h" #include "containerSettings.h" +//! @namespace namespace creaButtonContainer { + //! @namespace namespace model { - + // ---------------------------------------------------------------------------------- ContainerSettings::ContainerSettings( ) { } - + // ---------------------------------------------------------------------------------- ContainerSettings::~ContainerSettings( ) { } - + // ---------------------------------------------------------------------------------- ButtonGroupMap ContainerSettings::GetButtonGroupContainer( ) { - return m_ButtonGroupContainer; + return this->m_ButtonGroupContainer; } - + // ---------------------------------------------------------------------------------- KeyMapList ContainerSettings::GetGroupNameList( ) { - return m_GroupNameList; + return this->m_GroupNameList; } - + // ---------------------------------------------------------------------------------- void ContainerSettings::SetButtonGroupContainer( - ButtonGroupMap m_ButtonGroupContainer ) + ButtonGroupMap bgContainer ) { - this->m_ButtonGroupContainer = m_ButtonGroupContainer; + this->m_ButtonGroupContainer = bgContainer; } - + // ---------------------------------------------------------------------------------- void - ContainerSettings::SetGroupNameList( KeyMapList m_GroupNameList ) + ContainerSettings::SetGroupNameList( KeyMapList gNameList ) { - this->m_GroupNameList = m_GroupNameList; + this->m_GroupNameList = gNameList; } - + // ---------------------------------------------------------------------------------- void ContainerSettings::AddButton( const std::string & groupName, const std::string buttonName, const std::string iconpath, @@ -53,18 +57,30 @@ namespace creaButtonContainer { ButtonPair* pair = new ButtonPair( new ButtonInfo( buttonName, iconpath ), - new ActionButton( buttonDescription, event ) ); - for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it - != this->m_GroupNameList.end( ); ++it ) - if ( ( *it ).compare( groupName ) == 0 ) + new ButtonAction( buttonDescription, event ) ); + try + { + 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 + << "ContainerSettings::AddButton( const std::string & groupName," + << "const std::string buttonName, const std::string iconpath," + << "const std::string buttonDescription, FunctionEventType event ) 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 6d10f7a..d0680e7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h @@ -1,87 +1,101 @@ -/*************************************************************** +/************************************************************************************//*! * Name: @file containerSettings.h - * Purpose: @brief This contains ContainerSettings class + * Purpose: @brief This contains the ContainerSettings class * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * Modified: 2011-05-09 - * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/) + * Modified: 2011-05-18 + * Copyright: * License: - **************************************************************/ + ***************************************************************************************/ #ifndef BUTTONGROUPSETTINGS_H_ #define BUTTONGROUPSETTINGS_H_ +//! @include #include +//! @include #include +//! @include #include +//! @include "system.h" #include "system.h" - +//! @include "functor" #include "functor.h" -///@namespace +//! @namespace namespace creaButtonContainer { - ///@namespace + //! @namespace namespace model { - /*! - * @class ContainerSettings - * @brief This class contains all information of groups and its buttons + /*! @class ContainerSettings containerSettings.h "containerSettings.h" + * @brief This class contains the settings of the button container. + * This class describes how to add new buttons to the container. */ class ContainerSettings { public: - /*! - * @brief This is the default constructor + // ---------------------------------------------------------------------------------- + /*! @fn void ContainerSettings::ContainerSettings( ) + * @brief This is the constructor. */ ContainerSettings( ); + // ---------------------------------------------------------------------------------- + /*! @fn ContainerSettings::~ContainerSettings( ) + * @brief This is the destructor. + */ virtual ~ContainerSettings( ); - /*! - * @brief This function allows to create the ButtonGroupContainer. - * @param the wxWindow* parent to be attached. - * @param The Container settings. - * @return The wx button group container. + // ---------------------------------------------------------------------------------- + /*! @fn ButtonGroupMap ContainerSettings::GetButtonGroupContainer( ) + * @brief This function returns a container of buttons ordered by group. + * @return ButtonGroupMap A container with buttons */ ButtonGroupMap GetButtonGroupContainer( ); - /*! - * @brief This function allows to create the ButtonGroupContainer. - * @param the wxWindow* parent to be attached. - * @param The Container settings. - * @return The wx button group container. + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) + * @brief This function returns a container with the name of the groups. + * @return KeyMapList A list with the name of the button groups. */ KeyMapList GetGroupNameList( ); - /*! - * @brief This function allows to create the ButtonGroupContainer. - * @param the wxWindow* parent to be attached. - * @param The Container settings. - * @return The wx button group container. + // ---------------------------------------------------------------------------------- + /*! void ContainerSettings::SetButtonGroupContainer( ButtonGroupMap m_ButtonGroupContainer ) + * @brief This function allows to create the ButtonGroupContainer. + * @param bgContainer The ButtonGroupMap with all buttons. */ void - SetButtonGroupContainer( ButtonGroupMap m_ButtonGroupContainer ); - /*! - * @brief This function allows to create the ButtonGroupContainer. - * @param the wxWindow* parent to be attached. - * @param The Container settings. - * @return The wx button group container. + SetButtonGroupContainer( ButtonGroupMap bgContainer ); + // ---------------------------------------------------------------------------------- + /*! void ContainerSettings::SetGroupNameList( KeyMapList gNameList ) + * @brief This function sets a container with the name of the groups. + * @param gNameList the KeyMapList with all groupNames. */ void - SetGroupNameList( KeyMapList m_GroupNameList ); + SetGroupNameList( KeyMapList gNameList ); + // ---------------------------------------------------------------------------------- /*! - * @brief This function allows to create the ButtonGroupContainer. - * @param the wxWindow* parent to be attached. - * @param The Container settings. - * @return The wx button group container. + * @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. + * @param groupName The name of the group of buttons. + * @param buttonName The ID of the button. + * @param iconpath The path of the button icon. + * @param buttonDescription The description of the button. + * @param event The event associated to the button. + * @see class Functor, ConcreteFunctor for add an event for a button. + * @exception std::bad_alloc */ void AddButton( const std::string & groupName, const std::string buttonName, const std::string iconpath, const std::string buttonDescription, FunctionEventType event ); + // ---------------------------------------------------------------------------------- private: - ButtonGroupMap m_ButtonGroupContainer; - KeyMapList m_GroupNameList; + ButtonGroupMap m_ButtonGroupContainer; //! View pointer. + KeyMapList m_GroupNameList; //! #include +//! @namespace namespace creaButtonContainer { + //! @namespace namespace model { + /*! @typedef std::string ButtonIDType; + * @brief Defines the ButtonIDType type. + */ typedef std::string ButtonIDType; - // abstract base class + + /*! @class TFunctor functor.h "functor.h" + * @brief This is an abstract class for call_back functions. + */ class TFunctor { public: // two possible functions to call member function. virtual cause derived // classes will use a pointer to an object and a pointer to a member function - // to make the function call + /*! @fn virtual void TFunctor::operator()( const ButtonIDType &buttonName ) + * @brief To make the function call. + * Call_Back function. + * @param buttonName + */ virtual void operator()( const ButtonIDType &buttonName )=0; // call using operator + /*! @fn + * @brief Call using function. + * Call_Back function. + * @param buttonName + */ virtual void Call( const ButtonIDType &buttonName )=0; - // call using function }; // derived template class + /*! @tparam + * @brief It makes TConcreteFunctor usable for all Classes. + */ template< typename TClass > + /*! @class TConcreteFunctor: public TFunctor functor.h "functor.h" + * @brief This class contains the ButtonContainer factory. + * This class describes the factory of the ButtonContainer using design patterns. + */ class TConcreteFunctor : public TFunctor { public: - // constructor - takes pointer to an object and pointer to a member and stores - // them in two private variables + /*! @fn TConcreteFunctor::TConcreteFunctor( TClass* _pt2Object, void + (TClass::*_fpt)( const ButtonIDType &buttonName ) ); + * @brief This is the parameterized constructor. + * Takes pointer to an object and pointer to a member and stores them in two private variables + * @param _pt2Object Pointer to object. + * @param _fpt Pointer to the function. + * @param buttonName The ID of the button (ButtonName). + */ TConcreteFunctor( TClass* _pt2Object, void (TClass::*_fpt)( const ButtonIDType &buttonName ) ); - // override operator "()" // execute member function + // ------------------------------------------------------------------------------- + /*! @fn virtual void TConcreteFunctor::operator()( const ButtonIDType &buttonName ); + * @brief Override operator "()". Execute member function. + * @see TFunctor + * @param buttonName + */ virtual void operator()( const ButtonIDType &buttonName ); - // override function "Call" // execute member function + // ------------------------------------------------------------------------------- + /*! @fn virtual void TConcreteFunctor::Call( const ButtonIDType &buttonName ); + * @brief Override function "Call". Execute member function + * @see TFunctor + * @param buttonName + */ virtual void Call( const ButtonIDType &buttonName ); + // ------------------------------------------------------------------------------- private: - void - (TClass::*fpt)( const ButtonIDType &buttonName ); - // pointer to member function - TClass* pt2Object; - // pointer to object + void (TClass::*fpt)( const ButtonIDType &buttonName ); //! TConcreteFunctor< TClass >::TConcreteFunctor( TClass* _pt2Object, void (TClass::*_fpt)( const ButtonIDType &buttonName ) ) { - pt2Object = _pt2Object; - fpt = _fpt; + this->pt2Object = _pt2Object; + this->fpt = _fpt; } + // ------------------------------------------------------------------------------- // override operator "()" // execute member functions template< typename TClass > void @@ -27,6 +29,7 @@ namespace creaButtonContainer { ( *pt2Object.*fpt )( buttonName ); } + // ------------------------------------------------------------------------------- // override function "Call" // execute member function template< typename TClass > void diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h index 55beaf4..13367bd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h @@ -1,32 +1,65 @@ -/*************************************************************** - * Name: TFunctor - * Purpose: Call_Back Functions - * 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 system.h + * Purpose: @brief contains a system typedefs used to reuse code. + * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * Modified: 2011-05-18 + * Copyright: * License: - **************************************************************/ + ***************************************************************************************/ #ifndef SYSTEM_H_ #define SYSTEM_H_ +//! @include #include +//! @include #include +//! @include #include +//! @include "functor.h" #include "functor.h" ///@namespace namespace creaButtonContainer { - typedef model::TFunctor* FunctionEventType; - //First is the button description, Second FunctionEventType - typedef std::pair< std::string, FunctionEventType > 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 model::TFunctor* FunctionEventType; + * @brief Defines the FunctionEventType type. + * + */ + typedef model::TFunctor* FunctionEventType; + // ---------------------------------------------------------------------------------- + /*! @typedef creaButtonContainer::view::Button Button; + * @brief Defines the ActionButton type. + * First is the button description, Second FunctionEventType + */ + typedef std::pair< std::string, FunctionEventType > ButtonAction; + // ---------------------------------------------------------------------------------- + /*! @typedef std::pair< std::string, std::string > ButtonInfo; + * @brief Defines the ButtonInfo type. + * First is the ButtonName and Second is the IconPath + */ + typedef std::pair< std::string, std::string > ButtonInfo; + // ---------------------------------------------------------------------------------- + /*! @typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair; + * @brief Defines the ButtonPair type. + */ + typedef std::pair< ButtonInfo*, ButtonAction* > 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; +// ---------------------------------------------------------------------------------- } #endif /* SYSTEM_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx index d936a53..15ad6fc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx @@ -7,14 +7,16 @@ * License: **************************************************************/ +//! @include "button.h" #include "button.h" -#include +//! @namespace namespace creaButtonContainer { + //! @namespace namespace view { - //-------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- Button::Button( wxWindow* parent, long id, ButtonPair* pair ) { this->m_ButtonPair = pair; @@ -24,43 +26,45 @@ namespace creaButtonContainer wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 ); wxString imageIcon( wXiconPath.c_str( ), wxConvUTF8 ); wxString description( wXdescription.c_str( ), wxConvUTF8 ); + //creating the button. this->Create( parent, id, wxBitmap( wxImage( imageIcon, wxBITMAP_TYPE_ANY, -1 ) ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, buttonName ); this->SetToolTip( description ); } - //-------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- Button::~Button( ) { } - //-------------------------------------------------------------------- - //-------------------------------------------------------------------- - string + // ---------------------------------------------------------------------------------- + std::string Button::GetButtonName( ) { - return( this->m_ButtonPair->first->first ); + return ( this->m_ButtonPair->first->first ); } - //-------------------------------------------------------------------- - string + // ---------------------------------------------------------------------------------- + std::string Button::GetIconPath( ) { - return( this->m_ButtonPair->first->second ); + return ( this->m_ButtonPair->first->second ); } - //-------------------------------------------------------------------- - string + // ---------------------------------------------------------------------------------- + std::string Button::GetDescription( ) { - return( this->m_ButtonPair->second->first ); + return ( this->m_ButtonPair->second->first ); } - //-------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void Button::Execute( ) { - std::cout << "ButtonAction: "<< this->m_ButtonPair->first->first <m_ButtonPair->second->second}; - vTable[0]->Call( this->m_ButtonPair->first->first ); + 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 ); } - + // ---------------------------------------------------------------------------------- }//ecapseman }//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 4ef2af9..ea30b20 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h @@ -1,56 +1,98 @@ -/*************************************************************** - * Name: Button.h - * Purpose: Defines a Button - * 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 button.h + * Purpose: @brief This contains the Button class + * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * Modified: 2011-05-18 + * Copyright: * License: - **************************************************************/ + ***************************************************************************************/ #ifndef BUTTON_H #define BUTTON_H +//! @include #include +//! @include < #include +//! @include #include +//! @include #include +//! @include +#include +//! @include "functor.h" #include "functor.h" +//! @include "system.h" #include "system.h" -using std::string; - +//! @namespace namespace creaButtonContainer { + //! @namespace namespace view { - /** - Class Description: This class defines a wxBitmapButton. - **/ - class Button : public wxBitmapButton - { - public: - //Typedef definition - typedef creaButtonContainer::model::TFunctor TFunctor; - public: - //-------------------------------------------------------------------- - Button( wxWindow* parent, long id, ButtonPair* pair ); - virtual - ~Button( ); - //-------------------------------------------------------------------- - long - GetID( ); - string - GetButtonName( ); - string - GetIconPath( ); - string - GetDescription( ); - //-------------------------------------------------------------------- - void - Execute( ); - private: - ButtonPair* m_ButtonPair; - }; + /*! @class ContainerSettings containerSettings.h "containerSettings.h" + * @brief This class contains the settings of the button container. + * This class describes how to add new buttons to the container. + */ + class Button : public wxBitmapButton + { + public: + /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel; + * @brief Defines the ButtonGroupModel type. + */ + typedef creaButtonContainer::model::TFunctor TFunctor; + public: + // ---------------------------------------------------------------------------------- + /*! @fn void ContainerSettings::ContainerSettings( ) + * @brief This is the constructor. + */ + Button( wxWindow* parent, long id, ButtonPair* pair ); + // ---------------------------------------------------------------------------------- + /*! @fn void ContainerSettings::ContainerSettings( ) + * @brief This is the constructor. + */ + virtual + ~Button( ); + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) + * @brief This function returns a container with the name of the groups. + * @return KeyMapList A list with the name of the button groups. + */ + long + GetID( ); + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) + * @brief This function returns a container with the name of the groups. + * @return long A list with the name of the button groups. + */ + std::string + GetButtonName( ); + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) + * @brief This function returns a container with the name of the groups. + * @return std::string A list with the name of the button groups. + */ + std::string + GetIconPath( ); + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) + * @brief This function returns a container with the name of the groups. + * @return std::string A list with the name of the button groups. + */ + std::string + GetDescription( ); + // ---------------------------------------------------------------------------------- + /*! @fn KeyMapList ContainerSettings::GetGroupNameList( ) + * @brief This function returns a container with the name of the groups. + * @return std::string A list with the name of the button groups. + */ + void + Execute( ); + // ---------------------------------------------------------------------------------- + private: + ButtonPair* m_ButtonPair; //! m_Buttons ); @@ -38,7 +38,7 @@ namespace creaButtonContainer return ( this->m_GroupName ); } //-------------------------------------------------- - IdButtonContainer + ButtonGroup::IdButtonContainer ButtonGroup::GetButtonIdContainer( ) { IdButtonContainer idContainer; 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 920dfd2..74ec0f8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h @@ -21,16 +21,16 @@ namespace creaButtonContainer { namespace view { - //Typedef definition - typedef creaButtonContainer::view::Button Button; - typedef std::map< long, Button* > ButtonContainer; - typedef std::list< long > IdButtonContainer; - /** Class Description: This class defines a ButtonGroup. **/ class ButtonGroup { + public: + //Typedef definition + typedef creaButtonContainer::view::Button Button; + typedef std::map< long, Button* > ButtonContainer; + typedef std::list< long > IdButtonContainer; public: ButtonGroup( wxStaticText* groupName, ButtonContainer buttons ); virtual 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 3708bb0..34de644 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx @@ -37,7 +37,7 @@ namespace creaButtonContainer return ( this->m_IDExpButton ); } // ------------------------------------------------------------------- - ExpansionButton* + GroupManager::ExpansionButton* GroupManager::GetButton( ) { return ( this->m_ExpansionButton ); 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 562da7a..3358cf3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h @@ -22,13 +22,14 @@ namespace creaButtonContainer { namespace view { - typedef creaButtonContainer::view::ButtonGroup ButtonGroup; - typedef wxButton ExpansionButton; /** Class Description: **/ class GroupManager : public wxFlexGridSizer { + public: + typedef creaButtonContainer::view::ButtonGroup ButtonGroup; + typedef wxButton ExpansionButton; public: GroupManager( wxWindow* parent, ButtonGroup* buttonGroup ); virtual