]> Creatis software - clitk.git/blob - vv/vvToolCreator.h
added the new headers
[clitk.git] / vv / vvToolCreator.h
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 #ifndef VVTOOLCREATOR_H
19 #define VVTOOLCREATOR_H
20 #include "vvToolCreatorBase.h"
21
22 //------------------------------------------------------------------------------
23 template<class ToolType>
24 class vvToolCreator: public vvToolCreatorBase {
25 public:
26   vvToolCreator(QString name):vvToolCreatorBase(name) {;}
27   virtual void InsertToolInMenu(vvMainWindowBase * m);
28   virtual void MenuSpecificToolSlot() { CreateTool<ToolType>(); }
29   static vvToolCreator<ToolType> * mSingleton;
30 };
31 //------------------------------------------------------------------------------
32
33
34 //------------------------------------------------------------------------------
35 #define CREATOR(CLASSNAME) vvToolCreator<CLASSNAME>::mSingleton
36 //------------------------------------------------------------------------------
37
38
39 //------------------------------------------------------------------------------
40 #define ADD_TOOL(NAME)                                          \
41   template<>                                                    \
42   vvToolCreator<NAME> * vvToolCreator<NAME>::mSingleton =       \
43     new vvToolCreator<NAME>(#NAME);
44 //------------------------------------------------------------------------------
45
46 #include "vvToolCreator.txx"
47
48 #endif
49