]> Creatis software - clitk.git/blob - vv/vvToolManager.cxx
added the new headers
[clitk.git] / vv / vvToolManager.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #include "vvToolManager.h"
19 #include "vvToolCreatorBase.h"
20 #include "vvMainWindowBase.h"
21
22 //------------------------------------------------------------------------------
23 /// Unique static instance 
24 vvToolManager* vvToolManager::mSingleton=0; 
25 //------------------------------------------------------------------------------
26
27
28 //------------------------------------------------------------------------------
29 vvToolManager * vvToolManager::GetInstance() {
30   if (mSingleton == 0) {
31     mSingleton = new vvToolManager;
32   }
33   return mSingleton;
34 }
35 //------------------------------------------------------------------------------
36
37
38 //------------------------------------------------------------------------------
39 void vvToolManager::AddTool(vvToolCreatorBase * v)  {
40   std::cout << "Adding the tool <" << v->mToolName.toStdString() << ">." << std::endl;
41   GetInstance()->mListOfTools.push_back(v);
42 }  
43 //------------------------------------------------------------------------------
44
45
46 //------------------------------------------------------------------------------
47 void vvToolManager::InsertToolsInMenu(vvMainWindowBase * m) {
48   for(unsigned int i=0; i<GetInstance()->mListOfTools.size(); i++) {
49     GetInstance()->mListOfTools[i]->InsertToolInMenu(m);
50   }
51 }
52 //------------------------------------------------------------------------------
53