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 
116  void CreateDefaultRepresentation() override;
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:
181  vtkHandleWidget();
182  ~vtkHandleWidget() override;
183 
184  // These are the callbacks for this widget
185  static void GenericAction(vtkHandleWidget*);
186  static void SelectAction(vtkAbstractWidget*);
187  static void EndSelectAction(vtkAbstractWidget*);
188  static void TranslateAction(vtkAbstractWidget*);
189  static void ScaleAction(vtkAbstractWidget*);
190  static void MoveAction(vtkAbstractWidget*);
191  static void SelectAction3D(vtkAbstractWidget*);
192  static void MoveAction3D(vtkAbstractWidget*);
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
vtkHandleWidget::WidgetState
int WidgetState
Definition: vtkHandleWidget.h:198
vtkAbstractWidget::SetCursor
virtual void SetCursor(int vtkNotUsed(state))
Definition: vtkAbstractWidget.h:179
vtkHandleWidget::_WidgetState
_WidgetState
Definition: vtkHandleWidget.h:167
vtkHandleWidget
a general widget for moving handles
Definition: vtkHandleWidget.h:78
vtkAbstractWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractWidget.h
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:59
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkAbstractWidget::WidgetRep
vtkWidgetRepresentation * WidgetRep
Definition: vtkAbstractWidget.h:175
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkHandleWidget::EnableAxisConstraint
vtkTypeBool EnableAxisConstraint
Definition: vtkHandleWidget.h:199
vtkHandleWidget::KeyEventCallbackCommand
vtkCallbackCommand * KeyEventCallbackCommand
Definition: vtkHandleWidget.h:208
vtkHandleWidget::SetRepresentation
void SetRepresentation(vtkHandleRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkHandleWidget.h:99
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:65
vtkAbstractWidget::CreateDefaultRepresentation
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
vtkHandleWidget::AllowHandleResize
vtkTypeBool AllowHandleResize
Definition: vtkHandleWidget.h:203
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkHandleWidget::Active
@ Active
Definition: vtkHandleWidget.h:170
vtkHandleWidget::ShowInactive
vtkTypeBool ShowInactive
Definition: vtkHandleWidget.h:206
vtkAbstractWidget::SetEnabled
void SetEnabled(int) override
Methods for activating this widget.
vtkHandleWidget::GetHandleRepresentation
vtkHandleRepresentation * GetHandleRepresentation()
Return the representation as a vtkHandleRepresentation.
Definition: vtkHandleWidget.h:107
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:44
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkHandleWidget::EnableTranslation
vtkTypeBool EnableTranslation
Definition: vtkHandleWidget.h:200