Input.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
8 #include <mc_rtc/gui/Checkbox.h>
10 #include <mc_rtc/gui/NumberInput.h>
11 #include <mc_rtc/gui/StringInput.h>
12 
13 namespace mc_rtc::gui
14 {
15 
17 template<typename T>
18 auto Input(const std::string & name, T & value)
19 {
20  if constexpr(std::is_same_v<T, bool>) { return Checkbox(name, value); }
21  else if constexpr(std::is_same_v<T, std::string>) { return StringInput(name, value); }
22  else if constexpr(std::is_floating_point_v<T>) { return NumberInput(name, value); }
23  else if constexpr(mc_rtc::internal::is_integral_v<T>) { return IntegerInput(name, value); }
24  else { return ArrayInput(name, value); }
25 }
26 
27 } // namespace mc_rtc::gui
mc_rtc::gui::NumberInput
auto NumberInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: NumberInput.h:34
NumberInput.h
Checkbox.h
ArrayInput.h
mc_rtc::gui::StringInput
auto StringInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: StringInput.h:34
mc_rtc::gui::ArrayInput
auto ArrayInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: ArrayInput.h:59
mc_rtc::gui::Checkbox
auto Checkbox(const std::string &name, GetT get_fn, Callback cb)
Definition: Checkbox.h:43
IntegerInput.h
mc_rtc::gui::Input
auto Input(const std::string &name, T &value)
Definition: Input.h:18
mc_rtc::gui::IntegerInput
auto IntegerInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: IntegerInput.h:34
mc_rtc::gui
Definition: Observer.h:15
StringInput.h