1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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::wxTabPanelsManager .
37 #include "wxTabPanelsManager.h"
44 //=========================================================================
45 wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent)
49 _notebook = _parent->getAuiNotebook();
51 _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this);
54 //=========================================================================
55 wxTabPanelsManager::~wxTabPanelsManager()
59 //=========================================================================
60 void wxTabPanelsManager::addNewTab(wxString tabName)
62 printf("EED wxTabPanelsManager::addNewTab 0\n");
65 wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId);
66 newPanel->setPanelsManager(this);
67 _panels[_lastId] = newPanel;
69 _notebook->AddPage(newPanel, tabName ,true);
70 printf("EED wxTabPanelsManager::addNewTab 1\n");
73 //=========================================================================
74 wxAuiNotebook* wxTabPanelsManager::getAuiNotebook()
79 //=========================================================================
80 wxGEditorTabPanel* wxTabPanelsManager::getActualTabPanel()
85 //=========================================================================
87 void wxTabPanelsManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
89 _parent->displayBlackBoxInfo(packageName,boxName);
92 //=========================================================================
94 void wxTabPanelsManager::updateStatusBar(std::string textStatus)
96 _parent->updateStatusBar(textStatus);
99 //=========================================================================
101 std::string wxTabPanelsManager::getActualDiagramBBS(bool wln)
103 return _actual->getDiagramBBS(wln);
106 //=========================================================================
108 std::string wxTabPanelsManager::getActualComplexBoxBBS()
110 return _actual->saveComplexBoxBBS();
113 //=========================================================================
115 void wxTabPanelsManager::editBlackBox(GBlackBoxModel *bbmodel)
117 _parent->editBlackBox(bbmodel);
120 //=========================================================================
122 void wxTabPanelsManager::deleteAllBoxesActualDiagram()
124 _actual->deleteAllBoxes();
127 //=========================================================================
129 void wxTabPanelsManager::centerViewActualDiagram()
131 _actual->centerView();
134 //=========================================================================
136 void wxTabPanelsManager::saveActualDiagram(std::string &content)
138 _actual->saveDiagram(content);
141 //=========================================================================
143 void wxTabPanelsManager::loadDiagram(ifstream &inputStream)
145 _actual->loadDiagram(inputStream);
148 //=========================================================================
150 bool wxTabPanelsManager::isActualDiagramComplexBox()
152 return _actual->isComplexBox();
155 //=========================================================================
157 void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
159 _actual->setComplexBox(val);
162 //=========================================================================
164 void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
166 _actual->addComplexInputPort(portName);
169 //=========================================================================
171 void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
173 _actual->addComplexOutputPort(portName);
176 //=========================================================================
178 void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
180 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
182 setActualDiagramComplexBox(true);
183 _actual->addObjects(mapSelected);
184 _parent->refreshGUIControls();
187 //=========================================================================
189 int wxTabPanelsManager::getNumActualSelectedObjects()
191 return _actual->getNumSelectedObjects();
194 //=========================================================================
196 void wxTabPanelsManager::VerifyLastTabPanel()
198 printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() );
199 if (this->_notebook->GetPageCount()==0)
205 //=========================================================================
207 void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
209 int index = event.GetSelection();
210 wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index);
211 int id = tab->getPanelId();
212 _actual = _panels[id];
213 _parent->refreshGUIControls();
216 //=========================================================================
217 std::string wxTabPanelsManager::GetCbName()
219 return _actual->GetCbName();
222 void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
224 int id = _notebook->GetSelection();
225 _notebook->SetPageText( id , tabpanelname );
230 //=========================================================================
231 std::string wxTabPanelsManager::GetCbPackageName()
233 return _actual->GetCbPackageName();
236 //=========================================================================
237 std::string wxTabPanelsManager::GetAuthor()
239 return _actual->GetAuthor();
242 //=========================================================================
243 std::string wxTabPanelsManager::GetDescription()
245 return _actual->GetDescription();
248 //=========================================================================
249 std::string wxTabPanelsManager::GetCategory()
251 return _actual->GetCategory();
254 //=========================================================================
255 void wxTabPanelsManager::SetCbName(std::string cbName)
257 _actual->SetCbName( cbName );
260 //=========================================================================
261 void wxTabPanelsManager::SetCbPackageName(std::string packagename)
263 _actual->SetCbPackageName( packagename );
267 //=========================================================================
268 void wxTabPanelsManager::SetAuthor(std::string author)
270 _actual->SetAuthor( author );
274 //=========================================================================
275 void wxTabPanelsManager::SetCategory(std::string category)
277 _actual->SetCategory( category );
281 //=========================================================================
282 void wxTabPanelsManager::SetDescription(std::string description)
284 _actual->SetDescription( description );
296 } // EO namespace bbtk