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"
43 //=========================================================================
44 wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent)
48 _notebook = _parent->getAuiNotebook();
50 _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this);
53 //=========================================================================
54 wxTabPanelsManager::~wxTabPanelsManager()
58 //=========================================================================
59 void wxTabPanelsManager::addNewTab(wxString tabName)
61 printf("EED wxTabPanelsManager::addNewTab 0\n");
64 wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId);
65 newPanel->setPanelsManager(this);
66 _panels[_lastId] = newPanel;
68 _notebook->AddPage(newPanel, tabName ,true);
69 printf("EED wxTabPanelsManager::addNewTab 1\n");
72 //=========================================================================
73 wxAuiNotebook* wxTabPanelsManager::getAuiNotebook()
78 //=========================================================================
79 wxGEditorTabPanel* wxTabPanelsManager::getActualTabPanel()
84 //=========================================================================
86 void wxTabPanelsManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
88 _parent->displayBlackBoxInfo(packageName,boxName);
91 //=========================================================================
93 void wxTabPanelsManager::updateStatusBar(std::string textStatus)
95 _parent->updateStatusBar(textStatus);
98 //=========================================================================
100 std::string wxTabPanelsManager::getActualDiagramBBS(bool wln)
102 return _actual->getDiagramBBS(wln);
105 //=========================================================================
107 std::string wxTabPanelsManager::getActualComplexBoxBBS()
109 return _actual->saveComplexBoxBBS();
112 //=========================================================================
114 void wxTabPanelsManager::editBlackBox(GBlackBoxModel *bbmodel)
116 _parent->editBlackBox(bbmodel);
119 //=========================================================================
121 void wxTabPanelsManager::deleteAllBoxesActualDiagram()
123 _actual->deleteAllBoxes();
126 //=========================================================================
128 void wxTabPanelsManager::centerViewActualDiagram()
130 _actual->centerView();
133 //=========================================================================
135 void wxTabPanelsManager::saveActualDiagram(std::string &content)
137 _actual->saveDiagram(content);
140 //=========================================================================
142 void wxTabPanelsManager::loadDiagram(ifstream &inputStream)
144 _actual->loadDiagram(inputStream);
147 //=========================================================================
149 bool wxTabPanelsManager::isActualDiagramComplexBox()
151 return _actual->isComplexBox();
154 //=========================================================================
156 void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
158 _actual->setComplexBox(val);
161 //=========================================================================
163 void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
165 _actual->addComplexInputPort(portName);
168 //=========================================================================
170 void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
172 _actual->addComplexOutputPort(portName);
175 //=========================================================================
177 void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
179 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
181 setActualDiagramComplexBox(true);
182 _actual->addObjects(mapSelected);
183 _parent->refreshGUIControls();
186 //=========================================================================
188 int wxTabPanelsManager::getNumActualSelectedObjects()
190 return _actual->getNumSelectedObjects();
193 //=========================================================================
195 void wxTabPanelsManager::VerifyLastTabPanel()
197 printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() );
198 if (this->_notebook->GetPageCount()==0)
204 //=========================================================================
206 void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
208 int index = event.GetSelection();
209 wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index);
210 int id = tab->getPanelId();
211 _actual = _panels[id];
212 _parent->refreshGUIControls();
215 //=========================================================================
216 std::string wxTabPanelsManager::GetCbName()
218 return _actual->GetCbName();
221 void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
223 int id = _notebook->GetSelection();
224 _notebook->SetPageText( id , tabpanelname );
229 //=========================================================================
230 std::string wxTabPanelsManager::GetCbPackageName()
232 return _actual->GetCbPackageName();
235 //=========================================================================
236 std::string wxTabPanelsManager::GetAuthor()
238 return _actual->GetAuthor();
241 //=========================================================================
242 std::string wxTabPanelsManager::GetDescription()
244 return _actual->GetDescription();
247 //=========================================================================
248 std::string wxTabPanelsManager::GetCategory()
250 return _actual->GetCategory();
253 //=========================================================================
254 void wxTabPanelsManager::SetCbName(std::string cbName)
256 _actual->SetCbName( cbName );
259 //=========================================================================
260 void wxTabPanelsManager::SetCbPackageName(std::string packagename)
262 _actual->SetCbPackageName( packagename );
266 //=========================================================================
267 void wxTabPanelsManager::SetAuthor(std::string author)
269 _actual->SetAuthor( author );
273 //=========================================================================
274 void wxTabPanelsManager::SetCategory(std::string category)
276 _actual->SetCategory( category );
280 //=========================================================================
281 void wxTabPanelsManager::SetDescription(std::string description)
283 _actual->SetDescription( description );
295 } // EO namespace bbtk