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
68
69#ifndef vtkAbstractWidget_h
70#define vtkAbstractWidget_h
71
72#include "vtkInteractionWidgetsModule.h" // For export macro
74#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
75
76VTK_ABI_NAMESPACE_BEGIN
80
81class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALMANUAL vtkAbstractWidget
83{
84public:
86
90 void PrintSelf(ostream& os, vtkIndent indent) override;
92
100 void SetEnabled(int) override;
101
103
109 vtkSetClampMacro(ProcessEvents, vtkTypeBool, 0, 1);
111 {
112 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returning ProcessEvents of "
113 << this->ProcessEvents);
114 return this->ProcessEvents;
115 }
116 vtkBooleanMacro(ProcessEvents, vtkTypeBool);
118
124
131 virtual void CreateDefaultRepresentation() = 0;
132
139 void Render();
140
147 void SetParent(vtkAbstractWidget* parent) { this->Parent = parent; }
148 vtkGetObjectMacro(Parent, vtkAbstractWidget);
149
151
162
163
165
174 vtkBooleanMacro(ManagesCursor, vtkTypeBool);
176
182 void SetPriority(float) override;
183
184protected:
187
188 // Handles the events; centralized here for all widgets.
190 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
191
192 // The representation for the widget. This is typically called by the
193 // SetRepresentation() methods particular to each widget (i.e. subclasses
194 // of this class). This method does the actual work; the SetRepresentation()
195 // methods constrain the type that can be set.
198
199 // helper methods for cursor management
201 virtual void SetCursor(int vtkNotUsed(state)) {}
202
203 // For translating and invoking events
206
207 // The parent, if any, for this widget
209
210 // Call data which can be retrieved by the widget. This data is set
211 // by ProcessEvents() if call data is provided during a callback
212 // sequence.
213 void* CallData;
214
215 // Flag indicating if the widget should handle interaction events.
216 // On by default.
218
219 // Used by subclasses to ensure different events comes from the same
220 // hardware device. Such as starting a move with the right controller
221 // should then only respond to move events from the right controller.
223
224private:
225 vtkAbstractWidget(const vtkAbstractWidget&) = delete;
226 void operator=(const vtkAbstractWidget&) = delete;
227};
228
229VTK_ABI_NAMESPACE_END
230#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:108
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