]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx
Diego Caceres: Changes in CMakeLists.txt.
[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 <iostream>
12
13 namespace creaButtonContainer
14 {
15         namespace view
16         {
17                 //--------------------------------------------------------------------
18                 Button::Button( wxWindow* parent, long id, ButtonPair* pair )
19                 {
20                         this->m_ButtonPair = pair;
21                         std::string wXbuttonName = this->m_ButtonPair->first->first;
22                         std::string wXiconPath = this->m_ButtonPair->first->second;
23                         std::string wXdescription = this->m_ButtonPair->second->first;
24                         wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 );
25                         wxString imageIcon( wXiconPath.c_str( ), wxConvUTF8 );
26                         wxString description( wXdescription.c_str( ), wxConvUTF8 );
27                         this->Create( parent, id,
28                             wxBitmap( wxImage( imageIcon, wxBITMAP_TYPE_ANY, -1 ) ),
29                             wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
30                             buttonName );
31                         this->SetToolTip( description );
32                 }
33                 //--------------------------------------------------------------------
34                 Button::~Button( )
35                 {
36                 }
37                 //--------------------------------------------------------------------
38                 //--------------------------------------------------------------------
39                 string
40                 Button::GetButtonName( )
41                 {
42                         return( this->m_ButtonPair->first->first );
43                 }
44                 //--------------------------------------------------------------------
45                 string
46                 Button::GetIconPath( )
47                 {
48                         return( this->m_ButtonPair->first->second );
49                 }
50                 //--------------------------------------------------------------------
51                 string
52                 Button::GetDescription( )
53                 {
54                         return( this->m_ButtonPair->second->first );
55                 }
56                 //--------------------------------------------------------------------
57                 void
58                 Button::Execute( )
59                 {
60                         std::cout << "ButtonAction: "<< this->m_ButtonPair->first->first <<std::endl;
61                         TFunctor* vTable[] = {this->m_ButtonPair->second->second};
62                         vTable[0]->Call( this->m_ButtonPair->first->first );
63                 }
64
65         }//ecapseman
66 }//ecapseman