VTK  9.0.20201030
vtkSliderWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSliderWidget.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
75 #ifndef vtkSliderWidget_h
76 #define vtkSliderWidget_h
77 
78 #include "vtkAbstractWidget.h"
79 #include "vtkInteractionWidgetsModule.h" // For export macro
80 
82 
83 class VTKINTERACTIONWIDGETS_EXPORT vtkSliderWidget : public vtkAbstractWidget
84 {
85 public:
89  static vtkSliderWidget* New();
90 
92 
96  void PrintSelf(ostream& os, vtkIndent indent) override;
98 
105  {
106  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
107  }
108 
113  {
114  return reinterpret_cast<vtkSliderRepresentation*>(this->WidgetRep);
115  }
116 
118 
125  vtkSetClampMacro(AnimationMode, int, AnimateOff, Animate);
126  vtkGetMacro(AnimationMode, int);
127  void SetAnimationModeToOff() { this->SetAnimationMode(AnimateOff); }
128  void SetAnimationModeToJump() { this->SetAnimationMode(Jump); }
129  void SetAnimationModeToAnimate() { this->SetAnimationMode(Animate); }
131 
133 
137  vtkSetClampMacro(NumberOfAnimationSteps, int, 1, VTK_INT_MAX);
138  vtkGetMacro(NumberOfAnimationSteps, int);
140 
144  void CreateDefaultRepresentation() override;
145 
146 protected:
147  vtkSliderWidget();
148  ~vtkSliderWidget() override = default;
149 
150  // These are the events that are handled
151  static void SelectAction(vtkAbstractWidget*);
152  static void EndSelectAction(vtkAbstractWidget*);
153  static void MoveAction(vtkAbstractWidget*);
154  void AnimateSlider(int selectionState);
155 
156  // Manage the state of the widget
159  {
160  Start = 0,
162  Animating
163  };
164 
168  {
171  Animate
172  };
173 
174 private:
175  vtkSliderWidget(const vtkSliderWidget&) = delete;
176  void operator=(const vtkSliderWidget&) = delete;
177 };
178 
179 #endif
vtkSliderWidget::SetAnimationModeToOff
void SetAnimationModeToOff()
Definition: vtkSliderWidget.h:127
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:147
vtkSliderWidget::Sliding
Definition: vtkSliderWidget.h:161
vtkSliderWidget::AnimationMode
int AnimationMode
Definition: vtkSliderWidget.h:166
vtkAbstractWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSliderWidget::SetRepresentation
void SetRepresentation(vtkSliderRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
Definition: vtkSliderWidget.h:104
vtkAbstractWidget.h
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:65
vtkAbstractWidget::CreateDefaultRepresentation
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
vtkSliderWidget::Jump
Definition: vtkSliderWidget.h:170
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSliderWidget::SetAnimationModeToJump
void SetAnimationModeToJump()
Definition: vtkSliderWidget.h:128
vtkSliderWidget::SetAnimationModeToAnimate
void SetAnimationModeToAnimate()
Definition: vtkSliderWidget.h:129
vtkSliderWidget::AnimationState
AnimationState
Definition: vtkSliderWidget.h:167
vtkSliderWidget
set a value by manipulating a slider
Definition: vtkSliderWidget.h:83
vtkSliderWidget::AnimateOff
Definition: vtkSliderWidget.h:169
vtkSliderWidget::WidgetState
int WidgetState
Definition: vtkSliderWidget.h:157
vtkSliderWidget::NumberOfAnimationSteps
int NumberOfAnimationSteps
Definition: vtkSliderWidget.h:165
vtkSliderWidget::_WidgetState
_WidgetState
Definition: vtkSliderWidget.h:158
vtkSliderWidget::GetSliderRepresentation
vtkSliderRepresentation * GetSliderRepresentation()
Return the representation as a vtkSliderRepresentation.
Definition: vtkSliderWidget.h:112
vtkSliderRepresentation
abstract class defines the representation for a vtkSliderWidget
Definition: vtkSliderRepresentation.h:44