Class Toggle#
Defined in File Toggle.h
Inheritance Relationships#
Base Type#
public Karana::WebUI::Widget(Class Widget)
Class Documentation#
-
class Toggle : public Karana::WebUI::Widget#
Widget displaying a Toggle input mirroring a boolean State.
Public Functions
-
Toggle(Router &router, std::string_view text, std::function<void(bool)> on_toggle, std::string_view tooltip = "", bool render_as_button = false, const Karana::Core::ks_ptr<State> &toggle_state = nullptr)#
Toggle constructor.
- Parameters:
router – The connection router to use
text – The text displayed in the toggle, if any
on_toggle – Called when the Toggle is modified
tooltip – Text to display on hover
render_as_button – Whether to render as an on/off slider or an up/down button
toggle_state – State containing whether the toggle is on or off
-
void setValue(bool on)#
Set the current value of the toggle.
- Parameters:
on – Whether the toggle should be set to on
-
Toggle(Router &router, std::string_view text, std::function<void(bool)> on_toggle, std::string_view tooltip = "", bool render_as_button = false, const Karana::Core::ks_ptr<State> &toggle_state = nullptr)#