]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMBlackBoxDescriptionPanel.cpp
diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp
new file mode 100644 (file)
index 0000000..44d60e8
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+# ---------------------------------------------------------------------
+#
+# 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.
+# ------------------------------------------------------------------------
+ */
+
+/*
+ * wxCDMLibraryDescriptionPanel.cpp
+ *
+ *  Created on: Nov 27, 2012
+ *      Author: Daniel Felipe Gonzalez Obando
+ */
+
+#include "wxCDMBlackBoxDescriptionPanel.h"
+
+#include "creaDevManagerIds.h"
+#include "images/BBIcon.xpm"
+
+BEGIN_EVENT_TABLE(wxCDMBlackBoxDescriptionPanel, wxPanel)
+EVT_MENU(ID_BUTTON_OPEN_CXX, wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx)
+EVT_MENU(ID_BUTTON_OPEN_HXX, wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx)
+END_EVENT_TABLE()
+
+wxCDMBlackBoxDescriptionPanel::wxCDMBlackBoxDescriptionPanel(
+    wxWindow* parent,
+    modelCDMBlackBox* blackBox,
+    wxWindowID id,
+    const wxString& caption,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style
+)
+{
+  wxCDMBlackBoxDescriptionPanel::Create(parent, blackBox, id, caption, pos, size, style);
+}
+
+wxCDMBlackBoxDescriptionPanel::~wxCDMBlackBoxDescriptionPanel()
+{
+}
+
+bool wxCDMBlackBoxDescriptionPanel::Create(
+    wxWindow* parent,
+    modelCDMBlackBox* blackBox,
+    wxWindowID id,
+    const wxString& caption,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style
+)
+{
+  wxPanel::Create(parent, id, pos, size, style);
+  this->blackBox = blackBox;
+  CreateControls();
+  return TRUE;
+}
+
+void wxCDMBlackBoxDescriptionPanel::CreateControls()
+{
+  wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+  //Welcome
+  sizer->Add(new wxStaticText(this, -1, _("Black Box")),0, wxALIGN_CENTER, 0);
+
+  //Image
+  sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(BBIcon)),0, wxALIGN_CENTER, 0);
+
+  //BlackBox Name
+  sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->blackBox->GetNameBlackBox())),0, wxALIGN_CENTER, 0);
+
+  //BlackBox Properties
+    wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Properties"));
+    wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL);
+
+    wxFlexGridSizer* flexGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
+
+    wxStaticText *pAuthor = new wxStaticText(this, -1, wxT("Author"));
+    wxStaticText *pAuthorEmail = new wxStaticText(this, -1, wxT("Author E-mail"));
+    wxStaticText *pCategories = new wxStaticText(this, -1, wxT("Categories"));
+    wxStaticText *pDescription = new wxStaticText(this, -1, wxT("Description"));
+
+    wxTextCtrl *pAuthortc = new wxTextCtrl(this, -1, crea::std2wx(this->blackBox->GetAuthors()));
+    wxTextCtrl *pAuthorEmailtc = new wxTextCtrl(this, -1, crea::std2wx(this->blackBox->GetAuthorsEmail()));
+    wxTextCtrl *pCategoriestc = new wxTextCtrl(this, -1, crea::std2wx(this->blackBox->GetCategories()));
+    wxTextCtrl *pDescriptiontc = new wxTextCtrl(this, -1, crea::std2wx(this->blackBox->GetDescription()));
+
+    flexGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    flexGridSizer->Add(pAuthortc, 1, wxEXPAND);
+    flexGridSizer->Add(pAuthorEmail, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    flexGridSizer->Add(pAuthorEmailtc, 1, wxEXPAND);
+    flexGridSizer->Add(pCategories, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    flexGridSizer->Add(pCategoriestc, 1, wxEXPAND);
+    flexGridSizer->Add(pDescription, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    flexGridSizer->Add(pDescriptiontc, 1, wxEXPAND);
+
+    propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxEXPAND);
+    sizer -> Add(propertiesBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+
+
+  //Actions
+  wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions"));
+  wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL);
+  sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+
+  actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPEN_CXX, _T("Open Cxx")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
+  actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPEN_HXX, _T("Open Hxx")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
+
+  //Assign sizer
+  actionsBoxInnerSizer->SetSizeHints(this);
+
+  SetSizer(sizer);
+  sizer->SetSizeHints(this);
+}
+
+void wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx(wxCommandEvent& event)
+{
+  //TODO: implement method
+  std::cerr << "Event OnBtnOpenCxx not implemented" << std::endl;
+  event.Skip();
+}
+
+void wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx(wxCommandEvent& event)
+{
+  //TODO: implement method
+  std::cerr << "Event OnBtnOpenHxx not implemented" << std::endl;
+  event.Skip();
+}