VTK  9.3.0
vtkHandleWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
58 #ifndef vtkHandleWidget_h
59 #define vtkHandleWidget_h
60 
61 #include "vtkAbstractWidget.h"
62 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
63 #include "vtkInteractionWidgetsModule.h" // For export macro
64 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
65 
66 VTK_ABI_NAMESPACE_BEGIN
68 
69 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
70 {
71 public:
75  static vtkHandleWidget* New();
76 
78 
82  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
91  {
92  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
93  }
94 
99  {
100  return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);
101  }
102 
108 
110 
115  vtkSetMacro(EnableAxisConstraint, vtkTypeBool);
116  vtkGetMacro(EnableAxisConstraint, vtkTypeBool);
117  vtkBooleanMacro(EnableAxisConstraint, vtkTypeBool);
119 
121 
124  vtkSetMacro(EnableTranslation, vtkTypeBool);
125  vtkGetMacro(EnableTranslation, vtkTypeBool);
126  vtkBooleanMacro(EnableTranslation, vtkTypeBool);
128 
130 
134  vtkSetMacro(AllowHandleResize, vtkTypeBool);
135  vtkGetMacro(AllowHandleResize, vtkTypeBool);
136  vtkBooleanMacro(AllowHandleResize, vtkTypeBool);
138 
140 
143  vtkGetMacro(WidgetState, int);
145 
147 
152  vtkSetMacro(ShowInactive, vtkTypeBool);
153  vtkGetMacro(ShowInactive, vtkTypeBool);
154  vtkBooleanMacro(ShowInactive, vtkTypeBool);
156 
157  // Manage the state of the widget
159  {
160  Start = 0,
162  Inactive
163  };
164 #if !defined(VTK_LEGACY_REMOVE)
165  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
167 #endif
168 
173  void SetEnabled(int enabling) override;
174 
175 protected:
177  ~vtkHandleWidget() override;
178 
179  // These are the callbacks for this widget
188  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
189 
190  // helper methods for cursor management
191  void SetCursor(int state) override;
192 
196 
197  // Allow resizing of handles.
199 
200  // Keep representation visible when disabled
202 
204 
205 private:
206  vtkHandleWidget(const vtkHandleWidget&) = delete;
207  void operator=(const vtkHandleWidget&) = delete;
208 };
209 
210 VTK_ABI_NAMESPACE_END
211 #endif
define the API for widget / widget representation
vtkWidgetRepresentation * WidgetRep
supports function callbacks
abstract class for representing widget handles
a general widget for moving handles
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK class macros.
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
static vtkHandleWidget * New()
Instantiate this class.
static void SelectAction(vtkAbstractWidget *)
static void ProcessKeyEvents(vtkObject *, unsigned long, void *, void *)
vtkCallbackCommand * KeyEventCallbackCommand
vtkTypeBool ShowInactive
void SetRepresentation(vtkHandleRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
static void GenericAction(vtkHandleWidget *)
static void MoveAction3D(vtkAbstractWidget *)
vtkTypeBool AllowHandleResize
void SetCursor(int state) override
static void MoveAction(vtkAbstractWidget *)
void SetEnabled(int enabling) override
Enable/disable widget.
static void TranslateAction(vtkAbstractWidget *)
static void ScaleAction(vtkAbstractWidget *)
~vtkHandleWidget() override
vtkTypeBool EnableAxisConstraint
static void SelectAction3D(vtkAbstractWidget *)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
static void EndSelectAction(vtkAbstractWidget *)
vtkTypeBool EnableTranslation
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)