-/***************************************************************
- * Name: @file buttonContainerController.h
- * Purpose: @brief This contains ContainerSettings class
+/************************************************************************************//*!
+ * 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-09
- * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/)
+ * Modified: 2011-05-17
+ * Copyright:
* License:
- **************************************************************/
+ ***************************************************************************************/
+//! @include "buttonContainerController.h"
#include "buttonContainerController.h"
-using namespace std;
+//! @namespace<creaButtonContainer>
namespace creaButtonContainer
{
+ //! @namespace<controller>
namespace controller
{
+ // ----------------------------------------------------------------------------------
ButtonContainerController::ButtonContainerController( BCPanel* panel )
{
this->m_BCPanel = panel;
}
+ // ----------------------------------------------------------------------------------
ButtonContainerController::~ButtonContainerController( )
{
}
+ // ----------------------------------------------------------------------------------
void
ButtonContainerController::AddEvents( )
{
- //Adding ButtonManagerEvents
- for( GroupManagerList::iterator it =
- this->m_BCPanel->m_GroupManagerList.begin( ); it
- != this->m_BCPanel->m_GroupManagerList.end( ); ++it )
+ try
{
- this->Connect( ( *it ).first, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) &ButtonContainerController::ButtonExpEvent );
- }//rof
+ //Adding ButtonManagerEvents
+ for( GroupManagerList::iterator it =
+ this->m_BCPanel->m_GroupManagerList.begin( ); it
+ != this->m_BCPanel->m_GroupManagerList.end( ); ++it )
+ {
+ this->Connect(
+ ( *it ).first,
+ wxEVT_COMMAND_BUTTON_CLICKED,
+ ( wxObjectEventFunction )
+ & ButtonContainerController::ButtonExpEvent );
+ }//rof
- //Adding ButtonEvents
- for( ButtonGroupList::iterator it =
- this->m_BCPanel->m_ButtonGroupList.begin( ); it
- != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
- {
- KeyList keylist = ( *it )->GetButtonIdContainer( );
- for( KeyList::iterator it2 = keylist.begin( ); it2 != keylist.end( ); ++it2 )
+ //Adding ButtonEvents
+ for( ButtonGroupList::iterator it =
+ this->m_BCPanel->m_ButtonGroupList.begin( ); it
+ != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
{
- this->Connect( ( *it2 ), wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) &ButtonContainerController::ButtonEvent );
+ KeyList keylist = ( *it )->GetButtonIdContainer( );
+ for( KeyList::iterator it2 = keylist.begin( ); it2 != keylist.end( ); ++it2 )
+ {
+ this->Connect(
+ ( *it2 ),
+ wxEVT_COMMAND_BUTTON_CLICKED,
+ ( wxObjectEventFunction )
+ & ButtonContainerController::ButtonEvent );
+ }//rof
}//rof
- }//rof
+ }
+ catch ( std::exception& e )
+ {
+ std::cerr
+ << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
+ << e.what( ) << std::endl;
+ }
}
- // -------------------------------------------------------------------
+ // ----------------------------------------------------------------------------------
void
ButtonContainerController::ButtonExpEvent( wxCommandEvent& event )
{
long id = event.GetId( );
-
- if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp(
- _("+") ) == 0 )
+ try
{
- this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel(
- _("-") );
- this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( false );
+ 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( false );
+ }
+ 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 );
+ }
+ this->m_BCPanel->FitSizer( );
}
- else if ( this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->GetLabel( ).Cmp(
- _("-") ) == 0 )
+ catch ( std::exception& e )
{
- this->m_BCPanel->m_GroupManagerList[ id ]->GetButton( )->SetLabel(
- _("+") );
- this->m_BCPanel->m_GroupManagerList[ id ]->HideSubPanel( true );
+ std::cerr << "ButtonContainerController::AddEvents( ) exception: "
+ << e.what( ) << std::endl;
}
- this->m_BCPanel->FitSizer( );
}
- // -------------------------------------------------------------------
+ // ----------------------------------------------------------------------------------
void
ButtonContainerController::ButtonEvent( wxCommandEvent& event )
{
this->m_BCPanel->m_ButtonGroupList.begin( ); it
!= this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
{
- if ( ( *it )->GetButton( event.GetId( ) ) != NULL )
+ try
+ {
( *it )->GetButton( event.GetId( ) )->Execute( );
+ }
+ catch ( std::exception& e )
+ {
+ std::cerr
+ << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
+ << e.what( ) << std::endl;
+ }
}
}
+ // ----------------------------------------------------------------------------------
}//ecapsename
}//ecapsename
-/***************************************************************
+/************************************************************************************//*!
* Name: @file buttonContainerController.h
- * Purpose: @brief This fhile contains the ButtonContainerController Class
+ * Purpose: @brief This contains the ButtonContainerController 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-17
+ * Copyright:
* License:
- **************************************************************/
+ ***************************************************************************************/
#ifndef BUTTONCONTAINERCONTROLLER_H_
#define BUTTONCONTAINERCONTROLLER_H_
+//! @include <wx/event.h>
#include <wx/event.h>
+//! @include <iostream>
+#include <iostream>
+//! @include <exception>
+#include <exception>
+
+//! @include "buttonContainerPanel.h"
#include "buttonContainerPanel.h"
-///@namespace<creaButtonContainer>
+//! @namespace<creaButtonContainer>
namespace creaButtonContainer
{
- ///@namespace<view>
+ //! @namespace<view>
namespace view
{
//Predefinition of ButtonContainerPanel FriendClass!!
- ///@class ButtonContainerPanel buttonContainerPanel.h "buttonContainerPanel.h"
+ //! @class ButtonContainerPanel buttonContainerPanel.h "buttonContainerPanel.h"
+
class ButtonContainerPanel;
}
- ///@namespace<controller>
+ //! @namespace<controller>
namespace controller
{
- /*!@class ButtonContainerController buttonContainerController.h "buttonContainerController.h"
- * @brief This class contains the ButtonContainerPanel controller
- * This class describes the panel and button events.
- */
+ /*! @class ButtonContainerController buttonContainerController.h "buttonContainerController.h"
+ * @brief This class contains the ButtonContainerPanel controller
+ * This class describes button events.
+ */
class ButtonContainerController : public wxEvtHandler
{
public:
- ///@typedef creaButtonContainer::view::ButtonGroup ButtonGroup
- ///@typedef typedef creaButtonContainer::view::GroupManager GroupManager;
- ///@typedef std::list< ButtonGroup* > ButtonGroupList;
- ///@typedef std::map< long, GroupManager* > GroupManagerList;
- ///@typedef wxFlexGridSizer Sizer;
- ///@typedef std::list< long > KeyList;
- ///@typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
- ///@typedef creaButtonContainer::view::ButtonContainerPanel BCPanel;
- //typedef definition
+ //typedef definitions
+ /*! @typedef creaButtonContainer::view::ButtonGroup ButtonGroup
+ * @brief Defines the ButtonGroup type
+ */
typedef creaButtonContainer::view::ButtonGroup ButtonGroup;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef typedef creaButtonContainer::view::GroupManager GroupManager
+ * @brief Defines the GroupManager type
+ */
typedef creaButtonContainer::view::GroupManager GroupManager;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::list< ButtonGroup* > ButtonGroupList
+ * @brief Defines the ButtonGroupList type
+ */
typedef std::list< ButtonGroup* > ButtonGroupList;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::map< long, GroupManager* > GroupManagerList
+ * @brief Defines the GroupManagerList type
+ */
typedef std::map< long, GroupManager* > GroupManagerList;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef wxFlexGridSizer Sizer
+ * @brief Defines the Sizer type
+ */
typedef wxFlexGridSizer Sizer;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::list< long > KeyList
+ * @brief Defines the KeyList type
+ */
typedef std::list< long > KeyList;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings
+ * @brief Defines the ButtonGroupSettings type
+ */
typedef creaButtonContainer::model::ContainerSettings
ButtonGroupSettings;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef creaButtonContainer::view::ButtonContainerPanel BCPanel
+ * @brief Defines the BCPanel type
+ */
typedef creaButtonContainer::view::ButtonContainerPanel BCPanel;
//end of typedef definition
public:
- ///!The Parameterized Constructor
+ /*! @fn ButtonContainerController::ButtonContainerController( BCPanel* )
+ * @brief This is the Parameterized constructor.
+ * @param BCPanel*
+ */
ButtonContainerController( BCPanel* );
+ // ----------------------------------------------------------------------------------
+ /*! @fn virtual ButtonContainerController::~ButtonContainerController( )
+ * @brief This is the destructor.
+ */
virtual
~ButtonContainerController( );
+ // ----------------------------------------------------------------------------------
+ /*! @fn void ButtonContainerController::AddEvents( )
+ * @brief This function connect every buttonEvent to the view.
+ * @exception std::bad_alloc
+ */
void
AddEvents( );
+ // ----------------------------------------------------------------------------------
+ /*! @fn void ButtonContainerController::ButtonExpEvent( wxCommandEvent& event )
+ * @brief This function is the button group "+" "-" event.
+ * @exception std::bad_alloc
+ * @param event Button action event.
+ */
void
ButtonExpEvent( wxCommandEvent& event );
+ // ----------------------------------------------------------------------------------
+ /*! @fn void ButtonContainerController::ButtonEvent( wxCommandEvent& event )
+ * @brief This function calls the events of the buttonContainer buttons
+ * @exception std::bad_alloc
+ * @param event Button action event.
+ */
void
ButtonEvent( wxCommandEvent& event );
+ // ----------------------------------------------------------------------------------
private:
- BCPanel* m_BCPanel;
+ BCPanel* m_BCPanel; //! <ButtonContainerPanel View pointer.
};
}//ecapsename
}//ecapsename
-/***************************************************************
- * Name: ButtonGroupFactory
- * Purpose: Implements ButtonGroupFactory
- * Author: Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
- * Modified: 2011-05-09
- * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/)
+/************************************************************************************//*!
+ * Name: @file buttonGroupFactory.cxx
+ * Purpose: @brief This contains the ButtonGroupFactory class implementation
+ * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * Modified: 2011-05-17
+ * Copyright:
* License:
- **************************************************************/
+ ***************************************************************************************/
+//! @include "buttonGroupFactory.h"
#include "buttonGroupFactory.h"
+//! @namespace<creaButtonContainer>
namespace creaButtonContainer
{
+ //! @namespace<model>
namespace model
{
+ // ----------------------------------------------------------------------------------
ButtonGroupFactory::ButtonGroupFactory( )
{
}
+ // ----------------------------------------------------------------------------------
ButtonGroupFactory::~ButtonGroupFactory( )
{
}
- ButtonGroupContainer
+ // ----------------------------------------------------------------------------------
+ ButtonGroupFactory::ButtonGroupContainer
ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
ButtonGroupModel* settings )
{
ButtonGroupContainer groupView;
- ButtonGroupMap map = settings->GetButtonGroupContainer( );
- for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
+ try
{
- wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
- wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux,
- wxDefaultPosition, wxDefaultSize, 0, _T("GroupText") );
- ButtonGroup* group = new ButtonGroup( wxGroupName,
- this->GetButtons( parent, ( *it ).second ) );
- groupView.push_back( group );
+ ButtonGroupMap map = settings->GetButtonGroupContainer( );
+ for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
+ {
+ wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
+ wxStaticText* wxGroupName = new wxStaticText( parent, -1,
+ groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
+ _T( "GroupText" ) );
+ ButtonGroup* group = new ButtonGroup( wxGroupName,
+ this->GetButtons( parent, ( *it ).second ) );
+ groupView.push_back( group );
+ }
+ }
+ catch ( std::exception& e )
+ {
+ std::cerr
+ << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
+ << e.what( ) << std::endl;
}
return ( groupView );
}
- ButtonContainer
+ // ----------------------------------------------------------------------------------
+ ButtonGroupFactory::ButtonContainer
ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )
{
ButtonContainer buttonList;
- for( ButtonList::iterator it = buttonModel.begin( ); it
- != buttonModel.end( ); ++it )
+ try
+ {
+ for( ButtonList::iterator it = buttonModel.begin( ); it
+ != buttonModel.end( ); ++it )
+ {
+ long id = wxNewId( );
+ buttonList[ id ] = new Button( parent, id, *it );
+ }
+ return ( buttonList );
+ }
+ catch ( std::exception& e )
{
- long id = wxNewId( );
- buttonList[ id ] = new Button( parent, id, *it );
+ std::cerr
+ << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
+ << e.what( ) << std::endl;
}
- return ( buttonList );
}
+ // ----------------------------------------------------------------------------------
}//ecapseman
}//ecapseman
-/***************************************************************
- * Name: @file ButtonGroupFactory.h
- * Purpose: @brief This contains ButtonGroupFactory Class
+/************************************************************************************//*!
+ * Name: @file buttonGroupFactory.h
+ * Purpose: @brief This contains ButtonGroupFactory 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-17
+ * Copyright:
* License:
- **************************************************************/
+ ***************************************************************************************/
#ifndef BUTTONGROUPFACTORY_H
#define BUTTONGROUPFACTORY_H
+//! @include <wx/window.h>
#include <wx/window.h>
+//! @include <list>
#include <list>
+//! @include <map>
#include <map>
+//! @include <iostream>
+#include <iostream>
+//! @include <exception>
+#include <exception>
+//! @include "system.h"
#include "system.h"
+//! @include "button.h"
#include "button.h"
+//! @include "buttonGroup.h"
#include "buttonGroup.h"
+//! @include "containerSettings.h"
#include "containerSettings.h"
+//! @include "functor.h"
#include "functor.h"
-///@namespace <creaButtonContainer>
+//! @namespace <creaButtonContainer>
namespace creaButtonContainer
{
- ///@namespace <model>
+ //! @namespace <model>
namespace model
{
- //typedef
- typedef creaButtonContainer::view::Button Button;
- typedef creaButtonContainer::view::ButtonGroup ButtonGroup;
- typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel;
- typedef std::list< ButtonGroup* > ButtonGroupContainer;
- typedef std::map< long, Button* > ButtonContainer;
- /// @class ButtonGroupFactory
- /// @brief This class is the factory of a group of wxButtons
+ //! @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.
+ * This class describes the factory of the ButtonContainer using design patterns.
+ */
class ButtonGroupFactory
{
public:
- //Constructors:
- /*!
- * @brief This is the default constructor.
+ //typedef definition
+ /*! @typedef creaButtonContainer::view::Button Button;
+ * @brief Defines the Button type.
+ */
+ typedef creaButtonContainer::view::Button Button;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef creaButtonContainer::view::ButtonGroup ButtonGroup;
+ * @brief Defines the ButtonGroup type.
+ */
+ typedef creaButtonContainer::view::ButtonGroup ButtonGroup;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel;
+ * @brief Defines the ButtonGroupModel type.
+ */
+ typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::list< ButtonGroup* > ButtonGroupContainer;
+ * @brief Defines the ButtonGroupContainer type.
+ */
+ typedef std::list< ButtonGroup* > ButtonGroupContainer;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::map< long, Button* > ButtonContainer;
+ * @brief Defines the ButtonContainer type.
+ */
+ typedef std::map< long, Button* > ButtonContainer;
+ // ----------------------------------------------------------------------------------
+ public:
+ /*! @fn ButtonGroupFactory::ButtonGroupFactory( )
+ * @brief This is the default constructor.
*/
ButtonGroupFactory( );
- //Destructors:
- /*!
- * @brief this is the destructor.
+ // -------------------------------------------------------------------------------
+ /*! @fn virtual ButtonGroupFactory::~ButtonGroupFactory( )
+ * @brief This is the destructor.
*/
virtual
~ButtonGroupFactory( );
- //Functions:
- /*!
+ /*! @fn ButtonGroupContainer ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings );
* @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.
+ * @param parent the wxWindow* parent to be attached.
+ * @param settings The Container settings.
+ * @exception std::bad_alloc
+ * @return ButtonGroupContainer The wx button group container.
*/
ButtonGroupContainer
CreateButtonGroupContainer( wxWindow* parent,
ButtonGroupModel* settings );
private:
- /*!
- * @brief This function allows to create a wx button container for a group.
- * @param the wxWindow* parent to be attached.
- * @param The button list with its own information.
- * @return The wx button container.
+ /*! @fn ButtonContainer ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel );
+ * @brief This function 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
+ * @return ButtonContainer The wx button container.
*/
ButtonContainer
GetButtons( wxWindow* parent, ButtonList buttonModel );