VTK  9.2.6
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 =========================================================================*/
70 #ifndef vtkHandleWidget_h
71 #define vtkHandleWidget_h
72 
73 #include "vtkAbstractWidget.h"
74 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
75 #include "vtkInteractionWidgetsModule.h" // For export macro
76 
78 
79 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
80 {
81 public:
85  static vtkHandleWidget* New();
86 
88 
92  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
101  {
102  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
103  }
104 
109  {
110  return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);
111  }
112 
117  void CreateDefaultRepresentation() override;
118 
120 
125  vtkSetMacro(EnableAxisConstraint, vtkTypeBool);
126  vtkGetMacro(EnableAxisConstraint, vtkTypeBool);
127  vtkBooleanMacro(EnableAxisConstraint, vtkTypeBool);
129 
131 
134  vtkSetMacro(EnableTranslation, vtkTypeBool);
135  vtkGetMacro(EnableTranslation, vtkTypeBool);
136  vtkBooleanMacro(EnableTranslation, vtkTypeBool);
138 
140 
144  vtkSetMacro(AllowHandleResize, vtkTypeBool);
145  vtkGetMacro(AllowHandleResize, vtkTypeBool);
146  vtkBooleanMacro(AllowHandleResize, vtkTypeBool);
148 
150 
153  vtkGetMacro(WidgetState, int);
155 
157 
162  vtkSetMacro(ShowInactive, vtkTypeBool);
163  vtkGetMacro(ShowInactive, vtkTypeBool);
164  vtkBooleanMacro(ShowInactive, vtkTypeBool);
166 
167  // Manage the state of the widget
169  {
170  Start = 0,
172  Inactive
173  };
174 #if !defined(VTK_LEGACY_REMOVE)
175  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
177 #endif
178 
183  void SetEnabled(int enabling) override;
184 
185 protected:
186  vtkHandleWidget();
187  ~vtkHandleWidget() override;
188 
189  // These are the callbacks for this widget
190  static void GenericAction(vtkHandleWidget*);
191  static void SelectAction(vtkAbstractWidget*);
192  static void EndSelectAction(vtkAbstractWidget*);
193  static void TranslateAction(vtkAbstractWidget*);
194  static void ScaleAction(vtkAbstractWidget*);
195  static void MoveAction(vtkAbstractWidget*);
196  static void SelectAction3D(vtkAbstractWidget*);
197  static void MoveAction3D(vtkAbstractWidget*);
198  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
199 
200  // helper methods for cursor management
201  void SetCursor(int state) override;
202 
206 
207  // Allow resizing of handles.
209 
210  // Keep representation visible when disabled
212 
214 
215 private:
216  vtkHandleWidget(const vtkHandleWidget&) = delete;
217  void operator=(const vtkHandleWidget&) = delete;
218 };
219 
220 #endif
vtkTypeBool AllowHandleResize
virtual void SetCursor(int vtkNotUsed(state))
abstract base class for most VTK objects
Definition: vtkObject.h:62
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:69
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:39
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...