]> Creatis software - clitk.git/blob - vv/vvToolWidgetBase.h
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvToolWidgetBase.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
19 #ifndef VVTOOLWIDGETBASE_H
20 #define VVTOOLWIDGETBASE_H
21
22 #include <QtGlobal>
23 #if QT_VERSION >= 0x050000
24 #include <QtUiPlugin/QDesignerExportWidget>
25 #else
26 #include <QtDesigner/QDesignerExportWidget>
27 #endif
28 #include "ui_vvToolWidgetBase.h"
29 #include "clitkImageToImageGenericFilter.h"
30
31 // qt
32  #include <QCloseEvent>
33
34 class vvMainWindowBase;
35
36 //------------------------------------------------------------------------------
37 class vvToolWidgetBase:
38   public QWidget, 
39   public Ui::vvToolWidgetBase 
40 {
41   Q_OBJECT
42   public:
43
44   vvToolWidgetBase(vvMainWindowBase * parent=0, Qt::WindowFlags f=Qt::Dialog, bool initialize=true); // default is a dialog
45   virtual ~vvToolWidgetBase();
46
47   virtual void InputIsSelected(vvSlicerManager *m);
48   virtual void InputIsSelected(std::vector<vvSlicerManager*> & l);
49   void AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip=false);
50   void AddInputSelector(QString s, bool allowSkip=false);
51   void HideInputSelector();
52   void accept();
53   void reject();
54
55 public slots:
56   virtual void apply() = 0;
57   virtual bool close();
58   void InputIsSelected();
59   virtual void AnImageIsBeingClosed(vvSlicerManager * m);
60   virtual void SelectedImageHasChanged(vvSlicerManager * m);
61   void show();
62   virtual void keyPressEvent(QKeyEvent *event);
63
64 protected:
65   virtual void Initialization();
66   void InitializeInputs();
67   Ui::vvToolWidgetBase ui;
68   clitk::ImageToImageGenericFilterBase::Pointer mFilter;
69   vvMainWindowBase * mMainWindow;
70   std::vector<vvSlicerManager*> mSlicerManagersCompatible;
71   vvSlicerManager * mCurrentSlicerManager;
72   int mCurrentCompatibleIndex;
73   vvImage * mCurrentImage;
74   bool mIsInitialized;
75   QWidget * mWidgetForTab;
76   
77   // The static members manage all tool instances
78   static QWidget * mStaticWidgetForTab; // <-- MUST BE CHANGED IN VECTOR 
79   static int mTabNumber;
80   static QVBoxLayout * mStaticVerticalLayout;  // <-- MUST BE CHANGED IN VECTOR 
81   static bool mIsAnotherToolWaitInput;
82   virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index) { }
83   virtual void closeEvent(QCloseEvent *event);
84   void SwapCurrentWidget();
85   bool mPreventToUseTwoToolsOnSameInput;
86
87 }; // end class vvToolWidgetBase
88 //------------------------------------------------------------------------------
89
90 #endif
91