VTK  9.0.1
vtkHandleWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHandleWidget.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
67 #ifndef vtkHandleWidget_h
68 #define vtkHandleWidget_h
69 
70 #include "vtkAbstractWidget.h"
71 #include "vtkInteractionWidgetsModule.h" // For export macro
72 
74 
75 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
76 {
77 public:
81  static vtkHandleWidget* New();
82 
84 
88  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
97  {
98  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
99  }
100 
105  {
106  return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);
107  }
108 
113  void CreateDefaultRepresentation() override;
114 
116 
121  vtkSetMacro(EnableAxisConstraint, vtkTypeBool);
122  vtkGetMacro(EnableAxisConstraint, vtkTypeBool);
123  vtkBooleanMacro(EnableAxisConstraint, vtkTypeBool);
125 
127 
130  vtkSetMacro(EnableTranslation, vtkTypeBool);
131  vtkGetMacro(EnableTranslation, vtkTypeBool);
132  vtkBooleanMacro(EnableTranslation, vtkTypeBool);
134 
136 
140  vtkSetMacro(AllowHandleResize, vtkTypeBool);
141  vtkGetMacro(AllowHandleResize, vtkTypeBool);
142  vtkBooleanMacro(AllowHandleResize, vtkTypeBool);
144 
146 
149  vtkGetMacro(WidgetState, int);
151 
153 
158  vtkSetMacro(ShowInactive, vtkTypeBool);
159  vtkGetMacro(ShowInactive, vtkTypeBool);
160  vtkBooleanMacro(ShowInactive, vtkTypeBool);
162 
163  // Manage the state of the widget
165  {
166  Start = 0,
168  Inactive
169  };
170 
175  void SetEnabled(int enabling) override;
176 
177 protected:
178  vtkHandleWidget();
179  ~vtkHandleWidget() override;
180 
181  // These are the callbacks for this widget
182  static void GenericAction(vtkHandleWidget*);
183  static void SelectAction(vtkAbstractWidget*);
184  static void EndSelectAction(vtkAbstractWidget*);
185  static void TranslateAction(vtkAbstractWidget*);
186  static void ScaleAction(vtkAbstractWidget*);
187  static void MoveAction(vtkAbstractWidget*);
188  static void SelectAction3D(vtkAbstractWidget*);
189  static void MoveAction3D(vtkAbstractWidget*);
190  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
191 
192  // helper methods for cursor management
193  void SetCursor(int state) override;
194 
198 
199  // Allow resizing of handles.
201 
202  // Keep representation visible when disabled
204 
206 
207 private:
208  vtkHandleWidget(const vtkHandleWidget&) = delete;
209  void operator=(const vtkHandleWidget&) = delete;
210 };
211 
212 #endif
vtkTypeBool AllowHandleResize
virtual void SetCursor(int vtkNotUsed(state))
abstract base class for most VTK objects
Definition: vtkObject.h:56
abstract class for representing widget handles
vtkCallbackCommand * KeyEventCallbackCommand
vtkTypeBool EnableTranslation
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
a general widget for moving handles
void SetRepresentation(vtkHandleRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
vtkWidgetRepresentation * WidgetRep
int vtkTypeBool
Definition: vtkABI.h:69
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTypeBool ShowInactive
define the API for widget / widget representation
void SetEnabled(int) override
Methods for activating this widget.
vtkTypeBool EnableAxisConstraint
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...