Button.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rtc/gui/elements.h>
8 
9 namespace mc_rtc::gui
10 {
11 
12 namespace details
13 {
14 
22 template<typename Callback>
23 struct ButtonImpl : public VoidCallbackElement<Element, Callback>
24 {
25  static constexpr auto type = Elements::Button;
26 
27  template<typename... Args>
28  ButtonImpl(const std::string & name, Callback cb, Args &&... args)
29  : VoidCallbackElement<Element, Callback>(name, cb, std::forward<Args>(args)...)
30  {
31  }
32 
35 };
36 
37 } // namespace details
38 
40 template<typename Callback>
41 auto Button(const std::string & name, Callback cb)
42 {
43  return details::ButtonImpl(name, cb);
44 }
45 
46 } // namespace mc_rtc::gui
mc_rtc::gui::Element
Definition: elements.h:58
mc_rtc::gui::details::ButtonImpl::ButtonImpl
ButtonImpl()
Definition: Button.h:34
mc_rtc::gui::details::ButtonImpl::type
static constexpr auto type
Definition: Button.h:25
mc_rtc::gui::details::ButtonImpl
Definition: Button.h:23
mc_rtc::gui::Elements::Button
@ Button
mc_rtc::gui::details::ButtonImpl::ButtonImpl
ButtonImpl(const std::string &name, Callback cb, Args &&... args)
Definition: Button.h:28
elements.h
std
Definition: Contact.h:66
mc_rtc::gui::VoidCallbackElement
Definition: elements.h:183
mc_rtc::gui::Button
auto Button(const std::string &name, Callback cb)
Definition: Button.h:41
mc_rtc::gui
Definition: Observer.h:15
mc_rtc::gui::Element::name
const std::string & name() const
Definition: elements.h:61