From 46fa5cac1a169b7c987bf954e7df39a8bceb1dc4 Mon Sep 17 00:00:00 2001
From: espinosa <espinosa@creatis.insa-lyon.fr>
Date: Tue, 3 Feb 2015 00:03:35 +0100
Subject: [PATCH] #2516 creaMaracasVisu Feature New Normal  - 
 creaPanelButtonContainer ListPanel with events 2

---
 .../creaButtonContainer/view/listConfigDialog.cxx    |  9 ++++++++-
 .../creaButtonContainer/view/listConfigDialog.h      |  3 +++
 .../creaPanelButtonContainer.cxx                     | 12 +++++++++++-
 .../creaPanelButtonContainer.h                       |  1 +
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx
index d1b1776..154bac4 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx
@@ -43,6 +43,7 @@ namespace creaButtonContainer
 			this->m_CurrentListWx->Reparent(this);
 			this->m_CurrentListWx->SetFunctorEnabled(false);
 			this->m_CurrentListWx->Show(true);
+			this->m_LastStatus = this->m_CurrentListWx->GetListBox()->GetStrings();
 
 			wxGridBagSizer* dialogSizer = new wxGridBagSizer(0, 0);
 			dialogSizer->AddGrowableCol(0);
@@ -90,6 +91,8 @@ namespace creaButtonContainer
 					wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL
 							| wxALIGN_CENTER_VERTICAL, 5);
 
+			//Bottom Sizer
+
 			wxBoxSizer* bottomSizer = new wxBoxSizer(wxHORIZONTAL);
 			bottomSizer->Add(0, 0, 1,
 					wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
@@ -211,11 +214,15 @@ namespace creaButtonContainer
 		}
 		void ListConfigDialog::OnOk(wxCommandEvent& event)
 		{
+
 			this->EndModal(1);
 		}
 		void ListConfigDialog::OnCancel(wxCommandEvent& event)
 		{
-			Close();
+
+			this->m_CurrentListWx->GetListBox()->Clear();
+			this->m_CurrentListWx->GetListBox()->Append(this->m_LastStatus);
+			this->Close();
 		}
 	}
 }
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h
index f878bd6..7c34317 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h
@@ -38,6 +38,8 @@
 #include <wx/gbsizer.h>
 #include <wx/wx.h>
 #include <wx/bmpbuttn.h>
+#include <wx/msgdlg.h>
+
 
 #include <string>
 #include <vector>
@@ -147,6 +149,7 @@ namespace creaButtonContainer
 				wxButton* m_CancelButton;				//!< "Cancel" Remove button.
 				wxBitmapButton* m_UpButton;				//!< "/\" Remove button.
 				wxBitmapButton* m_DownButton;				//!< "\/" Remove button.
+				wxArrayString m_LastStatus; //!<Last status array.
 
 				ListWx* m_OriginalListWx; //!< The Original list.
 				ListWx* m_CurrentListWx; //!<The Configurable list.
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx
index b23fe4b..93cf74c 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx
@@ -103,7 +103,8 @@ namespace creaPanelButtonContainer
 			TConcreteFunctor* lFunctor = new TConcreteFunctor(this,
 					&PanelButtonContainer::GenericListEvent);
 
-			this->m_EventPanel = new wxPanel(this);
+			this->m_EmptyPanel = new wxPanel(this);
+			this->m_EventPanel = this->m_EmptyPanel;
 
 			this->m_PanelUp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
 					wxTAB_TRAVERSAL, _T("ListConfigContainerPanel"));
@@ -242,14 +243,23 @@ namespace creaPanelButtonContainer
 
 		std::cout << "Button Event" << std::endl;
 
+		this->m_EventPanel->Show(false);
+
 		this->m_ListConfigDialog->ShowModal();							//Show Dialog
 		this->m_CurrentWxPanel->Reparent(this->m_PanelUp);
 		this->m_CurrentWxPanel->Show(true);
 		this->m_CurrentWxPanel->SetFunctorEnabled(true);
+
+		this->m_CurrentWxPanel->GetListBox()->Deselect(
+				this->m_CurrentWxPanel->GetListBox()->GetSelection());
 		this->m_CurrentWxPanel->Update();
 		this->m_ListWxPanel->Show(false);
 		this->m_EventPanel->Show(false);
+		this->m_EventPanel = this->m_EmptyPanel;
+
+		this->m_AuiManager->GetPane(_T("EventPanel")).window = this->m_EventPanel;
 		this->m_AuiManager->Update();
+
 	}
 	//End MLER
 // ----------------------------------------------------------------------------------
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h
index b0cb014..5afb5dc 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h
@@ -156,6 +156,7 @@ namespace creaPanelButtonContainer
 			ListConfigDialog* m_ListConfigDialog;//!<This wxDialog shows the list of the elements and allows  modifications.
 
 			wxPanel* m_PanelUp;//!<This panel contains the list of the elements empty,full and the config button.
+			wxPanel* m_EmptyPanel; //!<This panel is empty.
 			ListWx* m_CurrentWxPanel;//!<This panel contains the final list of the elements .
 
 			wxBitmapButton* m_ConfigButton;//!< "Config" Settings button.
-- 
2.49.0