VTK  9.5.2
vtkAbstractWidget.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
39
40#ifndef vtkAbstractWidget_h
41#define vtkAbstractWidget_h
42
43#include "vtkInteractionWidgetsModule.h" // For export macro
45#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
46
47VTK_ABI_NAMESPACE_BEGIN
51
52class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALMANUAL vtkAbstractWidget
54{
55public:
57
61 void PrintSelf(ostream& os, vtkIndent indent) override;
63
71 void SetEnabled(int) override;
72
74
80 vtkSetClampMacro(ProcessEvents, vtkTypeBool, 0, 1);
82 {
83 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning ProcessEvents of "
84 << this->ProcessEvents);
85 return this->ProcessEvents;
86 }
87 vtkBooleanMacro(ProcessEvents, vtkTypeBool);
89
95
102 virtual void CreateDefaultRepresentation() = 0;
103
110 void Render();
111
118 void SetParent(vtkAbstractWidget* parent) { this->Parent = parent; }
119 vtkGetObjectMacro(Parent, vtkAbstractWidget);
120
122
133
134
136
145 vtkBooleanMacro(ManagesCursor, vtkTypeBool);
147
153 void SetPriority(float) override;
154
155protected:
158
159 // Handles the events; centralized here for all widgets.
161 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
162
163 // The representation for the widget. This is typically called by the
164 // SetRepresentation() methods particular to each widget (i.e. subclasses
165 // of this class). This method does the actual work; the SetRepresentation()
166 // methods constrain the type that can be set.
169
170 // helper methods for cursor management
172 virtual void SetCursor(int vtkNotUsed(state)) {}
173
174 // For translating and invoking events
177
178 // The parent, if any, for this widget
180
181 // Call data which can be retrieved by the widget. This data is set
182 // by ProcessEvents() if call data is provided during a callback
183 // sequence.
184 void* CallData;
185
186 // Flag indicating if the widget should handle interaction events.
187 // On by default.
189
190 // Used by subclasses to ensure different events comes from the same
191 // hardware device. Such as starting a move with the right controller
192 // should then only respond to move events from the right controller.
194
195private:
196 vtkAbstractWidget(const vtkAbstractWidget&) = delete;
197 void operator=(const vtkAbstractWidget&) = delete;
198};
199
200VTK_ABI_NAMESPACE_END
201#endif
void SetParent(vtkAbstractWidget *parent)
Specifying a parent to this widget is used when creating composite widgets.
vtkWidgetRepresentation * GetRepresentation()
Return an instance of vtkWidgetRepresentation used to represent this widget in the scene.
void SetPriority(float) override
Override the superclass method.
virtual vtkTypeBool GetProcessEvents()
Methods to change whether the widget responds to interaction.
vtkWidgetEventTranslator * EventTranslator
void SetWidgetRepresentation(vtkWidgetRepresentation *r)
vtkWidgetRepresentation * WidgetRep
~vtkAbstractWidget() override
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
void Render()
This method is called by subclasses when a render method is to be invoked on the vtkRenderWindowInter...
vtkWidgetCallbackMapper * CallbackMapper
vtkWidgetEventTranslator * GetEventTranslator()
Get the event translator.
static void ProcessEventsHandler(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkAbstractWidget * Parent
virtual void SetCursor(int vtkNotUsed(state))
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
void SetEnabled(int) override
Methods for activating this widget.
a simple class to control print indentation
Definition vtkIndent.h:29
const char * GetClassName() const
Return the class name as a string.
map widget events into callbacks
map VTK events into widget events
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHALMANUAL