-/***************************************************************
- * Name: Button.CXX
- * Purpose: Implements Button.h
- * 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 button.cxx
+ * @brief Implements the Button class implementation.
+ * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * @date 2011-06-02
+ */
#include "button.h"
-#include <iostream>
namespace creaButtonContainer
{
namespace view
{
- //--------------------------------------------------------------------
+ // ----------------------------------------------------------------------------------
Button::Button( wxWindow* parent, long id, ButtonPair* pair )
{
this->m_ButtonPair = pair;
- std::string wXbuttonName = this->m_ButtonPair->first->first;
- std::string wXiconPath = this->m_ButtonPair->first->second;
- std::string wXdescription = this->m_ButtonPair->second->first;
+ StringType wXbuttonName = this->m_ButtonPair->first->first;
+ StringType wXiconPath = this->m_ButtonPair->first->second;
+ StringType wXdescription = this->m_ButtonPair->second->first;
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
+ // ----------------------------------------------------------------------------------
+ StringType
Button::GetButtonName( )
{
- return( this->m_ButtonPair->first->first );
+ return ( this->m_ButtonPair->first->first );
}
- //--------------------------------------------------------------------
- string
+ // ----------------------------------------------------------------------------------
+ StringType
Button::GetIconPath( )
{
- return( this->m_ButtonPair->first->second );
+ return ( this->m_ButtonPair->first->second );
}
- //--------------------------------------------------------------------
- string
+ // ----------------------------------------------------------------------------------
+ StringType
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 <<std::endl;
- TFunctor* vTable[] = {this->m_ButtonPair->second->second};
- vTable[0]->Call( this->m_ButtonPair->first->first );
+ try
+ {
+ TFunctor* vTable[ ] =
+ { this->m_ButtonPair->second->second };
+ vTable[ 0 ]->Call( this->m_ButtonPair->first->first );
+ }//yrt
+ catch ( const std::exception& e )
+ {
+ std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
+ }//hctac
}
-
+ // ----------------------------------------------------------------------------------
}//ecapseman
}//ecapseman