]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx
creaButtonContainer: Updates in documentation, adding try catch clauses and cleaning...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / button.cxx
1 /***************************************************************
2  * Name:      Button.CXX
3  * Purpose:   Implements Button.h
4  * Author:    Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
5  * Modified:  2011-05-09
6  * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/)
7  * License:
8  **************************************************************/
9
10 //! @include "button.h"
11 #include "button.h"
12
13 //!     @namespace <creaButtonContainer>
14 namespace creaButtonContainer
15 {
16         //!     @namespace <view>
17         namespace view
18         {
19                 // ----------------------------------------------------------------------------------
20                 Button::Button( wxWindow* parent, long id, ButtonPair* pair )
21                 {
22                         this->m_ButtonPair = pair;
23                         std::string wXbuttonName = this->m_ButtonPair->first->first;
24                         std::string wXiconPath = this->m_ButtonPair->first->second;
25                         std::string wXdescription = this->m_ButtonPair->second->first;
26                         wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 );
27                         wxString imageIcon( wXiconPath.c_str( ), wxConvUTF8 );
28                         wxString description( wXdescription.c_str( ), wxConvUTF8 );
29                         //creating the button.
30                         this->Create( parent, id,
31                             wxBitmap( wxImage( imageIcon, wxBITMAP_TYPE_ANY, -1 ) ),
32                             wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
33                             buttonName );
34                         this->SetToolTip( description );
35                 }
36                 // ----------------------------------------------------------------------------------
37                 Button::~Button( )
38                 {
39                 }
40                 // ----------------------------------------------------------------------------------
41                 std::string
42                 Button::GetButtonName( )
43                 {
44                         return ( this->m_ButtonPair->first->first );
45                 }
46                 // ----------------------------------------------------------------------------------
47                 std::string
48                 Button::GetIconPath( )
49                 {
50                         return ( this->m_ButtonPair->first->second );
51                 }
52                 // ----------------------------------------------------------------------------------
53                 std::string
54                 Button::GetDescription( )
55                 {
56                         return ( this->m_ButtonPair->second->first );
57                 }
58                 // ----------------------------------------------------------------------------------
59                 void
60                 Button::Execute( )
61                 {
62                         std::cout << "ButtonAction: " << this->m_ButtonPair->first->first
63                             << std::endl;
64                         TFunctor* vTable[ ] =
65                         { this->m_ButtonPair->second->second };
66                         vTable[ 0 ]->Call( this->m_ButtonPair->first->first );
67                 }
68         // ----------------------------------------------------------------------------------
69         }//ecapseman
70 }//ecapseman