2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------
26 /*=========================================================================
32 =========================================================================*/
34 /* ---------------------------------------------------------------------
36 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux, Ricardo A Corredor
39 * This software is governed by the CeCILL-B license under French law and
40 * abiding by the rules of distribution of free software. You can use,
41 * modify and/ or redistribute the software under the terms of the CeCILL-B
42 * license as circulated by CEA, CNRS and INRIA at the following URL
43 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
44 * or in the file LICENSE.txt.
46 * As a counterpart to the access to the source code and rights to copy,
47 * modify and redistribute granted by the license, users are provided only
48 * with a limited warranty and the software's author, the holder of the
49 * economic rights, and the successive licensors have only limited
52 * The fact that you are presently reading this means that you have had
53 * knowledge of the CeCILL-B license and that you accept its terms.
54 * ------------------------------------------------------------------------ */
58 * \brief Class bbtk::wxDiagramPropertiesEditionDialog .
61 #include "wxDiagramPropertiesEditionDialog.h"
66 //=========================================================================
68 wxDiagramPropertiesEditionDialog::wxDiagramPropertiesEditionDialog(wxGUIEditorGraphicBBS *parent):wxDialog(parent,wxID_ANY,_T("Diagram Properties"), wxDefaultPosition, wxSize(320, 280),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
71 constructDiagramPropertiesEditionDialog();
74 //=========================================================================
77 wxDiagramPropertiesEditionDialog::~wxDiagramPropertiesEditionDialog()
82 //=========================================================================
84 void wxDiagramPropertiesEditionDialog::constructDiagramPropertiesEditionDialog()
86 const int ID_COMBO = 1;
87 wxPanel *panel = new wxPanel(this, -1);
88 wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
89 wxFlexGridSizer *fgsizer = new wxFlexGridSizer(5, 2, 9, 25);
92 // SELECTION CONSTANTS
95 _diagramType = new wxComboBox(panel, -1, wxEmptyString, wxDefaultPosition, wxSize(100,-1) );
96 _diagramType->Append (wxT("Application"));
97 _diagramType->Append (wxT("Complex box"));
98 _diagramType->SetEditable(false);
99 //_diagramType->Enable(false);
101 Connect(ID_COMBO, wxEVT_COMMAND_COMBOBOX_SELECTED,
102 wxCommandEventHandler(wxDiagramPropertiesEditionDialog::OnComboBoxSelected));
104 int currentType = (_parent->isCurrentDiagramComplexBox()==false)? 0 : 1;
105 _diagramType->Select(currentType);
107 wxStaticText *type = new wxStaticText(panel, -1, wxT("Type"));
108 wxStaticText *author = new wxStaticText(panel, -1, wxT("Author"));
109 wxStaticText *category = new wxStaticText(panel, -1, wxT("Categories"));
110 wxStaticText *description = new wxStaticText(panel, -1, wxT("Description"));
112 _txtAuthor = new wxTextCtrl(panel, -1);
113 _txtCategory = new wxTextCtrl(panel, -1);
114 _txtDescription = new wxTextCtrl(panel, -1, wxT(""), wxPoint(-1, -1), wxSize(-1, -1), wxTE_MULTILINE);
115 wxButton *okButton = new wxButton(panel, -1, _T("Ok"),wxDefaultPosition, wxSize(-1, -1));
116 wxButton *closeButton = new wxButton(panel, -1, _T("Close"), wxDefaultPosition, wxSize(-1, -1));
118 // connect command event handlers
119 Connect(okButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxDiagramPropertiesEditionDialog::onClickOk));
120 Connect(closeButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxDiagramPropertiesEditionDialog::onClickClose));
122 // Assign loaded values
123 _txtAuthor->SetValue(crea::std2wx(_parent->getCurrentDiagramAuthor()));
124 _txtCategory->SetValue(crea::std2wx(_parent->getCurrentDiagramCategory()));
125 _txtDescription->SetValue(crea::std2wx(_parent->getCurrentDiagramDescription()));
129 fgsizer->Add(_diagramType, 1, wxEXPAND);
130 fgsizer->Add(author);
131 fgsizer->Add(_txtAuthor, 1, wxEXPAND);
132 fgsizer->Add(category);
133 fgsizer->Add(_txtCategory, 1, wxEXPAND);
134 fgsizer->Add(description, 1, wxEXPAND);
135 fgsizer->Add(_txtDescription, 1, wxEXPAND);
136 fgsizer->Add(okButton, 1, wxEXPAND);
137 fgsizer->Add(closeButton, 1, wxEXPAND);
139 fgsizer->AddGrowableRow(3, 1);
140 fgsizer->AddGrowableCol(1, 1);
142 hbox->Add(fgsizer, 1, wxALL | wxEXPAND, 15);
143 panel->SetSizerAndFit(hbox);
149 // Assign loaded values
150 _txtAuthor->SetValue(crea::std2wx(_parent->getCurrentDiagramAuthor()));
151 _txtCategory->SetValue(crea::std2wx(_parent->getCurrentDiagramCategory()));
152 _txtDescription->SetValue(crea::std2wx(_parent->getCurrentDiagramDescription()));
155 //=========================================================================
157 void wxDiagramPropertiesEditionDialog::onClickOk(wxCommandEvent& event)
160 std::string txtAuthor = wx2std(_txtAuthor->GetValue());
161 std::string txtCategory = wx2std(_txtCategory->GetValue());
162 std::string txtDescription = wx2std(_txtDescription->GetValue());
163 _parent->setCurrentDiagramAuthor(txtAuthor);
164 _parent->setCurrentDiagramCategory(txtCategory);
165 _parent->setCurrentDiagramDescription(txtDescription);
167 // SELECTION CONSTANTS
170 int selection = _diagramType->GetSelection();
172 _parent->disableComplexBox();
173 else if (selection == 1)
174 _parent->enableComplexBox();
179 //=========================================================================
181 void wxDiagramPropertiesEditionDialog::onClickClose(wxCommandEvent& event)
183 printf("RaC wxDiagramPropertiesEditionDialog::onClickClose\n");
187 //=========================================================================
189 void wxDiagramPropertiesEditionDialog::OnComboBoxSelected(wxCommandEvent& event)
191 // TODO Show info to edit complex boxes
194 //=========================================================================
199 } // EO namespace bbtk