]> Creatis software - clitk.git/blob - vv/vvToolCreatorBase.h
Merge branch 'master' into vectorImage
[clitk.git] / vv / vvToolCreatorBase.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://www.centreleonberard.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 VVTOOLCREATORBASE_H
19 #define VVTOOLCREATORBASE_H
20
21 //qt
22 #include <QObject>
23
24 // vv
25 #include "vvSlicerManager.h"
26 #include "vvMainWindowBase.h"
27
28 class QAction;
29 class vvToolBaseBase;
30 class QXmlStreamReader;
31
32 //------------------------------------------------------------------------------
33 class vvToolCreatorBase: public QObject {
34   Q_OBJECT
35   public:
36
37   vvToolCreatorBase(QString name);
38   virtual ~vvToolCreatorBase() {;}  
39   virtual void InsertToolInMenu(vvMainWindowBase * m);
40   virtual void InsertToolInContextMenu();
41   template<class ToolType> void CreateTool();
42   virtual void MenuSpecificToolSlot() = 0;
43   vvMainWindowBase * GetMainWindow() const { return mMainWindow; }
44   void addMenuToContextMenu(QMenu * m);
45   void SetMenuName(std::string m) { m_MenuName = m; }
46
47   std::vector<vvToolBaseBase*> & GetListOfTool() { return mListOfTool; }
48
49   QString mToolName;
50   QString mToolMenuName;
51   QString mToolIconFilename;
52   QString mToolTip;
53   QAction * mAction;
54   bool mExperimental;
55   bool mUseContextMenu;
56   QMenu * mToolMenu;
57   std::vector<QAction*> mListOfActions;
58   std::auto_ptr<QXmlStreamReader> m_XmlReader;
59   bool mReadStateFlag;
60   int mImageIndex;
61
62 public slots:
63   virtual void MenuToolSlot();
64
65 protected:
66   vvMainWindowBase * mMainWindow;
67   std::vector<vvToolBaseBase*> mListOfTool;
68   QObject * mSender;
69   std::string m_MenuName;
70 };
71 //------------------------------------------------------------------------------
72
73 #include "vvToolCreatorBase.txx"
74
75 #endif
76