ToggleSwitch.hpp

Wraps Bootstrap’s toggle switch.

This file is part of Empirical, https://github.com/devosoft/Empirical Copyright (C) 2021 Michigan State University MIT Software license; see doc/LICENSE.md

Defines

INCLUDE_EMP_PREFAB_TOGGLE_SWITCH_HPP_GUARD
class ToggleSwitch : public Element
#include <ToggleSwitch.hpp>

Public Functions

inline ToggleSwitch(const std::function<void(std::string)> &cb, const std::string &label, const bool is_checked = false, const std::string &t_switch_id = "")
Parameters:
  • cb – callback function passed onto input constructor

  • label – text for switch label

  • is_checked – is the switched defaulted to on?

  • t_switch_id – the id to assign the html object for this switch

template<typename T>
inline void AddLabel(const T usr_label)

Add label to switch after constructor.

Private Members

Element label_element = {to_string("label")}