VTK  9.7.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 "vtkInteractionWidgetsModule.h" // For export macro
63 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
64 
65 VTK_ABI_NAMESPACE_BEGIN
67 
68 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkHandleWidget : public vtkAbstractWidget
69 {
70 public:
74  static vtkHandleWidget* New();
75 
77 
81  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
90  {
91  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
92  }
93 
98  {
99  return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);
100  }
101 
106  void CreateDefaultRepresentation() override;
107 
109 
114  vtkSetMacro(EnableAxisConstraint, vtkTypeBool);
115  vtkGetMacro(EnableAxisConstraint, vtkTypeBool);
116  vtkBooleanMacro(EnableAxisConstraint, vtkTypeBool);
118 
120 
123  vtkSetMacro(EnableTranslation, vtkTypeBool);
124  vtkGetMacro(EnableTranslation, vtkTypeBool);
125  vtkBooleanMacro(EnableTranslation, vtkTypeBool);
127 
129 
133  vtkSetMacro(AllowHandleResize, vtkTypeBool);
134  vtkGetMacro(AllowHandleResize, vtkTypeBool);
135  vtkBooleanMacro(AllowHandleResize, vtkTypeBool);
137 
139 
142  vtkGetMacro(WidgetState, int);
144 
146 
151  vtkSetMacro(ShowInactive, vtkTypeBool);
152  vtkGetMacro(ShowInactive, vtkTypeBool);
153  vtkBooleanMacro(ShowInactive, vtkTypeBool);
155 
156  // Manage the state of the widget
158  {
159  Start = 0,
161  Inactive
162  };
163 
168  void SetEnabled(int enabling) override;
169 
170 protected:
171  vtkHandleWidget();
172  ~vtkHandleWidget() override;
173 
174  // These are the callbacks for this widget
175  static void GenericAction(vtkHandleWidget*);
176  static void SelectAction(vtkAbstractWidget*);
177  static void EndSelectAction(vtkAbstractWidget*);
178  static void TranslateAction(vtkAbstractWidget*);
179  static void ScaleAction(vtkAbstractWidget*);
180  static void MoveAction(vtkAbstractWidget*);
181  static void SelectAction3D(vtkAbstractWidget*);
182  static void MoveAction3D(vtkAbstractWidget*);
183  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
184 
185  // helper methods for cursor management
186  void SetCursor(int state) override;
187 
191 
192  // Allow resizing of handles.
194 
195  // Keep representation visible when disabled
197 
199 
200 private:
201  vtkHandleWidget(const vtkHandleWidget&) = delete;
202  void operator=(const vtkHandleWidget&) = delete;
203 };
204 
205 VTK_ABI_NAMESPACE_END
206 #endif
vtkTypeBool AllowHandleResize
abstract base class for most VTK objects
Definition: vtkObject.h:52
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: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.
#define VTK_MARSHALAUTO
vtkTypeBool EnableAxisConstraint
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void SetCursor(int state)