VTK: Interaction/Widgets/vtkHandleWidget.h Source File

| 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
67 class vtkHandleRepresentation;
68
69 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
70 {
71 public:
75 static vtkHandleWidget* New();
76
78
81 vtkTypeMacro(vtkHandleWidget, vtkAbstractWidget);
82 void PrintSelf(ostream& os, vtkIndent indent) override;
84
90 void SetRepresentation(vtkHandleRepresentation* r)
91 {
92 this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
93 }
94
98 vtkHandleRepresentation* GetHandleRepresentation()
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
158 enum WidgetStateType
159 {
160 Start = 0,
161 Active,
162 Inactive
163 };
164 #if !defined(VTK_LEGACY_REMOVE)
165 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
166 typedef WidgetStateType _WidgetState;
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
193 int WidgetState;
194 vtkTypeBool EnableAxisConstraint;
195 vtkTypeBool EnableTranslation;
196
197 // Allow resizing of handles.
198 vtkTypeBool AllowHandleResize;
199
200 // Keep representation visible when disabled
201 vtkTypeBool ShowInactive;
202
203 vtkCallbackCommand* KeyEventCallbackCommand;
204
205 private:
206 vtkHandleWidget(const vtkHandleWidget&) = delete;
207 void operator=(const vtkHandleWidget&) = delete;
208 };
209
210 VTK_ABI_NAMESPACE_END
211 #endif
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkAbstractWidget::WidgetRep
vtkWidgetRepresentation * WidgetRep
Definition: vtkAbstractWidget.h:178
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:49
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:50
vtkHandleWidget
a general widget for moving handles
Definition: vtkHandleWidget.h:70
vtkHandleWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK class macros.
vtkHandleWidget::GetHandleRepresentation
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
Definition: vtkHandleWidget.h:98
vtkHandleWidget::New
static vtkHandleWidget * New()
Instantiate this class.
vtkHandleWidget::vtkHandleWidget
vtkHandleWidget()
vtkHandleWidget::SelectAction
static void SelectAction(vtkAbstractWidget *)
vtkHandleWidget::ProcessKeyEvents
static void ProcessKeyEvents(vtkObject *, unsigned long, void *, void *)
vtkHandleWidget::KeyEventCallbackCommand
vtkCallbackCommand * KeyEventCallbackCommand
Definition: vtkHandleWidget.h:203
vtkHandleWidget::ShowInactive
vtkTypeBool ShowInactive
Definition: vtkHandleWidget.h:201
vtkHandleWidget::SetRepresentation
void SetRepresentation(vtkHandleRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkHandleWidget.h:90
vtkHandleWidget::GenericAction
static void GenericAction(vtkHandleWidget *)
vtkHandleWidget::MoveAction3D
static void MoveAction3D(vtkAbstractWidget *)
vtkHandleWidget::AllowHandleResize
vtkTypeBool AllowHandleResize
Definition: vtkHandleWidget.h:198
vtkHandleWidget::SetCursor
void SetCursor(int state) override
vtkHandleWidget::MoveAction
static void MoveAction(vtkAbstractWidget *)
vtkHandleWidget::SetEnabled
void SetEnabled(int enabling) override
Enable/disable widget.
vtkHandleWidget::TranslateAction
static void TranslateAction(vtkAbstractWidget *)
vtkHandleWidget::WidgetState
int WidgetState
Definition: vtkHandleWidget.h:193
vtkHandleWidget::ScaleAction
static void ScaleAction(vtkAbstractWidget *)
vtkHandleWidget::~vtkHandleWidget
~vtkHandleWidget() override
vtkHandleWidget::EnableAxisConstraint
vtkTypeBool EnableAxisConstraint
Definition: vtkHandleWidget.h:194
vtkHandleWidget::SelectAction3D
static void SelectAction3D(vtkAbstractWidget *)
vtkHandleWidget::CreateDefaultRepresentation
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
vtkHandleWidget::EndSelectAction
static void EndSelectAction(vtkAbstractWidget *)
vtkHandleWidget::WidgetStateType
WidgetStateType
Definition: vtkHandleWidget.h:159
vtkHandleWidget::Active
@ Active
Definition: vtkHandleWidget.h:161
vtkHandleWidget::EnableTranslation
vtkTypeBool EnableTranslation
Definition: vtkHandleWidget.h:195
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:65
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkAbstractWidget.h
vtkDeprecation.h
VTK_DEPRECATED_IN_9_2_0
#define VTK_DEPRECATED_IN_9_2_0(reason)
Definition: vtkDeprecation.h:108