VTK: Interaction/Widgets/vtkSliderWidget.h Source File

| VTK 9.3.1

vtkSliderWidget.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
69 #ifndef vtkSliderWidget_h
70 #define vtkSliderWidget_h
71
72 #include "vtkAbstractWidget.h"
73 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
74 #include "vtkInteractionWidgetsModule.h" // For export macro
75 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
76
77 VTK_ABI_NAMESPACE_BEGIN
78 class vtkSliderRepresentation;
79
80 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderWidget : public vtkAbstractWidget
81 {
82 public:
86 static vtkSliderWidget* New();
87
89
92 vtkTypeMacro(vtkSliderWidget, vtkAbstractWidget);
93 void PrintSelf(ostream& os, vtkIndent indent) override;
95
101 void SetRepresentation(vtkSliderRepresentation* r)
102 {
103 this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
104 }
105
109 vtkSliderRepresentation* GetSliderRepresentation()
110 {
111 return reinterpret_cast<vtkSliderRepresentation*>(this->WidgetRep);
112 }
113
115
122 vtkSetClampMacro(AnimationMode, int, AnimateOff, Animate);
123 vtkGetMacro(AnimationMode, int);
124 void SetAnimationModeToOff() { this->SetAnimationMode(AnimateOff); }
125 void SetAnimationModeToJump() { this->SetAnimationMode(Jump); }
126 void SetAnimationModeToAnimate() { this->SetAnimationMode(Animate); }
128
130
134 vtkSetClampMacro(NumberOfAnimationSteps, int, 1, VTK_INT_MAX);
135 vtkGetMacro(NumberOfAnimationSteps, int);
137
141 void CreateDefaultRepresentation() override;
142
143 protected:
144 vtkSliderWidget();
145 ~vtkSliderWidget() override = default;
146
147 // These are the events that are handled
148 static void SelectAction(vtkAbstractWidget*);
149 static void EndSelectAction(vtkAbstractWidget*);
150 static void MoveAction(vtkAbstractWidget*);
151 void AnimateSlider(int selectionState);
152
153 // Manage the state of the widget
154 int WidgetState;
155 enum WidgetStateType
156 {
157 Start = 0,
158 Sliding,
159 Animating
160 };
161 #if !defined(VTK_LEGACY_REMOVE)
162 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
163 typedef WidgetStateType _WidgetState;
164 #endif
165
166 int NumberOfAnimationSteps;
167 int AnimationMode;
168 enum AnimationState
169 {
170 AnimateOff,
171 Jump,
172 Animate
173 };
174
175 private:
176 vtkSliderWidget(const vtkSliderWidget&) = delete;
177 void operator=(const vtkSliderWidget&) = delete;
178 };
179
180 VTK_ABI_NAMESPACE_END
181 #endif
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkAbstractWidget::WidgetRep
vtkWidgetRepresentation * WidgetRep
Definition: vtkAbstractWidget.h:178
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkSliderRepresentation
abstract class defines the representation for a vtkSliderWidget
Definition: vtkSliderRepresentation.h:42
vtkSliderWidget
set a value by manipulating a slider
Definition: vtkSliderWidget.h:81
vtkSliderWidget::GetSliderRepresentation
vtkSliderRepresentation * GetSliderRepresentation()
Return the representation as a vtkSliderRepresentation.
Definition: vtkSliderWidget.h:109
vtkSliderWidget::CreateDefaultRepresentation
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
vtkSliderWidget::WidgetState
int WidgetState
Definition: vtkSliderWidget.h:154
vtkSliderWidget::AnimationState
AnimationState
Definition: vtkSliderWidget.h:169
vtkSliderWidget::Jump
@ Jump
Definition: vtkSliderWidget.h:171
vtkSliderWidget::AnimateOff
@ AnimateOff
Definition: vtkSliderWidget.h:170
vtkSliderWidget::SetAnimationModeToOff
void SetAnimationModeToOff()
Control the behavior of the slider when selecting the tube or caps.
Definition: vtkSliderWidget.h:124
vtkSliderWidget::SetAnimationModeToJump
void SetAnimationModeToJump()
Control the behavior of the slider when selecting the tube or caps.
Definition: vtkSliderWidget.h:125
vtkSliderWidget::AnimateSlider
void AnimateSlider(int selectionState)
vtkSliderWidget::NumberOfAnimationSteps
int NumberOfAnimationSteps
Definition: vtkSliderWidget.h:166
vtkSliderWidget::SetAnimationModeToAnimate
void SetAnimationModeToAnimate()
Control the behavior of the slider when selecting the tube or caps.
Definition: vtkSliderWidget.h:126
vtkSliderWidget::New
static vtkSliderWidget * New()
Instantiate the class.
vtkSliderWidget::~vtkSliderWidget
~vtkSliderWidget() override=default
vtkSliderWidget::vtkSliderWidget
vtkSliderWidget()
vtkSliderWidget::SelectAction
static void SelectAction(vtkAbstractWidget *)
vtkSliderWidget::EndSelectAction
static void EndSelectAction(vtkAbstractWidget *)
vtkSliderWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros.
vtkSliderWidget::WidgetStateType
WidgetStateType
Definition: vtkSliderWidget.h:156
vtkSliderWidget::Sliding
@ Sliding
Definition: vtkSliderWidget.h:158
vtkSliderWidget::AnimationMode
int AnimationMode
Definition: vtkSliderWidget.h:167
vtkSliderWidget::SetRepresentation
void SetRepresentation(vtkSliderRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkSliderWidget.h:101
vtkSliderWidget::MoveAction
static void MoveAction(vtkAbstractWidget *)
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
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:144