FloatWidgets.h
Go to the documentation of this file.
1#pragma once
2
3#include "Basic.h"
4
6{
7 template <typename Derived>
8 struct FloatMinMaxMixin : MinMaxMixin<Derived, float>
9 {
10 Derived&
12 {
13 Derived& this_ = *static_cast<Derived*>(this);
14 this_.widget().steps = steps;
15 return this_;
16 }
17
18 Derived&
19 steps(std::array<int, 1> v)
20 {
21 return steps(v.at(0));
22 }
23 };
24
26 public ValueMixin<FloatSpinBox, float, FloatSpinBoxBuilder>,
27 public FloatMinMaxMixin<FloatSpinBoxBuilder>,
28 public ToolTipMixin<FloatSpinBoxBuilder>
29 {
30 using ValueMixin::ValueMixin;
31
34 {
35 widget().decimals = decimals;
36 return *this;
37 }
38
40 decimals(std::array<int, 1> d)
41 {
42 return decimals(d.at(0));
43 }
44 };
45
47 public ValueMixin<FloatSlider, float, FloatSliderBuilder>,
48 public FloatMinMaxMixin<FloatSliderBuilder>,
49 public ToolTipMixin<FloatSliderBuilder>
50 {
51 using ValueMixin::ValueMixin;
52 };
53} // namespace armarx::RemoteGui::detail
54
55namespace armarx::RemoteGui
56{
58 makeFloatSpinBox(std::string const& name)
59 {
60 return detail::FloatSpinBoxBuilder(name);
61 }
62
63 inline detail::FloatSliderBuilder
64 makeFloatSlider(std::string const& name)
65 {
66 return detail::FloatSliderBuilder(name);
67 }
68} // namespace armarx::RemoteGui
detail::FloatSliderBuilder makeFloatSlider(std::string const &name)
detail::FloatSpinBoxBuilder makeFloatSpinBox(std::string const &name)
Derived & steps(std::array< int, 1 > v)
FloatSpinBoxBuilder & decimals(std::array< int, 1 > d)
FloatSpinBoxBuilder & decimals(int decimals)