1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux, Ricardo A Corredor
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::wxDiagramPropertiesEditionDialog .
36 #include "wxDiagramPropertiesEditionDialog.h"
41 //=========================================================================
43 wxDiagramPropertiesEditionDialog::wxDiagramPropertiesEditionDialog(wxGUIEditorGraphicBBS *parent):wxDialog(parent,wxID_ANY,_T("Diagram Properties"), wxDefaultPosition, wxSize(520, 640),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
46 constructDiagramPropertiesEditionDialog();
49 //=========================================================================
52 wxDiagramPropertiesEditionDialog::~wxDiagramPropertiesEditionDialog()
57 //=========================================================================
59 void wxDiagramPropertiesEditionDialog::constructDiagramPropertiesEditionDialog()
62 wxPanel *panel = new wxPanel(this, -1);
63 wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
64 wxFlexGridSizer *fgsizer = new wxFlexGridSizer(4, 2, 9, 25);
66 wxStaticText *author = new wxStaticText(panel, -1, wxT("Author"));
67 wxStaticText *category = new wxStaticText(panel, -1, wxT("Category"));
68 wxStaticText *description = new wxStaticText(panel, -1, wxT("Description"));
70 _txtAuthor = new wxTextCtrl(panel, -1);
71 _txtCategory = new wxTextCtrl(panel, -1);
72 _txtDescription = new wxTextCtrl(panel, -1, wxT(""), wxPoint(-1, -1), wxSize(-1, -1), wxTE_MULTILINE);
73 wxButton *okButton = new wxButton(panel, -1, _T("Ok"),wxDefaultPosition, wxSize(-1, -1));
74 wxButton *closeButton = new wxButton(panel, -1, _T("Close"), wxDefaultPosition, wxSize(-1, -1));
76 // connect command event handlers
77 Connect(okButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxDiagramPropertiesEditionDialog::onClickOk));
78 Connect(closeButton->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxDiagramPropertiesEditionDialog::onClickClose));
82 fgsizer->Add(_txtAuthor, 1, wxEXPAND);
83 fgsizer->Add(category);
84 fgsizer->Add(_txtCategory, 1, wxEXPAND);
85 fgsizer->Add(description, 1, wxEXPAND);
86 fgsizer->Add(_txtDescription, 1, wxEXPAND);
87 fgsizer->Add(okButton, 1, wxEXPAND);
88 fgsizer->Add(closeButton, 1, wxEXPAND);
90 fgsizer->AddGrowableRow(2, 1);
91 fgsizer->AddGrowableCol(1, 1);
93 hbox->Add(fgsizer, 1, wxALL | wxEXPAND, 15);
94 panel->SetSizer(hbox);
100 // Assign loaded values
102 _txtAuthor->SetValue(crea::std2wx(_parent->getCurrentDiagramAuthor()));
103 _txtCategory->SetValue(crea::std2wx(_parent->getCurrentDiagramCategory()));
104 _txtDescription->SetValue(crea::std2wx(_parent->getCurrentDiagramDescription()));
107 //=========================================================================
109 void wxDiagramPropertiesEditionDialog::onClickOk(wxCommandEvent& event)
112 std::string txtAuthor = wx2std(_txtAuthor->GetValue());
113 std::string txtCategory = wx2std(_txtCategory->GetValue());
114 std::string txtDescription = wx2std(_txtDescription->GetValue());
115 _parent->setCurrentDiagramAuthor(txtAuthor);
116 _parent->setCurrentDiagramCategory(txtCategory);
117 _parent->setCurrentDiagramDescription(txtDescription);
121 //=========================================================================
123 void wxDiagramPropertiesEditionDialog::onClickClose(wxCommandEvent& event)
125 printf("RaC wxDiagramPropertiesEditionDialog::onClickClose\n");
129 //=========================================================================
131 //=========================================================================
136 } // EO namespace bbtk