]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx
#2507 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / listWx.cxx
index 6eb86d8b0cf81036287fef25f1ba33ac648f8332..5de552c2ff816d48b423f769209fda1f4c9b92f2 100644 (file)
 
 
 
-//EED-MLER
-/*
 #include "listWx.h"
 
 namespace creaButtonContainer
 {
        namespace view
        {
-               ListWx::ListWx(wxWindow* parent, ItemsList items)
+               // ----------------------------------------------------------------------------------
+               ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id)
                {
-                       wxListCtrl* lstCtrl = new wxListCtrl (parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
 
-                       this->m_items                   = items;
-                       lstCtrl->InsertItem(0,(*items.front()).GetText());
-               }
-
-               //-------------------------------------------------------
+                       std::cout<< "MLER | ListWx::ListWx()" << std::endl;
+                       this->m_itemsMap = iMap;
 
-               tList::~tList( )
-               {
-               }
+                       this->functor = functor;
+                       int i = 0;
+                       for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it)
+                       {
 
-               //-------------------------------------------------------
+                               std::string key = it->first;
+                               long index = this->InsertItem(i, wxString(key.c_str(), wxConvUTF8));
 
-               ItemsList getItems() const
-               {
-                       return m_items;
+                               std::cout << "index" << index << std::endl;
+                               this->Connect( -1, wxEVT_COMMAND_LIST_ITEM_SELECTED,
+                                                wxListEventHandler(ListWx::ListEvent) );
+                               i++;
+                       }
                }
 
-               void setItems(ItemsList items)
+               // ----------------------------------------------------------------------------------
+               ListWx::~ListWx( )
                {
-                       m_items = items;
                }
 
+               void
+               ListWx::ListEvent( wxListEvent& event )
+               {
+                       try
+                       {
+                               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"<<std::endl;
 
+                       }//yrt
+                       catch ( const std::exception& e )
+                       {
+                               std::cerr
+                                   << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: "
+                                   << e.what( ) << std::endl;
+                       }//hctac
+               }
+       // ----------------------------------------------------------------------------------
+       }//ecapseman
+}//ecapseman
 
 
-*/