VTK  9.3.1
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 
107  void CreateDefaultRepresentation() override;
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:
176  vtkHandleWidget();
177  ~vtkHandleWidget() override;
178 
179  // These are the callbacks for this widget
180  static void GenericAction(vtkHandleWidget*);
181  static void SelectAction(vtkAbstractWidget*);
182  static void EndSelectAction(vtkAbstractWidget*);
183  static void TranslateAction(vtkAbstractWidget*);
184  static void ScaleAction(vtkAbstractWidget*);
185  static void MoveAction(vtkAbstractWidget*);
186  static void SelectAction3D(vtkAbstractWidget*);
187  static void MoveAction3D(vtkAbstractWidget*);
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
vtkTypeBool AllowHandleResize
virtual void SetCursor(int vtkNotUsed(state))
abstract base class for most VTK objects
Definition: vtkObject.h:51
abstract class for representing widget handles
vtkCallbackCommand * KeyEventCallbackCommand
vtkTypeBool EnableTranslation
#define VTK_DEPRECATED_IN_9_2_0(reason)
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:64
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:28
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...