]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/listConfigPanel.cxx
Code cleaning done
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaPanelButtonContainer / listConfigPanel.cxx
index c39124f311daa360b9f6a65bbcb7eb40f6703f8d..dc5e363d2237b2c642fc1eb583d025b160d85d32 100644 (file)
 /*# ---------------------------------------------------------------------
-#
-# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
-#                        pour la Sant�)
-# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
-# Previous Authors : Laurent Guigues, Jean-Pierre Roux
-# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
-#
-#  This software is governed by the CeCILL-B license under French law and
-#  abiding by the rules of distribution of free software. You can  use,
-#  modify and/ or redistribute the software under the terms of the CeCILL-B
-#  license as circulated by CEA, CNRS and INRIA at the following URL
-#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-#  or in the file LICENSE.txt.
-#
-#  As a counterpart to the access to the source code and  rights to copy,
-#  modify and redistribute granted by the license, users are provided only
-#  with a limited warranty  and the software's author,  the holder of the
-#  economic rights,  and the successive licensors  have only  limited
-#  liability.
-#
-#  The fact that you are presently reading this means that you have had
-#  knowledge of the CeCILL-B license and that you accept its terms.
-# ------------------------------------------------------------------------ */
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la Sant�)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
 
 #include "listConfigPanel.h"
 
 namespace creaPanelButtonContainer
 {
 
-               ListConfigPanel::ListConfigPanel(wxWindow* parent, wxWindowID id,const wxString& title, ListWx* modelList, ListWx* currentList) :
-                               wxDialog(parent,id,title)
-               {
-                       std::cout<< "MLER | ListConfigPanel::ListConfigPanel()" << std::endl;
-
-                       m_listWx = modelList;
-                       m_listWx->Reparent(this);
-                       m_listWx->Show(true);
-                       m_listWx->SetFunctorEnabled(false);
-                       m_listWx->FillList();
-
-                       m_finalListWx = currentList;
-                       m_finalListWx->Reparent(this);
-                       m_finalListWx->SetFunctorEnabled(false);
-                       m_finalListWx->Show(true);
-                       m_finalListWx->FillList();
-
-                       wxFlexGridSizer* sizer = new wxFlexGridSizer(2,1,0,0);
-                       //sizer->Add( new  wxStaticText(this,-1, _("Lista Configurable")));
-                       this->SetSizer(sizer);
-
-
-                       wxBoxSizer* sizerUp = new wxBoxSizer(wxHORIZONTAL);
-
-                       //wxPanel* panel1 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
-                               //      _T("Panel 1"));
-
-                       //wxBoxSizer* sizerList1 = new wxBoxSizer(wxVERTICAL);
-
-                       //panel1->Add(m_listWx,0,wxEXPAND);
-                       //listBox = new wxListBox(panel1,-1,wxDefaultPosition,wxDefaultSize, 0, 0, 0,
-                               //      wxDefaultValidator, _("ListBox"));
-
-                       //sizerList1->Add(panel1,0,wxEXPAND);
-
-                       //panel1->SetSizer(sizerList1);
-                       //sizerList1->Fit(panel1);
-                       //sizerList1->SetSizeHints(panel1);
-
-                       sizerUp->Add(m_listWx, 0, wxEXPAND);
-               //========
-
-                       wxPanel* panel2 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("Panel 2"));
-                       wxBoxSizer* sizerList2 = new wxBoxSizer(wxVERTICAL);
-
-                       buttonAdd = new wxButton(panel2, 1, _(">"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("Add"));
-                       sizerList2->Add(buttonAdd, 0, wxEXPAND);
-
-                       buttonDel = new wxButton(panel2, 2, _("<"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("Delete"));
-                       sizerList2->Add(buttonDel,  0, wxEXPAND);
-
-                       panel2->SetSizer(sizerList2);
-                       sizerList2->Fit(panel2);
-                       sizerList2->SetSizeHints(panel2);
-
-                       sizerUp->Add(panel2, 0, wxEXPAND);
-
-               //========
-
-                       //wxPanel* panel3 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("Panel 3"));
-                       //wxBoxSizer* sizerList3 = new wxBoxSizer(wxHORIZONTAL);
-
-                       //finalListBox = new wxListBox(panel3, -1, wxDefaultPosition, wxDefaultSize, 0, 0, 0,
-                               //      wxDefaultValidator, _T("finalListBox"));
-                       //sizerList3->Add(m_finalListWx, 0, wxEXPAND);
-
-                       //panel3->SetSizer(sizerList3);
-                       //sizerList3->Fit(panel3);
-                       //sizerList3->SetSizeHints(panel3);
-
-                       sizerUp->Add(m_finalListWx, 0, wxEXPAND);
-                       //sizer->Add(sizerUp, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
-
-                       //FillList();
-
-               //=======
-                       wxPanel* panel5 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("Panel 5"));
-                       wxBoxSizer* sizerList4 = new wxBoxSizer(wxVERTICAL);
-
-                       upButton = new wxButton(panel5, 3, _("/\\"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("upButton"));
-                       sizerList4->Add(upButton, 0, wxEXPAND);
-
-                       downButton = new wxButton(panel5, 4, _("V"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("downButton"));
-                       sizerList4->Add(downButton, 0, wxEXPAND);
-
-                       panel5->SetSizer(sizerList4);
-                       sizerList4->Fit(panel5);
-                       sizerList4->SetSizeHints(panel5);
-                       sizerUp->Add(panel5,  0, wxEXPAND);
-
-                       //========
-                       wxBoxSizer* sizerBotones = new wxBoxSizer(wxHORIZONTAL);
-                       wxPanel* panel4 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("Panel 4"));
-
-                       okButton = new wxButton(panel4, 5, _("Ok"), wxPoint(0,8), wxDefaultSize, 0, wxDefaultValidator, _T("Ok"));
-                       cancelButton = new wxButton(panel4, 6, _("Cancel"), wxPoint(88,8), wxDefaultSize, 0, wxDefaultValidator, _T("Cancel"));
-
-                       sizerBotones->Add(panel4,  0, wxEXPAND);
-
-                       sizer->Add(sizerUp,0,wxEXPAND);
-                       sizer->Add(sizerBotones,  1, wxALL|wxALIGN_CENTER_HORIZONTAL);
-
-
-               //      SetSizer(sizer);
-                       //SetSizer(sizer);
-                       //Layout();
-
-               //---------------------------------------------------------------------------------------------
-               // Manejo de Eventos
-
-                       //Evento Cancel
-                       Connect(6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ListConfigPanel::OnQuit);
-
-                       //EventoSeleccionarLista
-                       //Connect(wxEVT_COMMAND_LISTBOX_SELECTED,wxCommandEventHandler(ListConfigPanel::ListItemEvent));
-
-                       //EventoAdd
-                       Connect(1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ListConfigPanel::OnAdd);
-
-                       //EventoOk
-                       Connect(5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ListConfigPanel::OkEvent);
-
-                       //EventoDelete
-                       Connect(2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ListConfigPanel::OnDelete);
-
-               }
-
-               ListConfigPanel::~ListConfigPanel()
-               {
-
-               }
-
-               ListConfigPanel::ItemsMap
-               ListConfigPanel::GetFinalItemsMap()
-               {
-                       return m_finalItems;
-               }
-
-               void
-               ListConfigPanel::SetFinalItems(ItemsMap finalItems)
-               {
-                       m_finalItems = finalItems;
-               }
-
-               void
-               ListConfigPanel::FillList(int i)
-               {
-                       /*if(i == 0)
-                       {
-                               m_itemsMap = m_listWx->GetItemsMap();
-
-                               for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it)
-                               {
-                                       std::string key = it->first;
-                                       listBox->Append( wxString(key.c_str(), wxConvUTF8));
-                               }
-                       }
-                       if(i == 1)
-                       {
-                               std::cout << "ListConfigPanel::FillList items : "<< m_finalItems.size()<<std::endl;
-                               finalListBox->Clear();
-
-                               if(!m_finalItems.empty())
-                               {
-                                       for (ItemsMap::iterator it=this->m_finalItems.begin(); it!=this->m_finalItems.end(); ++it)
-                                       {
-                                               std::string key = it->first;
-                                               int v = finalListBox->FindString(wxString(key.c_str(), wxConvUTF8));
-
-                                               if(v == -1)
-                                                       finalListBox->Append( wxString(key.c_str(), wxConvUTF8));
-                                       }
-                               }
-
-
-                       }*/
-               }
-
-               void
-               ListConfigPanel::OnQuit(wxCommandEvent& event)
-               {
-                       std::cout<<"Onquit"<<std::endl;
-
-                   Close();
-               }
-
-               void
-               ListConfigPanel::ListItemEvent(wxCommandEvent& event)
-               {
-                       /*std::cout<<"MLER |ListConfigPanel::ListItemEvent"<<std::endl;
-
-                       int iSelection;
-                       iSelection = listBox->GetSelection();
-
-                       wxString itemNom = listBox->GetString(iSelection);
-                       std::string itemNomC = std::string(itemNom.mb_str());*/
-
-               }
-
-
-               void
-               ListConfigPanel::OnAdd(wxCommandEvent& event)
-               {
-                       std::cout<<"MLER |ListConfigPanel::OnAdd"<<std::endl;
-
-                       wxString itSel = m_listWx->GetListBox()->GetStringSelection();
-                       std::string item = std::string(itSel.mb_str());
-
-
-                       if(!itSel.empty())
-                       {
-                               wxPanel* mPanel = m_listWx->GetItemsMap()[item];
-                               m_finalListWx->AddItemToMap(item, mPanel);
-                               m_finalListWx->FillList();
-                       }
-
-                                //wxMessageBox( _("Seleccione un elemento"), wxOK | wxICON_INFORMATION );
-
-                       std::cout << "FinalItemsAdd" << m_finalItems.size() << std::endl;
-               }
-
-               void
-               ListConfigPanel::OnDelete(wxCommandEvent& event)
-               {
-                       std::cout<<"MLER |ListConfigPanel::OnDelete"<<std::endl;
-
-                       wxString itSel = m_finalListWx->GetListBox()->GetStringSelection();
-                       std::string item = std::string(itSel.mb_str());
-                       if(!itSel.empty())
-                       {
-                               m_finalListWx->DeleteItemFromMap(item);
-                               m_finalListWx->FillList();
-                       }
-
-                       std::cout << "FinalItems Delete" << m_finalItems.size() << std::endl;
-               }
-
-               void
-               ListConfigPanel::OkEvent(wxCommandEvent& event)
-               {
-                       std::cout<<"MLER |ListConfigPanel::OkEvent"<<std::endl;
-
-                       this->EndModal(1);
-               }
-
-               void
-               ListConfigPanel::UpEvent(wxCommandEvent& event)
-               {
-                       std::cout<<"Up Event"<<std::endl;
-               }
-
-               void
-               ListConfigPanel::DownEvent(wxCommandEvent& event)
-               {
-                       std::cout<<"Down Event"<<std::endl;
-               }
-
-               void
-               ListConfigPanel::RefreshViewEvent(wxCommandEvent& event)
-               {
-                       std::cout<<"RefreshView Event"<<std::endl;
-               }
-
-
-               ListConfigPanel::ListWx*
-               ListConfigPanel::GetFinalListWx()
-               {
-                       return this->m_finalListWx;
-               }
-
 }