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(const Input &in)

Link to an existing Input.

inline Input(const Widget &in)
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 Input &Label(const std::string &in_label)

Set a new label to appear on this Input.

inline Input &Type(const std::string &in_t)

Update the type.

inline Input &Min(const std::string &in_m)

Update the min.

inline Input &Min(const double &in_m)

Update the min.

inline Input &Max(const std::string &in_m)

Update the max.

inline Input &Max(const double &in_m)

Update the max.

inline Input &Value(const std::string &in_m)

Update the current value.

inline Input &Value(const double &in_m)

Update the current value.

inline Input &Step(const std::string &in_m)

Update the current step size.

inline Input &Step(const double &in_m)

Update the current step size.

inline Input &Autofocus(bool in_af = true)

Setup this Input to have autofocus (or remove it!)

inline Input &Disabled(bool in_dis = true)

Setup this Input to be disabled (or re-enable it!)

inline const std::string &GetCurrValue() const

Get the current label on this Input.

inline const std::string &GetLabel() const

Get the current label on this Input.

inline const std::string &GetType() const

Get the current type of this input.

inline const std::string &GetMin() const

Get the current min of this input.

inline const std::string &GetMax() const

Get the current max of this input.

inline const std::string &GetValue() const

Get the value attribute of this input.

inline const std::string &GetStep() const

Get the value attribute of this input.

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