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 =========================================================================*/
70 #ifndef vtkHandleWidget_h
71 #define vtkHandleWidget_h
72 
73 #include "vtkAbstractWidget.h"
74 #include "vtkInteractionWidgetsModule.h" // For export macro
75 
77 
78 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
79 {
80 public:
84  static vtkHandleWidget* New();
85 
87 
91  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
100  {
101  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
102  }
103 
108  {
109  return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);
110  }
111 
117 
119 
124  vtkSetMacro(EnableAxisConstraint, vtkTypeBool);
125  vtkGetMacro(EnableAxisConstraint, vtkTypeBool);
126  vtkBooleanMacro(EnableAxisConstraint, vtkTypeBool);
128 
130 
133  vtkSetMacro(EnableTranslation, vtkTypeBool);
134  vtkGetMacro(EnableTranslation, vtkTypeBool);
135  vtkBooleanMacro(EnableTranslation, vtkTypeBool);
137 
139 
143  vtkSetMacro(AllowHandleResize, vtkTypeBool);
144  vtkGetMacro(AllowHandleResize, vtkTypeBool);
145  vtkBooleanMacro(AllowHandleResize, vtkTypeBool);
147 
149 
152  vtkGetMacro(WidgetState, int);
154 
156 
161  vtkSetMacro(ShowInactive, vtkTypeBool);
162  vtkGetMacro(ShowInactive, vtkTypeBool);
163  vtkBooleanMacro(ShowInactive, vtkTypeBool);
165 
166  // Manage the state of the widget
168  {
169  Start = 0,
171  Inactive
172  };
173 
178  void SetEnabled(int enabling) override;
179 
180 protected:
182  ~vtkHandleWidget() override;
183 
184  // These are the callbacks for this widget
193  static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
194 
195  // helper methods for cursor management
196  void SetCursor(int state) override;
197 
201 
202  // Allow resizing of handles.
204 
205  // Keep representation visible when disabled
207 
209 
210 private:
211  vtkHandleWidget(const vtkHandleWidget&) = delete;
212  void operator=(const vtkHandleWidget&) = delete;
213 };
214 
215 #endif
define the API for widget / widget representation
vtkWidgetRepresentation * WidgetRep
supports function callbacks
abstract class for representing widget handles
a general widget for moving handles
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
static vtkHandleWidget * New()
Instantiate this class.
static void SelectAction(vtkAbstractWidget *)
static void ProcessKeyEvents(vtkObject *, unsigned long, void *, void *)
vtkCallbackCommand * KeyEventCallbackCommand
vtkTypeBool ShowInactive
void SetRepresentation(vtkHandleRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
static void GenericAction(vtkHandleWidget *)
static void MoveAction3D(vtkAbstractWidget *)
vtkTypeBool AllowHandleResize
void SetCursor(int state) override
static void MoveAction(vtkAbstractWidget *)
void SetEnabled(int enabling) override
Enable/disable widget.
static void TranslateAction(vtkAbstractWidget *)
static void ScaleAction(vtkAbstractWidget *)
~vtkHandleWidget() override
vtkTypeBool EnableAxisConstraint
static void SelectAction3D(vtkAbstractWidget *)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
static void EndSelectAction(vtkAbstractWidget *)
vtkTypeBool EnableTranslation
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:69