fw4spl
fwVtkWheelWidget.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 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 __FWRENDERVTK_VTK_FWVTKWHEELWIDGET_HPP__
8 #define __FWRENDERVTK_VTK_FWVTKWHEELWIDGET_HPP__
9 
10 #include "fwRenderVTK/config.hpp"
11 #include "fwRenderVTK/vtk/fwVtkWheelRepresentation.hpp"
12 
13 #include <vtkAbstractWidget.h>
14 
15 #include <functional>
16 
23 class FWRENDERVTK_CLASS_API fwVtkWheelWidget : public vtkAbstractWidget
24 {
25 public:
26 
28  FWRENDERVTK_API static fwVtkWheelWidget* New();
29 
30  vtkTypeMacro(fwVtkWheelWidget, vtkAbstractWidget);
31 
33  FWRENDERVTK_API void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
34 
36  FWRENDERVTK_API void SetRepresentation(fwVtkWheelRepresentation* rep);
37 
39  FWRENDERVTK_API fwVtkWheelRepresentation* GetRepresentation() const;
40 
42  FWRENDERVTK_API void CreateDefaultRepresentation() VTK_OVERRIDE;
43 
44  FWRENDERVTK_API void SetWheelUpdateCallback(std::function<void (double, double, double)> f);
45 
46 private:
47 
50 
52  ~fwVtkWheelWidget() VTK_OVERRIDE
53  {
54  }
55 
57  static void SelectAction(vtkAbstractWidget*);
58 
60  static void MoveAction(vtkAbstractWidget*);
61 
63  static void EndSelectAction(vtkAbstractWidget*);
64 
66  enum _WidgetState
67  {
68  Start = 0,
69  Hovering,
70  Selecting,
71  Rotating,
72  Outside
73  } WidgetState;
74 
75  fwVtkWheelWidget(const fwVtkWheelWidget&) VTK_DELETE_FUNCTION;
76  void operator=(const fwVtkWheelWidget&) VTK_DELETE_FUNCTION;
77 
79  int m_initMouseX;
80  int m_initMouseY;
81 
83  double m_initOrientation;
84 
86  std::function< void (double, double, double) > m_wheelUpdateCallback;
87 };
88 
89 #endif // __FWRENDERVTK_VTK_FWVTKWHEELWIDGET_HPP__
Implements the interactions with the wheel widget.
Representation of a wheel widget.