Input.hpp
Create/control an HTML input and call a specified function when it receives input.
Use example:
Input my_input(MyFun, “input type”, “input Name”, “html_id”);
Where my_input is the C++ object linking to the input, MyFun is the function you want to call on changes, “Input Name” is the label on the input 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: Input & Callback(const std::function<void()> & in_callback) Input & Label(const std::string & in_label) Input & Autofocus(bool in_af) Input & Disabled(bool in_dis)
Retriving current state: const std::string & GetLabel() const bool HasAutofocus() const bool IsDisabled() const
-
class Input : public internal::WidgetFacet<Input>
- #include <Input.hpp>
Create or control an HTML Input object that you can manipulate and update as needed.
Public Types
-
using INFO_TYPE = InputInfo
Public Functions
-
inline Input(const std::function<void(std::string)> &in_cb, const std::string &in_type, const std::string &in_label, const std::string &in_id = "", bool show_value = false, bool is_checked = false)
Create a new Input.
- Parameters:
in_cb – The function to call when the Input is changed.
in_type – The type of this input.
in_label – The label that should appear on the Input.
in_id – The HTML ID to use for this Input (leave blank for auto-generated)
show_value – Do you want to add an output element to display to value of this input?
is_checked – Should the is_checked attribute by set to true or false?
-
inline Input()
-
inline virtual ~Input()
-
inline Input &Callback(const std::function<void(std::string)> &in_cb)
Set a new callback function to trigger when the Input is clicked.
-
inline Input &Checker(const std::function<bool(std::string)> &in_ck)
Set a new checker function to trigger when the Input is clicked.
-
inline bool HasAutofocus() const
Determine if this Input currently has autofocus.
-
inline bool IsDisabled() const
Determine if this Input is currently disabled.
Protected Functions
-
inline InputInfo *Info()
-
inline const InputInfo *Info() const
-
inline Input(InputInfo *in_info)
Friends
- friend class InputInfo
-
using INFO_TYPE = InputInfo