13#if defined(LECUI_EXPORTS)
16#include <liblec/lecui/widgets/widget.h>
29 float _corner_radius_x = 3.f;
30 float _corner_radius_y = 3.f;
31 std::string _prompt =
"Enter text here";
34 color _color_input_error;
35 std::set<char> _allowed_characters;
36 std::set<char> _forbidden_characters;
37 int _maximum_length = 0;
42 _cursor = cursor_type::caret;
43 _rect.size({ 200.f, 25.f });
50 std::function<void(
const std::string&)> change =
nullptr;
56 return _text_field_events;
75 std::string&
text()
override;
312#if defined(LECUI_EXPORTS)
313 friend class password_field_builder;
314 friend class text_field_impl;
321#if defined(lecui_helper)
323#define get_text_field(path) liblec::lecui::widgets::text_field::get(*this, path)
RGBA color on a standard 0 to 255 scale. For the alpha channel 0 is transparent and 255 is opaque.
Definition: lecui.h:583
Page container.
Definition: page.h:32
Rectangle class.
Definition: lecui.h:158
Resize parameters.
Definition: lecui.h:363
Text field widget. To instantiate and add to a container use the add static method.
Definition: text_field.h:26
std::string & tooltip() override
Get or set the widget's tooltip text.
bool operator==(const text_field ¶m)
Check whether widget specs are equal. Only those properties that require the widget resources to be r...
lecui::rect & rect() override
Get or set the position and dimensions of the widget.
float & font_size() override
Get or set the default widget font size in points, e.g. 9.0f.
text_field & corner_radius_y(const float &corner_radius_y)
Set the vertical radius of the corners.
color & color_disabled() override
Get or set the widget's color when it is disabled.
text_field()
Constructor.
Definition: text_field.h:41
text_field & color_text(const color &color_text)
Set the color of the widget's text.
std::string & text() override
Get or set the widget text.
text_field & color_disabled(const color &color_disabled)
Set the widget's color when it is disabled.
color & color_input_error()
Get or set the color to show that there has been an input error.
text_field & on_resize(const resize_params &on_resize)
Set the behaviour of the widget when its container is resized.
cursor_type & cursor() override
Get or set the mouse cursor to use then over the widget.
text_field & color_input_error(const color &color_input_error)
Set the color to show that there has been an input error.
text_field & forbidden_characters(const std::set< char > &forbidden_characters)
Set the set of characters to prevent from being typed in.
text_field & allowed_characters(const std::set< char > &allowed_characters)
Set the character set to limit input to.
color & color_fill() override
Get or set the fill color of the widget.
text_field & color_selected(const color &color_selected)
Set the widget's color when selected.
float & corner_radius_x()
Get or set the horizontal radius of the corners.
static text_field & add(containers::page &page, const std::string &alias=std::string())
Add a text field to a container.
color & color_hot() override
Get or set the widget's color when the mouse is hovered over it.
float & border()
Get or set the thickness of the border.
text_field & color_hot(const color &color_hot)
Set the widget's color when the mouse is hovered over it.
bool operator!=(const text_field ¶m)
Check whether widget specs are NOT equal. Only those properties that require the widget resources to ...
color & color_caret()
Get or set the color of the caret.
text_field & text(const std::string &text)
Set the widget's text.
int & maximum_length()
Get or set the maximum length of the input string. 0 means unlimited length.
color & color_text() override
Get or set the color of the widget's text.
text_field & color_prompt(const color &color_prompt)
Set the color of the prompt text.
text_field & color_border(const color &color_border)
Set the color of the border.
std::set< char > & forbidden_characters()
Get or set the set of characters to prevent from being typed in.
resize_params & on_resize() override
Get or set the behaviour of the widget when its container is resized.
static text_field & get(form &fm, const std::string &path)
Get the specifications of a text field.
color & color_prompt()
Get or set the color of the prompt text.
text_field & tooltip(const std::string &tooltip)
Set the tooltip text.
color & color_border()
Get or set the color of the border.
text_field & border(const float &border)
Set the thickness of the border.
float & corner_radius_y()
Get or set the vertical radius of the corners.
std::string & font() override
Get or set the default widget font, e.g. "Georgia".
text_field & color_fill(const color &color_fill)
Set the fill color of the widget.
std::set< char > & allowed_characters()
Get or set the character set to limit input to.
text_field & font_size(const float &font_size)
Set the widget's font size.
text_field & rect(const lecui::rect &rect)
Set the position and dimensions of the widget.
std::string & prompt()
Get or set the text to be displayed when the widget is empty.
text_field & prompt(const std::string &prompt)
Set the text to be displayed when the widget is empty.
text_field & corner_radius_x(const float &corner_radius_x)
Set the horizontal radius of the corners.
text_field_events & events()
Text field events.
Definition: text_field.h:55
text_field & maximum_length(const int &maximum_length)
Set the maximum length of the input string.
text_field & font(const std::string &font)
Set the default widget font.
text_field & color_caret(const color &color_caret)
Set the color of the caret.
color & color_selected() override
Get or set the widget's color when selected.
text_field & cursor(const cursor_type cursor)
Set the mouse cursor to use when over the widget.
Top level namespace for the liblec libraries.
Definition: appearance.h:19
Events specific to this widget.
Definition: text_field.h:47