Button.hpp
Create/control an HTML button and call a specified function when that button is clicked.
Use example:
Button my_button(MyFun, “Button Name”, “html_id”);
Where my_button is the C++ object linking to the button, MyFun is the function you want to call on clicks, “Button Name” is the label on the button itself, and “html_id” is the optional id you want it to use in the HTML code (otherwise it will generate a unique name on its own.)
Member functions to set state: Button & SetCallback(const std::function<void()> & in_callback) Button & SetLabel(const std::string & in_label) Button & SetAutofocus(bool in_af) Button & SetDisabled(bool in_dis)
Retriving current state: const std::string & GetLabel() const bool HasAutofocus() const bool IsDisabled() const
-
class Button : public internal::WidgetFacet<Button>
- #include <Button.hpp>
Create or control an HTML Button object that you can manipulate and update as needed.
Public Types
-
using INFO_TYPE = ButtonInfo
Public Functions
-
inline Button(const std::function<void()> &in_cb, const std::string &in_label, const std::string &in_id = "")
Create a new button.
- Parameters:
in_cb – The function to call when the button is clicked.
in_label – The label that should appear on the button.
in_id – The HTML ID to use for this button (leave blank for auto-generated)
-
inline Button()
-
inline virtual ~Button()
-
inline Button &SetCallback(const std::function<void()> &in_cb)
Set a new callback function to trigger when the button is clicked.
-
inline bool HasAutofocus() const
Determine if this button currently has autofocus.
-
inline bool IsDisabled() const
Determine if this button is currently disabled.
Protected Functions
-
inline ButtonInfo *Info()
-
inline const ButtonInfo *Info() const
-
inline Button(ButtonInfo *in_info)
Friends
- friend class ButtonInfo
-
using INFO_TYPE = ButtonInfo