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=5de552c2ff816d48b423f769209fda1f4c9b92f2;hb=8f1f70ffb361d0ccde7da40ff128cebdcfcf3f13;hp=f64ab47bcc5d3a4a62628a410149eeacad316b36;hpb=4518d93a0a51221812cfb6d783f8e7f4fd77b498;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 f64ab47..5de552c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx @@ -24,6 +24,7 @@ # ------------------------------------------------------------------------ */ + #include "listWx.h" namespace creaButtonContainer @@ -31,73 +32,56 @@ namespace creaButtonContainer namespace view { // ---------------------------------------------------------------------------------- - ListWx::ListWx( wxWindow* parent, long id, ButtonPair* pair ) + ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id) { - 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 ); - } - // ---------------------------------------------------------------------------------- - ListWx::~ListWx( ) - { - } + std::cout<< "MLER | ListWx::ListWx()" << std::endl; + this->m_itemsMap = iMap; - // ---------------------------------------------------------------------------------- - StringType - ListWx::GetButtonName( ) - { - return ( this->m_ButtonPair->first->first ); - } + this->functor = functor; + int i = 0; + for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it) + { - // ---------------------------------------------------------------------------------- - BitmapType - ListWx::GetIcon( ) - { - return ( this->m_ButtonPair->first->second ); - } + std::string key = it->first; + long index = this->InsertItem(i, wxString(key.c_str(), wxConvUTF8)); - // ---------------------------------------------------------------------------------- - /*StringType - Button::GetIconPath( ) - { - return ( this->m_ButtonPair->first->second ); - }*/ + std::cout << "index" << index << std::endl; + this->Connect( -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, + wxListEventHandler(ListWx::ListEvent) ); + i++; + } + } // ---------------------------------------------------------------------------------- - StringType - ListWx::GetDescription( ) + ListWx::~ListWx( ) { - return ( this->m_ButtonPair->second->first ); } - // ---------------------------------------------------------------------------------- void - ListWx::Execute( ) + ListWx::ListEvent( wxListEvent& event ) { try { - TFunctor* vTable[ ] = - { this->m_ButtonPair->second->second }; - vTable[ 0 ]->Call( this->m_ButtonPair->first->first ); + std::cout<< "MLER | ListWx::ListEvent( wxListEvent& event )" << std::endl; + + wxString itemNom = event.GetItem().GetText(); + + std::string itemNomC = std::string(itemNom.mb_str()); + + this->functor->Call(itemNomC); + std::cout<<"mmmmmmmmmmmmmmmmmmmmmmm"<