X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FcreaButtonContainer%2Fview%2FlistWx.cxx;h=f64ab47bcc5d3a4a62628a410149eeacad316b36;hb=4518d93a0a51221812cfb6d783f8e7f4fd77b498;hp=5e670e74cb4b1f1dffc804d6fa46c8cfd7089353;hpb=c1742e6eca1299979dbacc1f609bc14c3494bc7a;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx index 5e670e7..f64ab47 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx @@ -23,40 +23,81 @@ # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ + #include "listWx.h" namespace creaButtonContainer { namespace view { - ListWx::ListWx(wxWindow* parent, ItemsList items) + // ---------------------------------------------------------------------------------- + ListWx::ListWx( wxWindow* parent, long id, ButtonPair* pair ) { - wxListCtrl* lstCtrl = new wxListCtrl (parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT); - - this->m_items = items; - lstCtrl->InsertItem(0,(*items.front()).GetText()); + this->m_ButtonPair = pair; + StringType wXbuttonName = this->m_ButtonPair->first->first; + BitmapType wXicon = this->m_ButtonPair->first->second; + StringType wXdescription = this->m_ButtonPair->second->first; + wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 ); + wxString description( wXdescription.c_str( ), wxConvUTF8 ); + //creating the button. + /*this->Create( parent, id, + wXicon, + wxDefaultPosition, wxDefaultSize,wxBU_AUTODRAW, wxDefaultValidator, + buttonName );*/ + this->Create( parent, id, + wxDefaultPosition, wxDefaultSize,wxLC_LIST, wxDefaultValidator, + buttonName ); + this->SetToolTip( description ); } - //------------------------------------------------------- - - tList::~tList( ) + // ---------------------------------------------------------------------------------- + ListWx::~ListWx( ) { } - //------------------------------------------------------- - - ItemsList getItems() const + // ---------------------------------------------------------------------------------- + StringType + ListWx::GetButtonName( ) { - return m_items; + return ( this->m_ButtonPair->first->first ); } - void setItems(ItemsList items) + // ---------------------------------------------------------------------------------- + BitmapType + ListWx::GetIcon( ) { - m_items = items; + return ( this->m_ButtonPair->first->second ); } + // ---------------------------------------------------------------------------------- + /*StringType + Button::GetIconPath( ) + { + return ( this->m_ButtonPair->first->second ); + }*/ + // ---------------------------------------------------------------------------------- + StringType + ListWx::GetDescription( ) + { + return ( this->m_ButtonPair->second->first ); + } - } - -} + // ---------------------------------------------------------------------------------- + void + ListWx::Execute( ) + { + 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