2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
29 * wxCDMBlackBoxDescriptionPanel.cpp
31 * Created on: Nov 27, 2012
32 * Author: Daniel Felipe Gonzalez Obando
35 #include "wxCDMBlackBoxDescriptionPanel.h"
37 #include "wxCDMMainFrame.h"
39 #include "creaDevManagerIds.h"
40 #include "images/BBIcon64.xpm"
42 BEGIN_EVENT_TABLE(wxCDMBlackBoxDescriptionPanel, wxPanel)
43 EVT_BUTTON(ID_BUTTON_PREV, wxCDMBlackBoxDescriptionPanel::OnBtnReturn)
44 EVT_BUTTON(ID_BUTTON_OPEN_CXX, wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx)
45 EVT_BUTTON(ID_BUTTON_OPEN_HXX, wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx)
46 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMBlackBoxDescriptionPanel::OnBtnOpenFolder)
49 wxCDMBlackBoxDescriptionPanel::wxCDMBlackBoxDescriptionPanel(
51 modelCDMBlackBox* blackBox,
53 const wxString& caption,
59 wxCDMBlackBoxDescriptionPanel::Create(parent, blackBox, id, caption, pos, size, style);
62 wxCDMBlackBoxDescriptionPanel::~wxCDMBlackBoxDescriptionPanel()
66 bool wxCDMBlackBoxDescriptionPanel::Create(
68 modelCDMBlackBox* blackBox,
70 const wxString& caption,
76 wxPanel::Create(parent, id, pos, size, style);
77 this->blackBox = blackBox;
82 void wxCDMBlackBoxDescriptionPanel::CreateControls()
84 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
87 wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project"));
88 returnbt->SetToolTip(wxT("Return to the active project description."));
89 sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5);
92 sizer->Add(new wxStaticText(this, -1, _("Black Box")),0, wxALIGN_CENTER, 0);
95 sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(BBIcon64)),0, wxALIGN_CENTER, 0);
98 sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->blackBox->GetNameBlackBox())),0, wxALIGN_CENTER, 0);
100 //BlackBox Properties
101 wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties"));
102 wxPanel* propertiesPanel = new wxPanel(this);
103 wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
104 wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
106 wxStaticText *pAuthor = new wxStaticText(propertiesPanel, -1, wxT("Author"));
107 wxStaticText *pVersion = new wxStaticText(propertiesPanel, -1, wxT("Version"));
108 wxStaticText *pDescription = new wxStaticText(propertiesPanel, -1, wxT("Description"));
109 wxStaticText *pCategories = new wxStaticText(propertiesPanel, -1, wxT("Categories"));
112 wxBoxSizer* pAuthorsz = new wxBoxSizer(wxHORIZONTAL);
113 wxStaticText* pAuthortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetAuthors()));
114 wxButton* pAuthorbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Change"));
115 pAuthorbt->SetToolTip(wxT("Update the author/s of the package."));
116 pAuthorsz->Add(pAuthortc, 0, wxALIGN_CENTER_VERTICAL, 0);
117 pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER | wxLEFT, 10);
120 wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL);
121 wxStaticText* pVersiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetVersion()));
122 wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
123 pVersionbt->SetToolTip(wxT("Update the version of the package."));
124 pVersionsz->Add(pVersiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
125 pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
128 wxBoxSizer* pDescriptionsz = new wxBoxSizer(wxHORIZONTAL);
129 wxStaticText* pDescriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetDescription()));
130 wxButton* pDescriptionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Change"));
131 pDescriptionbt->SetToolTip(wxT("Update the description of the project."));
132 pDescriptionsz->Add(pDescriptiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
133 pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
136 wxBoxSizer* pCategoriessz = new wxBoxSizer(wxHORIZONTAL);
137 wxStaticText* pCategoriestc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetCategories()));
138 wxButton* pCategoriesbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Change"));
139 pCategoriesbt->SetToolTip(wxT("Update the categories of the project."));
140 pCategoriessz->Add(pCategoriestc, 0, wxALIGN_CENTER_VERTICAL, 0);
141 pCategoriessz->Add(pCategoriesbt, 0, wxALIGN_CENTER | wxLEFT, 10);
143 propertiesGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
144 propertiesGridSizer->Add(pAuthorsz, 1, wxEXPAND);
145 propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
146 propertiesGridSizer->Add(pVersionsz, 1, wxEXPAND);
147 propertiesGridSizer->Add(pDescription, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
148 propertiesGridSizer->Add(pDescriptionsz, 1, wxEXPAND);
149 propertiesGridSizer->Add(pCategories, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
150 propertiesGridSizer->Add(pCategoriessz, 1, wxEXPAND);
152 propertiesGridSizer->AddGrowableCol(1,1);
154 propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
155 propertiesPanel->SetSizer(propertiesPanelSizer);
156 propertiesPanelSizer->Fit(propertiesPanel);
157 propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
159 sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
163 wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions"));
164 wxPanel* actionsPanel = new wxPanel(this);
165 wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
167 wxButton* openCxxbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("Open Cxx"));
168 openCxxbt->SetToolTip(wxT("Open the .cxx file in the default text editor."));
169 actionsPanelSizer->Add(openCxxbt, 0, wxALL, 5);
170 wxButton* openHxxbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("Open Hxx"));
171 openHxxbt->SetToolTip(wxT("Open the .hxx file in the default text editor."));
172 actionsPanelSizer->Add(openHxxbt, 0, wxALL, 5);
173 wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Package Folder"));
174 openFolderbt->SetToolTip(wxT("Open the package folder in the file explorer."));
175 actionsPanelSizer->Add(openFolderbt, 0, wxALL, 5);
177 actionsPanel->SetSizer(actionsPanelSizer);
178 actionsPanelSizer->Fit(actionsPanel);
179 actionsBox->Add(actionsPanel, 0, wxEXPAND);
180 sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10);
184 sizer->SetSizeHints(this);
187 void wxCDMBlackBoxDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
189 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
190 newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId());
192 wxPostEvent(this->GetParent(), *newEvent);
195 void wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx(wxCommandEvent& event)
197 //TODO: implement method
198 std::cerr << "Event OnBtnOpenCxx not implemented" << std::endl;
202 void wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx(wxCommandEvent& event)
204 //TODO: implement method
205 std::cerr << "Event OnBtnOpenHxx not implemented" << std::endl;
209 void wxCDMBlackBoxDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
211 //TODO: implement method
212 std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;