fw4spl
SliceSelector.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWGUIQT_SLICESELECTOR_HPP__
8 #define __FWGUIQT_SLICESELECTOR_HPP__
9 
10 #include "fwGuiQt/config.hpp"
11 
12 #include <boost/function.hpp>
13 
14 #include <QObject>
15 #include <QPointer>
16 #include <QWidget>
17 
18 #include <functional>
19 
20 // Qt
21 class QSlider;
22 class QLineEdit;
23 class QComboBox;
24 class QStringList;
25 
26 namespace fwGuiQt
27 {
28 
33 class SliceSelector : public QWidget
34 {
35 
36 Q_OBJECT
37 
38 public:
43  FWGUIQT_API SliceSelector( QWidget* const parent = nullptr) noexcept;
44 
46  FWGUIQT_API virtual ~SliceSelector() noexcept;
47 
48  FWGUIQT_API void setSliceRange( int min, int max );
49 
50  FWGUIQT_API void setSliceValue( int index );
51 
52  FWGUIQT_API void setTypeSelection( int type );
53 
54  FWGUIQT_API void setEnable(bool enable);
55 
56  typedef std::function<void (int) > ChangeIndexCallback;
57  FWGUIQT_API void setChangeIndexCallback(ChangeIndexCallback fct);
58 
59  typedef std::function<void (int) > ChangeTypeCallback;
60  FWGUIQT_API void setChangeTypeCallback(ChangeTypeCallback fct);
61 
62 protected Q_SLOTS:
63 
68  FWGUIQT_API void onSliceTypeChange( int index );
69 
74  FWGUIQT_API void onSliceIndexChange( int value ) noexcept;
75 
76 private:
77 
78  QPointer< QComboBox > m_sliceType;
79 
81  QPointer< QSlider > m_sliceIndex;
82  QPointer< QLineEdit > m_pSliceIndexText;
83 
84  void printIndex(int index);
85  void printType(int type);
86 
87  ChangeIndexCallback m_fctChangeIndexCallback;
88  ChangeTypeCallback m_fctChangeTypeCallback;
89 };
90 
91 } // fwGuiQt
92 
93 #endif // __FWGUIQT_SLICESELECTOR_HPP__
FWGUIQT_API void onSliceIndexChange(int value) noexcept
Event handler for a slice index change.
virtual FWGUIQT_API ~SliceSelector() noexcept
Destructor.
The namespace fwGuiQt contains classes which provide the implementation of the Gui using Qt library...
Definition: WindowLevel.hpp:32
FWGUIQT_API void onSliceTypeChange(int index)
Event handler for a slice type change.
A qt panel used to control a VTK 2D Negatoscope view.
FWGUIQT_API SliceSelector(QWidget *const parent=nullptr) noexcept
Constructor.