TextArea.hpp

Specs for the TextArea widget.

Todo:

Callback does a lot of string-copies at the moment; should be streamlined.

class TextArea : public internal::WidgetFacet<TextArea>
#include <TextArea.hpp>

An input field for text data. A function provided at creation time will be called each time the contents of the TextWidget are changed. The current text contents can also always be accessed with the GetText() member function.

Public Types

using INFO_TYPE = TextAreaInfo

Public Functions

inline TextArea(const std::string &in_id = "")

Build a text area with a specified HTML identifier.

inline TextArea(std::function<void(const std::string&)> in_cb, const std::string &in_id = "")

Build a text area with a specified function to call with every change.

inline TextArea(const TextArea &in)

Connect to an existing TextArea.

inline TextArea(const Widget &in)
inline virtual ~TextArea()
inline const std::string &GetText() const

Get the current text in this TextArea.

inline TextArea &SetAutofocus(bool in_af)

Make this text area have focus by default.

inline TextArea &SetCallback(const std::function<void(const std::string&)> &in_cb)

Change the callback function for this TextArea.

inline TextArea &SetDisabled(bool in_dis)

Gray out this text area.

inline TextArea &SetText(const std::string &in_text)

Set the text contained in the text area.

inline bool HasAutofocus() const

Does this widget have auto focus set?

inline bool IsDisabled() const

Is this widget currently disabled?

Protected Functions

inline TextAreaInfo *Info()
inline const TextAreaInfo *Info() const
inline TextArea(TextAreaInfo *in_info)

Friends

friend class TextAreaInfo