VTK  9.0.1
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 =========================================================================*/
64 #ifndef vtkHandleWidget_h
65 #define vtkHandleWidget_h
66 
67 #include "vtkAbstractWidget.h"
68 #include "vtkInteractionWidgetsModule.h" // For export macro
69 
71 
72 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
73 {
74 public:
78  static vtkHandleWidget* New();
79 
81 
85  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
94  {
95  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
96  }
97 
102  {
103  return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);
104  }
105 
110  void CreateDefaultRepresentation() override;
111 
113 
118  vtkSetMacro(EnableAxisConstraint, vtkTypeBool);
119  vtkGetMacro(EnableAxisConstraint, vtkTypeBool);
120  vtkBooleanMacro(EnableAxisConstraint, vtkTypeBool);
122 
124 
127  vtkSetMacro(EnableTranslation, vtkTypeBool);
128  vtkGetMacro(EnableTranslation, vtkTypeBool);
129  vtkBooleanMacro(EnableTranslation, vtkTypeBool);
131 
133 
137  vtkSetMacro(AllowHandleResize, vtkTypeBool);
138  vtkGetMacro(AllowHandleResize, vtkTypeBool);
139  vtkBooleanMacro(AllowHandleResize, vtkTypeBool);
141 
143 
146  vtkGetMacro(WidgetState, int);
148 
150 
155  vtkSetMacro(ShowInactive, vtkTypeBool);
156  vtkGetMacro(ShowInactive, vtkTypeBool);
157  vtkBooleanMacro(ShowInactive, vtkTypeBool);
159 
160  // Manage the state of the widget
162  {
163  Start = 0,
165  Inactive
166  };
167 
172  void SetEnabled(int enabling) override;
173 
174 protected:
175  vtkHandleWidget();
176  ~vtkHandleWidget() override;
177 
178  // These are the callbacks for this widget
179  static void GenericAction(vtkHandleWidget*);
180  static void SelectAction(vtkAbstractWidget*);
181  static void EndSelectAction(vtkAbstractWidget*);
182  static void TranslateAction(vtkAbstractWidget*);
183  static void ScaleAction(vtkAbstractWidget*);
184  static void MoveAction(vtkAbstractWidget*);
185  static void SelectAction3D(vtkAbstractWidget*);
186  static void MoveAction3D(vtkAbstractWidget*);
187  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
188 
189  // helper methods for cursor management
190  void SetCursor(int state) override;
191 
195 
196  // Allow resizing of handles.
198 
199  // Keep representation visible when disabled
201 
203 
204 private:
205  vtkHandleWidget(const vtkHandleWidget&) = delete;
206  void operator=(const vtkHandleWidget&) = delete;
207 };
208 
209 #endif
vtkTypeBool AllowHandleResize
virtual void SetCursor(int vtkNotUsed(state))
abstract base class for most VTK objects
Definition: vtkObject.h:53
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:69
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:33
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...