1#ifndef LXGUI_GUI_EDIT_BOX_HPP 
    2#define LXGUI_GUI_EDIT_BOX_HPP 
    4#include "lxgui/gui_bounds2.hpp" 
    5#include "lxgui/gui_color.hpp" 
    6#include "lxgui/gui_frame.hpp" 
    7#include "lxgui/input_keys.hpp" 
    8#include "lxgui/lxgui.hpp" 
    9#include "lxgui/utils.hpp" 
   10#include "lxgui/utils_periodic_timer.hpp" 
   11#include "lxgui/utils_string.hpp" 
   91    bool can_use_script(
const std::string& script_name) 
const override;
 
   97    void set_text(
const utils::ustring& content);
 
  103    const utils::ustring& 
get_text() 
const;
 
  113        std::size_t start        = 0u,
 
  114        std::size_t end          = std::numeric_limits<std::size_t>::max(),
 
  115        bool        force_update = 
false);
 
  337    void set_font(
const std::string& font_name, 
float height);
 
  359    void update_(
float delta) 
override;
 
  401    utils::observer_ptr<texture> 
carret_     = 
nullptr;
 
 
Holds a single color (float RGBA, 128 bits)
 
A frame with an editable text box.
 
void set_integer_only(bool integer_only)
Makes this edit_box allow integer numbers only.
 
bool add_char_(char32_t c)
 
const bounds2f & get_text_insets() const
Returns the text insets.
 
void disable_password_mode()
Disables password mode.
 
void update_displayed_text_()
 
std::size_t get_max_letters() const
Returns the maximum number of letters to allow in this edit_box.
 
static void register_on_lua(sol::state &lua)
Registers this region class to the provided Lua state.
 
void notify_scaling_factor_updated() override
Tells this region that the global interface scaling factor has changed.
 
void set_max_letters(std::size_t max_letters)
Sets the maximum number of letters to allow in this edit_box.
 
void set_text_insets(const bounds2f &insets)
Sets the insets used to render the content text.
 
const std::vector< std::string > & get_type_list_() const override
 
void add_history_line(const utils::ustring &history_line)
Adds a new history line to the history line list.
 
utils::ustring::iterator iter_carret_pos_
 
void clear_history_lines()
Clears the history line list.
 
void process_key_(input::key key_id, bool shift_is_pressed, bool ctrl_is_pressed)
 
void set_font_string(utils::observer_ptr< font_string > fstr)
Sets the font_string to use to render the content.
 
void parse_attributes_(const layout_node &node) override
 
bool move_carret_vertically_(bool down=true)
 
double get_blink_time() const
Returns the carret's blink time.
 
void set_highlight_color(const color &c)
Sets the color of the highlight quad.
 
void parse_font_string_node_(const layout_node &node)
 
bool is_positive_only() const
Checks if this edit_box allows positive numbers only.
 
utils::periodic_timer carret_timer_
 
std::size_t selection_start_pos_
 
void highlight_text(std::size_t start=0u, std::size_t end=std::numeric_limits< std::size_t >::max(), bool force_update=false)
Selects a portion of the content.
 
void set_cursor_position(std::size_t pos)
Moves the cursor to a chosen position.
 
void set_positive_only(bool positive_only)
Makes this edit_box allow positive numbers only.
 
std::size_t get_letter_count() const
Returns the number of letters in the content.
 
const utils::ustring & get_text() const
Returns the content of this edit_box.
 
std::size_t max_history_lines_
 
static constexpr const char * class_name
 
void set_font(const std::string &font_name, float height)
Sets the font (file and size) to render the content.
 
void set_text(const utils::ustring &content)
Sets the content of this edit_box.
 
bool move_carret_horizontally_(bool forward=true)
 
const std::vector< utils::ustring > & get_history_lines() const
Returns the history line list.
 
std::size_t get_max_history_lines() const
Returns the maximum number of history lines this edit_box can keep.
 
bool is_numeric_only() const
Checks if this edit_box allows numeric characters only.
 
std::size_t get_cursor_position() const
Returns the current position of the cursor.
 
utils::observer_ptr< font_string > font_string_
 
void insert_after_cursor(const utils::ustring &content)
Inserts some text after the cursor.
 
bool is_password_mode_enabled() const
Checks if this edit_box is in password mode.
 
bool is_integer_only() const
Checks if this edit_box allows integer numbers only.
 
void parse_text_insets_node_(const layout_node &node)
 
void enable_password_mode()
Enables password mode.
 
bool move_carret_at_(const vector2f &position)
 
void copy_from(const region &obj) override
Copies a region's parameters into this edit_box (inheritance).
 
void set_password_mode_enabled(bool enable)
Enables or disables password mode.
 
std::size_t selection_end_pos_
 
const utils::observer_ptr< font_string > & get_font_string()
Returns the font_string used to render the content.
 
void notify_focus(bool focus) override
Notifies this frame that it has received or lost focus.
 
void set_numeric_only(bool numeric_only)
Makes this edit_box allow numeric characters only.
 
std::size_t get_letter_id_at_(const vector2f &position) const
 
void update_carret_position_()
 
std::vector< utils::ustring > history_line_list_
 
void set_arrows_ignored(bool arrows_ignored)
Sets whether keyboard arrows move the carret or not.
 
void unlight_text()
Deselects the selected text, if any.
 
void set_blink_time(double blink_time)
Sets the carret's blink time.
 
utils::observer_ptr< texture > highlight_
 
void set_multi_line(bool multi_line)
Allows this edit_box to have several lines in it.
 
bool can_use_script(const std::string &script_name) const override
Returns 'true' if this edit_box can use a script.
 
utils::observer_ptr< const font_string > get_font_string() const
Returns the font_string used to render the content.
 
std::size_t current_history_line_
 
utils::ustring displayed_text_
 
void update_(float delta) override
 
void fire_script(const std::string &script_name, const event_data &data=event_data{}) override
Calls a script.
 
void create_font_string_()
 
utils::observer_ptr< texture > carret_
 
bool is_multi_line() const
Checks if this edit_box can have several lines in it.
 
void set_max_history_lines(std::size_t max_history_lines)
Sets the maximum number of history lines this edit_box can keep.
 
void update_font_string_()
 
void parse_all_nodes_before_children_(const layout_node &node) override
 
utils::ustring unicode_text_
 
Stores a variable number of arguments for an event.
 
A region that can contain other regions and react to events.
 
An node in a layout file.
 
Manages the user interface.
 
The base class of all elements in the GUI.
 
static const bounds2 zero
 
Struct holding all the core information about a frame necessary for its creation.