ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Slider.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <functional>
11 
13 
14 namespace cloudViewer {
15 namespace visualization {
16 namespace gui {
17 
18 class Slider : public Widget {
19 public:
20  enum Type { INT, DOUBLE };
23  explicit Slider(Type type);
24  ~Slider();
25 
27  int GetIntValue() const;
29  double GetDoubleValue() const;
32  void SetValue(double val);
33 
34  double GetMinimumValue() const;
35  double GetMaximumValue() const;
38  void SetLimits(double min_value, double max_value);
39 
41  const Constraints& constraints) const override;
42 
43  DrawResult Draw(const DrawContext& context) override;
44 
46  void SetOnValueChanged(std::function<void(double)> on_value_changed);
47 
48 private:
49  struct Impl;
50  std::unique_ptr<Impl> impl_;
51 };
52 
53 } // namespace gui
54 } // namespace visualization
55 } // namespace cloudViewer
char type
DrawResult Draw(const DrawContext &context) override
Definition: Slider.cpp:82
Size CalcPreferredSize(const LayoutContext &theme, const Constraints &constraints) const override
Definition: Slider.cpp:74
int GetIntValue() const
Returns the value of the control as an integer.
Definition: Slider.cpp:44
void SetLimits(double min_value, double max_value)
Definition: Slider.cpp:60
double GetDoubleValue() const
Returns the value of the control as a double.
Definition: Slider.cpp:46
void SetOnValueChanged(std::function< void(double)> on_value_changed)
Sets a function to call when the value changes because of user action.
Definition: Slider.cpp:70
ImGuiContext * context
Definition: Window.cpp:76
const Theme * theme
Definition: Window.cpp:74
Generic file read and write utility for python interface.