VTK: Interaction/Widgets/vtkButtonWidget.h Source File

| VTK 9.3.1

vtkButtonWidget.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
58 #ifndef vtkButtonWidget_h
59 #define vtkButtonWidget_h
60
61 #include "vtkAbstractWidget.h"
62 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
63 #include "vtkInteractionWidgetsModule.h" // For export macro
64 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
65
66 VTK_ABI_NAMESPACE_BEGIN
67 class vtkButtonRepresentation;
68
69 class VTKINTERACTIONWIDGETS_EXPORT vtkButtonWidget : public vtkAbstractWidget
70 {
71 public:
75 static vtkButtonWidget* New();
76
78
81 vtkTypeMacro(vtkButtonWidget, vtkAbstractWidget);
82 void PrintSelf(ostream& os, vtkIndent indent) override;
84
90 void SetRepresentation(vtkButtonRepresentation* r)
91 {
92 this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
93 }
94
98 vtkButtonRepresentation* GetSliderRepresentation()
99 {
100 return reinterpret_cast<vtkButtonRepresentation*>(this->WidgetRep);
101 }
102
106 void CreateDefaultRepresentation() override;
107
115 void SetEnabled(int) override;
116
117 protected:
118 vtkButtonWidget();
119 ~vtkButtonWidget() override = default;
120
121 // These are the events that are handled
122 static void SelectAction(vtkAbstractWidget*);
123 static void MoveAction(vtkAbstractWidget*);
124 static void EndSelectAction(vtkAbstractWidget*);
125
126 // Manage the state of the widget
127 int WidgetState;
128 enum WidgetStateType
129 {
130 Start = 0,
131 Hovering,
132 Selecting
133 };
134 #if !defined(VTK_LEGACY_REMOVE)
135 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
136 typedef WidgetStateType _WidgetState;
137 #endif
138
139 private:
140 vtkButtonWidget(const vtkButtonWidget&) = delete;
141 void operator=(const vtkButtonWidget&) = delete;
142 };
143
144 VTK_ABI_NAMESPACE_END
145 #endif
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkAbstractWidget::WidgetRep
vtkWidgetRepresentation * WidgetRep
Definition: vtkAbstractWidget.h:178
vtkButtonRepresentation
abstract class defines the representation for a vtkButtonWidget
Definition: vtkButtonRepresentation.h:39
vtkButtonWidget
activate an n-state button
Definition: vtkButtonWidget.h:70
vtkButtonWidget::CreateDefaultRepresentation
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
vtkButtonWidget::~vtkButtonWidget
~vtkButtonWidget() override=default
vtkButtonWidget::vtkButtonWidget
vtkButtonWidget()
vtkButtonWidget::SelectAction
static void SelectAction(vtkAbstractWidget *)
vtkButtonWidget::WidgetState
int WidgetState
Definition: vtkButtonWidget.h:127
vtkButtonWidget::SetEnabled
void SetEnabled(int) override
The method for activating and deactivating this widget.
vtkButtonWidget::MoveAction
static void MoveAction(vtkAbstractWidget *)
vtkButtonWidget::SetRepresentation
void SetRepresentation(vtkButtonRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkButtonWidget.h:90
vtkButtonWidget::New
static vtkButtonWidget * New()
Instantiate the class.
vtkButtonWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros.
vtkButtonWidget::GetSliderRepresentation
vtkButtonRepresentation * GetSliderRepresentation()
Return the representation as a vtkButtonRepresentation.
Definition: vtkButtonWidget.h:98
vtkButtonWidget::EndSelectAction
static void EndSelectAction(vtkAbstractWidget *)
vtkButtonWidget::WidgetStateType
WidgetStateType
Definition: vtkButtonWidget.h:129
vtkButtonWidget::Hovering
@ Hovering
Definition: vtkButtonWidget.h:131
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:65
vtkAbstractWidget.h
vtkDeprecation.h
VTK_DEPRECATED_IN_9_2_0
#define VTK_DEPRECATED_IN_9_2_0(reason)
Definition: vtkDeprecation.h:108