#include <gui_editbox.hpp>
Public Member Functions | |
| edit_box (manager *pManager) | |
| Constructor. | |
| virtual | ~edit_box () |
| Destructor. | |
| virtual void | copy_from (uiobject *pObj) |
| Copies an uiobject's parameters into this edit_box (inheritance). | |
| virtual void | update (float fDelta) |
| updates this widget's logic. | |
| virtual void | on_event (const event &mEvent) |
| Calls the on_event script. | |
| virtual void | on (const std::string &sScriptName, event *pEvent=nullptr) |
| Calls a script. | |
| virtual bool | can_use_script (const std::string &sScriptName) const |
| Returns 'true' if this edit_box can use a script. | |
| virtual void | enable_keyboard (bool bIsKeyboardEnabled) |
| Sets if this edit_box can receive keyboard input. | |
| void | set_text (const std::string &sText) |
| Sets the content of this edit_box. | |
| const std::string & | get_text () const |
| Returns the content of this edit_box. | |
| void | highlight_text (uint uiStart=0u, uint uiEnd=uint(-1), bool bForceUpdate=false) |
| Selects a portion of the content. | |
| void | unlight_text () |
| Deselects the selected text, if any. | |
| void | set_highlight_color (const color &mColor) |
| Sets the color of the highlight quad. | |
| void | insert_after_cursor (const std::string &sText) |
| Inserts some text after the cursor. | |
| void | set_max_letters (uint uiMaxLetters) |
| Sets the maximum number of letters to allow in this edit_box. | |
| uint | get_max_letters () const |
| Returns the maximum number of letters to allow in this edit_box. | |
| uint | get_num_letters () const |
| Returns the number of letters in the content. | |
| void | set_blink_speed (const double &dBlinkSpeed) |
| Sets the carret's blink speed. | |
| const double & | get_blink_speed () const |
| Returns the carret's blink speed. | |
| void | set_numeric_only (bool bNumericOnly) |
| Makes this edit_box allow numeric characters only. | |
| void | set_positive_only (bool bPositiveOnly) |
| Makes this edit_box allow positive numbers only. | |
| void | set_integer_only (bool bIntegerOnly) |
| Makes this edit_box allow integer numbers only. | |
| bool | is_numeric_only () const |
| Checks if this edit_box allows numeric characters only. | |
| bool | is_positive_only () const |
| Checks if this edit_box allows positive numbers only. | |
| bool | is_integer_only () const |
| Checks if this edit_box allows integer numbers only. | |
| void | enable_password_mode (bool bEnable) |
| Enables password mode. | |
| bool | is_password_mode_enabled () const |
| Checks if this edit_box is in password mode. | |
| void | set_multi_line (bool bMultiLine) |
| Allows this edit_box to have several lines in it. | |
| bool | is_multi_line () const |
| Checks if this edit_box can have several lines in it. | |
| void | set_max_history_lines (uint uiMaxHistoryLines) |
| Sets the maximum number of history lines this edit_box can keep. | |
| uint | get_max_history_lines () const |
| Returns the maximum number of history lines this edit_box can keep. | |
| void | add_history_line (const std::string &sHistoryLine) |
| Adds a new history line to the history line list. | |
| const std::deque< std::string > & | get_history_lines () const |
| Returns the history line list. | |
| void | set_arrows_ignored (bool bArrowsIgnored) |
| Sets whether keyboard arrows move the carret or not. | |
| void | set_text_insets (int iLeft, int iRight, int iTop, int iBottom) |
| Sets the insets used to render the content text. | |
| void | set_text_insets (const std::array< int, 4 > &lInsets) |
| Sets the insets used to render the content text. | |
| const std::array< int, 4 > & | get_text_insets () const |
| Returns the text insets. | |
| font_string * | get_font_string () |
| Returns the font_string used to render the content. | |
| virtual void | notify_focus (bool bFocus) |
| Notifies this edit_box it has gained/lost focus. | |
| virtual void | create_glue () |
| Returns this widget's Lua glue. | |
| virtual void | parse_block (xml::block *pBlock) |
| Parses data from an xml::block. | |
Static Public Member Functions | |
| static void | register_glue (utils::wptr< lua::state > pLua) |
| Registers this widget to the provided lua::state. | |
Protected Member Functions | |
| void | notify_invisible_ (bool bTriggerEvents=true) |
| void | parse_font_string_block_ (xml::block *pBlock) |
| void | parse_highlight_color_block_ (xml::block *pBlock) |
| void | parse_text_insets_block_ (xml::block *pBlock) |
| font_string * | create_font_string_ () |
| void | create_highlight_ () |
| void | create_carret_ () |
| void | check_text_ () |
| void | update_displayed_text_ () |
| void | update_font_string_ () |
| void | update_carret_position_ () |
| bool | add_char_ (char32_t sChar) |
| bool | remove_char_ () |
| uint | get_letter_id_at_ (int iX, int iY) |
| bool | move_carret_at_ (int iX, int iY) |
| bool | move_carret_horizontally_ (bool bForward=true) |
| bool | move_carret_vertically_ (bool bDown=true) |
| void | process_key_ (uint uiKey) |
Protected Attributes | |
| std::string | sText_ |
| utils::ustring | sUnicodeText_ |
| utils::ustring | sDisplayedText_ |
| utils::ustring::iterator | iterCarretPos_ |
| uint | uiDisplayPos_ |
| uint | uiNumLetters_ |
| uint | uiMaxLetters_ |
| bool | bNumericOnly_ |
| bool | bPositiveOnly_ |
| bool | bIntegerOnly_ |
| bool | bPasswordMode_ |
| bool | bMultiLine_ |
| bool | bArrowsIgnored_ |
| std::string | sComboKey_ |
| texture * | pHighlight_ |
| color | mHighlightColor_ |
| uint | uiSelectionStartPos_ |
| uint | uiSelectionEndPos_ |
| bool | bSelectedText_ |
| texture * | pCarret_ |
| double | dBlinkSpeed_ |
| periodic_timer | mCarretTimer_ |
| std::deque< std::string > | lHistoryLineList_ |
| uint | uiMaxHistoryLines_ |
| font_string * | pFontString_ |
| std::array< int, 4 > | lTextInsets_ |
| uint | uiLastKeyPressed_ |
| double | dKeyRepeatSpeed_ |
| periodic_timer | mKeyRepeatTimer_ |
An editable text box.
Definition at line 90 of file gui_editbox.hpp.
| gui::edit_box::edit_box | ( | manager * | pManager | ) | [explicit] |
Constructor.
Definition at line 14 of file gui_editbox.cpp.
| gui::edit_box::~edit_box | ( | ) | [virtual] |
Destructor.
Definition at line 33 of file gui_editbox.cpp.
| bool gui::edit_box::add_char_ | ( | char32_t | sChar | ) | [protected] |
Definition at line 964 of file gui_editbox.cpp.
| void gui::edit_box::add_history_line | ( | const std::string & | sHistoryLine | ) |
Adds a new history line to the history line list.
| sHistoryLine | The content of this history line |
Definition at line 628 of file gui_editbox.cpp.
| bool gui::edit_box::can_use_script | ( | const std::string & | sScriptName | ) | const [virtual] |
Returns 'true' if this edit_box can use a script.
| sScriptName | The name of the script |
Reimplemented from gui::frame.
Definition at line 38 of file gui_editbox.cpp.
| void gui::edit_box::check_text_ | ( | ) | [protected] |
Definition at line 791 of file gui_editbox.cpp.
| void gui::edit_box::copy_from | ( | uiobject * | pObj | ) | [virtual] |
Copies an uiobject's parameters into this edit_box (inheritance).
| pObj | The uiobject to copy |
Reimplemented from gui::focus_frame.
Definition at line 57 of file gui_editbox.cpp.
| void gui::edit_box::create_carret_ | ( | ) | [protected] |
Definition at line 759 of file gui_editbox.cpp.
| font_string * gui::edit_box::create_font_string_ | ( | ) | [protected] |
Definition at line 714 of file gui_editbox.cpp.
| void gui::edit_box::create_glue | ( | ) | [virtual] |
Returns this widget's Lua glue.
Reimplemented from gui::focus_frame.
Definition at line 310 of file gui_editbox.cpp.
| void gui::edit_box::create_highlight_ | ( | ) | [protected] |
Definition at line 728 of file gui_editbox.cpp.
| void gui::edit_box::enable_keyboard | ( | bool | bIsKeyboardEnabled | ) | [virtual] |
Sets if this edit_box can receive keyboard input.
| bIsKeyboardEnabled | 'true' to enable |
Reimplemented from gui::frame.
Definition at line 264 of file gui_editbox.cpp.
| void gui::edit_box::enable_password_mode | ( | bool | bEnable | ) |
Enables password mode.
| bEnable | 'true' to enable password mode |
Definition at line 568 of file gui_editbox.cpp.
| const double & gui::edit_box::get_blink_speed | ( | ) | const |
Returns the carret's blink speed.
Definition at line 500 of file gui_editbox.cpp.
| font_string * gui::edit_box::get_font_string | ( | ) |
Returns the font_string used to render the content.
Definition at line 709 of file gui_editbox.cpp.
| const std::deque< std::string > & gui::edit_box::get_history_lines | ( | ) | const |
Returns the history line list.
Definition at line 636 of file gui_editbox.cpp.
| uint gui::edit_box::get_letter_id_at_ | ( | int | iX, | |
| int | iY | |||
| ) | [protected] |
Definition at line 1056 of file gui_editbox.cpp.
| uint gui::edit_box::get_max_history_lines | ( | ) | const |
Returns the maximum number of history lines this edit_box can keep.
Definition at line 623 of file gui_editbox.cpp.
| uint gui::edit_box::get_max_letters | ( | ) | const |
Returns the maximum number of letters to allow in this edit_box.
Definition at line 481 of file gui_editbox.cpp.
| uint gui::edit_box::get_num_letters | ( | ) | const |
Returns the number of letters in the content.
Definition at line 486 of file gui_editbox.cpp.
| const std::string & gui::edit_box::get_text | ( | ) | const |
Returns the content of this edit_box.
Definition at line 346 of file gui_editbox.cpp.
| const std::array< int, 4 > & gui::edit_box::get_text_insets | ( | ) | const |
| void gui::edit_box::highlight_text | ( | uint | uiStart = 0u, |
|
| uint | uiEnd = uint(-1), |
|||
| bool | bForceUpdate = false | |||
| ) |
Selects a portion of the content.
| uiStart | The first character to select | |
| uiEnd | The last character to select | |
| bForceUpdate | 'true' to bypass all redundancy checks |
Definition at line 360 of file gui_editbox.cpp.
| void gui::edit_box::insert_after_cursor | ( | const std::string & | sText | ) |
Inserts some text after the cursor.
| sText | The text to insert |
Definition at line 430 of file gui_editbox.cpp.
| bool gui::edit_box::is_integer_only | ( | ) | const |
Checks if this edit_box allows integer numbers only.
Definition at line 563 of file gui_editbox.cpp.
| bool gui::edit_box::is_multi_line | ( | ) | const |
Checks if this edit_box can have several lines in it.
Definition at line 601 of file gui_editbox.cpp.
| bool gui::edit_box::is_numeric_only | ( | ) | const |
Checks if this edit_box allows numeric characters only.
Definition at line 553 of file gui_editbox.cpp.
| bool gui::edit_box::is_password_mode_enabled | ( | ) | const |
Checks if this edit_box is in password mode.
Definition at line 580 of file gui_editbox.cpp.
| bool gui::edit_box::is_positive_only | ( | ) | const |
Checks if this edit_box allows positive numbers only.
Definition at line 558 of file gui_editbox.cpp.
| bool gui::edit_box::move_carret_at_ | ( | int | iX, | |
| int | iY | |||
| ) | [protected] |
Definition at line 1096 of file gui_editbox.cpp.
| bool gui::edit_box::move_carret_horizontally_ | ( | bool | bForward = true |
) | [protected] |
Definition at line 1109 of file gui_editbox.cpp.
| bool gui::edit_box::move_carret_vertically_ | ( | bool | bDown = true |
) | [protected] |
Definition at line 1147 of file gui_editbox.cpp.
| void gui::edit_box::notify_focus | ( | bool | bFocus | ) | [virtual] |
Notifies this edit_box it has gained/lost focus.
| bFocus | 'true' if the edit_box has gained focus |
Reimplemented from gui::focus_frame.
Definition at line 676 of file gui_editbox.cpp.
| void gui::edit_box::notify_invisible_ | ( | bool | bTriggerEvents = true |
) | [protected, virtual] |
Reimplemented from gui::frame.
Definition at line 703 of file gui_editbox.cpp.
| void gui::edit_box::on | ( | const std::string & | sScriptName, | |
| event * | pEvent = nullptr | |||
| ) | [virtual] |
Calls a script.
| sScriptName | The name of the script | |
| pEvent | Stores scripts arguments |
Reimplemented from gui::frame.
Definition at line 277 of file gui_editbox.cpp.
| void gui::edit_box::on_event | ( | const event & | mEvent | ) | [virtual] |
Calls the on_event script.
| mEvent | The Event that occured |
Reimplemented from gui::frame.
Definition at line 166 of file gui_editbox.cpp.
| void gui::edit_box::parse_block | ( | xml::block * | pBlock | ) | [virtual] |
Parses data from an xml::block.
| pBlock | The edit_box's xml::block |
Reimplemented from gui::focus_frame.
Definition at line 10 of file gui_editbox_parser.cpp.
| void gui::edit_box::parse_font_string_block_ | ( | xml::block * | pBlock | ) | [protected] |
Definition at line 46 of file gui_editbox_parser.cpp.
| void gui::edit_box::parse_highlight_color_block_ | ( | xml::block * | pBlock | ) | [protected] |
Definition at line 82 of file gui_editbox_parser.cpp.
| void gui::edit_box::parse_text_insets_block_ | ( | xml::block * | pBlock | ) | [protected] |
Definition at line 96 of file gui_editbox_parser.cpp.
| void gui::edit_box::process_key_ | ( | uint | uiKey | ) | [protected] |
Definition at line 1179 of file gui_editbox.cpp.
| void gui::edit_box::register_glue | ( | utils::wptr< lua::state > | pLua | ) | [static] |
Registers this widget to the provided lua::state.
Definition at line 7 of file gui_editbox_glues.cpp.
| bool gui::edit_box::remove_char_ | ( | ) | [protected] |
Definition at line 1014 of file gui_editbox.cpp.
| void gui::edit_box::set_arrows_ignored | ( | bool | bArrowsIgnored | ) |
Sets whether keyboard arrows move the carret or not.
| bArrowsIgnored | 'true' to ignore arrow keys |
Definition at line 641 of file gui_editbox.cpp.
| void gui::edit_box::set_blink_speed | ( | const double & | dBlinkSpeed | ) |
Sets the carret's blink speed.
| dBlinkSpeed | The number of seconds to wait between each blink |
Definition at line 491 of file gui_editbox.cpp.
| void gui::edit_box::set_highlight_color | ( | const color & | mColor | ) |
Sets the color of the highlight quad.
| mColor | The color |
Definition at line 414 of file gui_editbox.cpp.
| void gui::edit_box::set_integer_only | ( | bool | bIntegerOnly | ) |
Makes this edit_box allow integer numbers only.
| bIntegerOnly | 'true' to only allow integer numbers |
Definition at line 537 of file gui_editbox.cpp.
| void gui::edit_box::set_max_history_lines | ( | uint | uiMaxHistoryLines | ) |
Sets the maximum number of history lines this edit_box can keep.
| uiMaxHistoryLines | The max number of history lines |
Definition at line 606 of file gui_editbox.cpp.
| void gui::edit_box::set_max_letters | ( | uint | uiMaxLetters | ) |
Sets the maximum number of letters to allow in this edit_box.
| uiMaxLetters | The max number of letters |
Definition at line 453 of file gui_editbox.cpp.
| void gui::edit_box::set_multi_line | ( | bool | bMultiLine | ) |
Allows this edit_box to have several lines in it.
| bMultiLine | 'true' to allow several lines in this edit_box |
Definition at line 585 of file gui_editbox.cpp.
| void gui::edit_box::set_numeric_only | ( | bool | bNumericOnly | ) |
Makes this edit_box allow numeric characters only.
| bNumericOnly | 'true' to only allow numeric characters |
Definition at line 505 of file gui_editbox.cpp.
| void gui::edit_box::set_positive_only | ( | bool | bPositiveOnly | ) |
Makes this edit_box allow positive numbers only.
| bPositiveOnly | 'true' to only allow positive numbers |
Definition at line 521 of file gui_editbox.cpp.
| void gui::edit_box::set_text | ( | const std::string & | sText | ) |
Sets the content of this edit_box.
| sText | The content of this edit_box |
Definition at line 330 of file gui_editbox.cpp.
| void gui::edit_box::set_text_insets | ( | const std::array< int, 4 > & | lInsets | ) |
Sets the insets used to render the content text.
| lInsets | (left, right, top, bottom) |
Definition at line 651 of file gui_editbox.cpp.
| void gui::edit_box::set_text_insets | ( | int | iLeft, | |
| int | iRight, | |||
| int | iTop, | |||
| int | iBottom | |||
| ) |
Sets the insets used to render the content text.
| iLeft | The left inset | |
| iRight | The right inset | |
| iTop | The top inset | |
| iBottom | The bottom inset |
Definition at line 646 of file gui_editbox.cpp.
| void gui::edit_box::unlight_text | ( | ) |
Deselects the selected text, if any.
Definition at line 351 of file gui_editbox.cpp.
| void gui::edit_box::update | ( | float | fDelta | ) | [virtual] |
updates this widget's logic.
Reimplemented from gui::frame.
Definition at line 108 of file gui_editbox.cpp.
| void gui::edit_box::update_carret_position_ | ( | ) | [protected] |
Definition at line 843 of file gui_editbox.cpp.
| void gui::edit_box::update_displayed_text_ | ( | ) | [protected] |
Definition at line 808 of file gui_editbox.cpp.
| void gui::edit_box::update_font_string_ | ( | ) | [protected] |
Definition at line 832 of file gui_editbox.cpp.
bool gui::edit_box::bArrowsIgnored_ [protected] |
Definition at line 355 of file gui_editbox.hpp.
bool gui::edit_box::bIntegerOnly_ [protected] |
Definition at line 352 of file gui_editbox.hpp.
bool gui::edit_box::bMultiLine_ [protected] |
Definition at line 354 of file gui_editbox.hpp.
bool gui::edit_box::bNumericOnly_ [protected] |
Definition at line 350 of file gui_editbox.hpp.
bool gui::edit_box::bPasswordMode_ [protected] |
Definition at line 353 of file gui_editbox.hpp.
bool gui::edit_box::bPositiveOnly_ [protected] |
Definition at line 351 of file gui_editbox.hpp.
bool gui::edit_box::bSelectedText_ [protected] |
Definition at line 363 of file gui_editbox.hpp.
double gui::edit_box::dBlinkSpeed_ [protected] |
Definition at line 366 of file gui_editbox.hpp.
double gui::edit_box::dKeyRepeatSpeed_ [protected] |
Definition at line 376 of file gui_editbox.hpp.
utils::ustring::iterator gui::edit_box::iterCarretPos_ [protected] |
Definition at line 345 of file gui_editbox.hpp.
std::deque<std::string> gui::edit_box::lHistoryLineList_ [protected] |
Definition at line 369 of file gui_editbox.hpp.
std::array<int,4> gui::edit_box::lTextInsets_ [protected] |
Definition at line 373 of file gui_editbox.hpp.
periodic_timer gui::edit_box::mCarretTimer_ [protected] |
Definition at line 367 of file gui_editbox.hpp.
color gui::edit_box::mHighlightColor_ [protected] |
Definition at line 360 of file gui_editbox.hpp.
periodic_timer gui::edit_box::mKeyRepeatTimer_ [protected] |
Definition at line 377 of file gui_editbox.hpp.
texture* gui::edit_box::pCarret_ [protected] |
Definition at line 365 of file gui_editbox.hpp.
font_string* gui::edit_box::pFontString_ [protected] |
Definition at line 372 of file gui_editbox.hpp.
texture* gui::edit_box::pHighlight_ [protected] |
Definition at line 359 of file gui_editbox.hpp.
std::string gui::edit_box::sComboKey_ [protected] |
Definition at line 357 of file gui_editbox.hpp.
utils::ustring gui::edit_box::sDisplayedText_ [protected] |
Definition at line 344 of file gui_editbox.hpp.
std::string gui::edit_box::sText_ [protected] |
Definition at line 342 of file gui_editbox.hpp.
utils::ustring gui::edit_box::sUnicodeText_ [protected] |
Definition at line 343 of file gui_editbox.hpp.
uint gui::edit_box::uiDisplayPos_ [protected] |
Definition at line 347 of file gui_editbox.hpp.
uint gui::edit_box::uiLastKeyPressed_ [protected] |
Definition at line 375 of file gui_editbox.hpp.
uint gui::edit_box::uiMaxHistoryLines_ [protected] |
Definition at line 370 of file gui_editbox.hpp.
uint gui::edit_box::uiMaxLetters_ [protected] |
Definition at line 349 of file gui_editbox.hpp.
uint gui::edit_box::uiNumLetters_ [protected] |
Definition at line 348 of file gui_editbox.hpp.
uint gui::edit_box::uiSelectionEndPos_ [protected] |
Definition at line 362 of file gui_editbox.hpp.
uint gui::edit_box::uiSelectionStartPos_ [protected] |
Definition at line 361 of file gui_editbox.hpp.
1.6.1