1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
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
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 #ifndef VVTOOLWIDGETBASE_H
20 #define VVTOOLWIDGETBASE_H
22 #if QT_VERSION < 0x050000
23 #include <QtDesigner/QDesignerExportWidget>
25 #include <QtUiPlugin/QDesignerExportWidget>
27 #include "ui_vvToolWidgetBase.h"
28 #include "clitkImageToImageGenericFilter.h"
31 #include <QCloseEvent>
33 class vvMainWindowBase;
35 //------------------------------------------------------------------------------
36 class vvToolWidgetBase:
38 public Ui::vvToolWidgetBase
43 vvToolWidgetBase(vvMainWindowBase * parent=0, Qt::WindowFlags f=Qt::Dialog, bool initialize=true); // default is a dialog
44 virtual ~vvToolWidgetBase();
46 virtual void InputIsSelected(vvSlicerManager *m);
47 virtual void InputIsSelected(std::vector<vvSlicerManager*> & l);
48 void AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip=false);
49 void AddInputSelector(QString s, bool allowSkip=false);
50 void HideInputSelector();
55 virtual void apply() = 0;
57 void InputIsSelected();
58 virtual void AnImageIsBeingClosed(vvSlicerManager * m);
59 virtual void SelectedImageHasChanged(vvSlicerManager * m);
61 virtual void keyPressEvent(QKeyEvent *event);
64 virtual void Initialization();
65 void InitializeInputs();
66 Ui::vvToolWidgetBase ui;
67 clitk::ImageToImageGenericFilterBase::Pointer mFilter;
68 vvMainWindowBase * mMainWindow;
69 std::vector<vvSlicerManager*> mSlicerManagersCompatible;
70 vvSlicerManager * mCurrentSlicerManager;
71 int mCurrentCompatibleIndex;
72 vvImage * mCurrentImage;
74 QWidget * mWidgetForTab;
76 // The static members manage all tool instances
77 static QWidget * mStaticWidgetForTab; // <-- MUST BE CHANGED IN VECTOR
78 static int mTabNumber;
79 static QVBoxLayout * mStaticVerticalLayout; // <-- MUST BE CHANGED IN VECTOR
80 static bool mIsAnotherToolWaitInput;
81 virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index) { }
82 virtual void closeEvent(QCloseEvent *event);
83 void SwapCurrentWidget();
84 bool mPreventToUseTwoToolsOnSameInput;
86 }; // end class vvToolWidgetBase
87 //------------------------------------------------------------------------------