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