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=868e331da4a37f8e2c5ed888493d8fc2b34a47b6;hb=ff116b1d805145619b44879358f1fa8521ef5569;hp=facd7f02ea39638e0c87342c72b97c04689ebc32;hpb=db86dba6381cc26c3fa1070608b2ac56abeb823c;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 facd7f0..868e331 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx @@ -31,36 +31,17 @@ 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 ); - - - long index = this->InsertItem(0, _("John Smith")); - this->SetItem(index, 1, _("jsmith")); - - index = this->InsertItem(1, _("Monica")); - this->SetItem(index, 1, _("monica")); - - index = this->InsertItem(2, _("Momo")); - this->SetItem(index, 2, _("momo")); - - - + this->m_itemsMap = iMap; + this->functor = functor; + for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it) + { + std::string key = it->first; + long index = this->InsertItem(0, wxString::From8BitData(key.c_str())); + //this->Connect( index, wxEVT_LIST_ITEM_SELECTED, + // (wxObjectEventFunction) &ListWx::ButtonEvent ); + } } // ---------------------------------------------------------------------------------- @@ -68,47 +49,19 @@ namespace creaButtonContainer { } - // ---------------------------------------------------------------------------------- - StringType - ListWx::GetButtonName( ) - { - return ( this->m_ButtonPair->first->first ); - } - - // ---------------------------------------------------------------------------------- - BitmapType - ListWx::GetIcon( ) - { - 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( ) + ListWx::ButtonEvent( wxCommandEvent& event ) { try { - TFunctor* vTable[ ] = - { this->m_ButtonPair->second->second }; - vTable[ 0 ]->Call( this->m_ButtonPair->first->first ); + //MLDR - Aqui necesita el nombre de la funcion para poderla ejecutar + this->functor->Call("PanelButtonContainer::GenericButtonEvent"); }//yrt catch ( const std::exception& e ) { - std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl; + std::cerr + << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: " + << e.what( ) << std::endl; }//hctac } // ----------------------------------------------------------------------------------