VTK  9.4.20251007
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
42
43#ifndef vtkAbstractWidget_h
44#define vtkAbstractWidget_h
45
46#include "vtkInteractionWidgetsModule.h" // For export macro
48#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
49
50VTK_ABI_NAMESPACE_BEGIN
54
55class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALMANUAL vtkAbstractWidget
57{
58public:
60
64 void PrintSelf(ostream& os, vtkIndent indent) override;
66
74 void SetEnabled(int) override;
75
77
83 vtkSetClampMacro(ProcessEvents, vtkTypeBool, 0, 1);
85 {
86 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning ProcessEvents of "
87 << this->ProcessEvents);
88 return this->ProcessEvents;
89 }
90 vtkBooleanMacro(ProcessEvents, vtkTypeBool);
92
98
105 virtual void CreateDefaultRepresentation() = 0;
106
113 void Render();
114
121 void SetParent(vtkAbstractWidget* parent) { this->Parent = parent; }
122 vtkGetObjectMacro(Parent, vtkAbstractWidget);
123
125
136
137
139
148 vtkBooleanMacro(ManagesCursor, vtkTypeBool);
150
156 void SetPriority(float) override;
157
158protected:
161
162 // Handles the events; centralized here for all widgets.
164 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
165
166 // The representation for the widget. This is typically called by the
167 // SetRepresentation() methods particular to each widget (i.e. subclasses
168 // of this class). This method does the actual work; the SetRepresentation()
169 // methods constrain the type that can be set.
172
173 // helper methods for cursor management
175 virtual void SetCursor(int vtkNotUsed(state)) {}
176
177 // For translating and invoking events
180
181 // The parent, if any, for this widget
183
184 // Call data which can be retrieved by the widget. This data is set
185 // by ProcessEvents() if call data is provided during a callback
186 // sequence.
187 void* CallData;
188
189 // Flag indicating if the widget should handle interaction events.
190 // On by default.
192
193 // Used by subclasses to ensure different events comes from the same
194 // hardware device. Such as starting a move with the right controller
195 // should then only respond to move events from the right controller.
197
198private:
199 vtkAbstractWidget(const vtkAbstractWidget&) = delete;
200 void operator=(const vtkAbstractWidget&) = delete;
201};
202
203VTK_ABI_NAMESPACE_END
204#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