ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
NumberEdit.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 NumberEdit : public Widget {
19  using Super = Widget;
20 
21 public:
22  enum Type { INT, DOUBLE };
23  explicit NumberEdit(Type type);
24  ~NumberEdit();
25 
26  int GetIntValue() const;
27  double GetDoubleValue() const;
28  void SetValue(double val);
29 
30  double GetMinimumValue() const;
31  double GetMaximumValue() const;
32  void SetLimits(double min_value, double max_value);
33 
34  int GetDecimalPrecision();
35  void SetDecimalPrecision(int num_digits);
36 
37  void SetPreferredWidth(int width);
38 
39  void SetOnValueChanged(std::function<void(double)> on_changed);
40 
42  const Constraints& constraints) const override;
43  Widget::DrawResult Draw(const DrawContext& context) override;
44 
45 private:
46  struct Impl;
47  std::unique_ptr<Impl> impl_;
48 };
49 
50 } // namespace gui
51 } // namespace visualization
52 } // namespace cloudViewer
int width
char type
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: NumberEdit.cpp:90
void SetLimits(double min_value, double max_value)
Definition: NumberEdit.cpp:65
Widget::DrawResult Draw(const DrawContext &context) override
Definition: NumberEdit.cpp:117
void SetOnValueChanged(std::function< void(double)> on_changed)
Definition: NumberEdit.cpp:86
ImGuiContext * context
Definition: Window.cpp:76
Generic file read and write utility for python interface.