#include <guiEditBox.h>
Public Member Functions | |
GUIEditBox (IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle, bool border, bool writable) | |
virtual | ~GUIEditBox () |
virtual void | setOverrideFont (IGUIFont *font=0) |
Sets another skin independent font. More... | |
virtual IGUIFont * | getOverrideFont () const |
virtual IGUIFont * | getActiveFont () const |
Get the font which is used right now for drawing. More... | |
virtual void | setOverrideColor (video::SColor color) |
Sets another color for the text. More... | |
virtual video::SColor | getOverrideColor () const |
Gets the override color. More... | |
virtual void | enableOverrideColor (bool enable) |
Sets if the text should use the overide color or the color in the gui skin. More... | |
virtual bool | isOverrideColorEnabled (void) const |
Checks if an override color is enabled. More... | |
virtual void | setWordWrap (bool enable) |
Enables or disables word wrap for using the edit box as multiline text editor. More... | |
virtual bool | isWordWrapEnabled () const |
Checks if word wrap is enabled. More... | |
virtual void | setDrawBorder (bool border) |
Turns the border on or off. More... | |
virtual bool | isDrawBorderEnabled () const |
virtual void | setMultiLine (bool enable) |
Enables or disables newlines. More... | |
virtual bool | isMultiLineEnabled () const |
Checks if multi line editing is enabled. More... | |
virtual void | setAutoScroll (bool enable) |
Enables or disables automatic scrolling with cursor position. More... | |
virtual bool | isAutoScrollEnabled () const |
Checks to see if automatic scrolling is enabled. More... | |
virtual void | setPasswordBox (bool passwordBox, wchar_t passwordChar=L' *') |
Sets whether the edit box is a password box. Setting this to true will. More... | |
virtual bool | isPasswordBox () const |
Returns true if the edit box is currently a password box. More... | |
virtual void | setTextAlignment (EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) |
Sets text justification. More... | |
virtual void | setText (const wchar_t *text) |
Sets the new caption of this element. More... | |
virtual void | setMax (u32 max) |
Sets the maximum amount of characters which may be entered in the box. More... | |
virtual u32 | getMax () const |
Returns maximum amount of characters, previously set by setMax();. More... | |
virtual core::dimension2du | getTextDimension () |
Gets the size area of the text in the edit box. More... | |
virtual void | setWritable (bool can_write_text) |
set true if this EditBox is writable More... | |
virtual bool | OnEvent (const SEvent &event) |
called if an event happened. More... | |
virtual void | serializeAttributes (io::IAttributes *out, io::SAttributeReadWriteOptions *options) const |
Writes attributes of the element. More... | |
virtual void | deserializeAttributes (io::IAttributes *in, io::SAttributeReadWriteOptions *options) |
Reads attributes of the element. More... | |
Protected Member Functions | |
virtual void | breakText ()=0 |
virtual void | setTextRect (s32 line)=0 |
sets the area of the given line More... | |
void | setTextMarkers (s32 begin, s32 end) |
set text markers More... | |
void | sendGuiEvent (EGUI_EVENT_TYPE type) |
send some gui event to parent More... | |
virtual void | calculateScrollPos ()=0 |
calculates the current scroll position More... | |
virtual s32 | getCursorPos (s32 x, s32 y)=0 |
bool | processKey (const SEvent &event) |
virtual void | inputChar (wchar_t c) |
s32 | getLineFromPos (s32 pos) |
returns the line number that the cursor is on More... | |
void | updateVScrollBar () |
update the vertical scrollBar (visibilty & position) More... | |
Protected Attributes | |
gui::IGUIFont * | m_override_font = nullptr |
bool | m_override_color_enabled = false |
bool | m_word_wrap = false |
bool | m_multiline = false |
bool | m_autoscroll = true |
bool | m_border |
bool | m_passwordbox = false |
wchar_t | m_passwordchar = L'*' |
std::vector< core::stringw > | m_broken_text |
std::vector< s32 > | m_broken_text_positions |
EGUI_ALIGNMENT | m_halign = EGUIA_UPPERLEFT |
EGUI_ALIGNMENT | m_valign = EGUIA_CENTER |
u32 | m_blink_start_time = 0 |
s32 | m_cursor_pos = 0 |
s32 | m_hscroll_pos = 0 |
s32 | m_vscroll_pos = 0 |
u32 | m_max = 0 |
video::SColor | m_override_color = video::SColor(101, 255, 255, 255) |
core::rect< s32 > | m_current_text_rect = core::rect<s32>(0, 0, 1, 1) |
bool | m_writable |
bool | m_mouse_marking = false |
s32 | m_mark_begin = 0 |
s32 | m_mark_end = 0 |
gui::IGUIFont * | m_last_break_font = nullptr |
IOSOperator * | m_operator = nullptr |
core::rect< s32 > | m_frame_rect |
u32 | m_scrollbar_width = 0 |
GUIScrollBar * | m_vscrollbar = nullptr |
Private Member Functions | |
bool | processMouse (const SEvent &event) |
bool | onKeyUp (const SEvent &event, s32 &mark_begin, s32 &mark_end) |
bool | onKeyDown (const SEvent &event, s32 &mark_begin, s32 &mark_end) |
void | onKeyControlC (const SEvent &event) |
bool | onKeyControlX (const SEvent &event, s32 &mark_begin, s32 &mark_end) |
bool | onKeyControlV (const SEvent &event, s32 &mark_begin, s32 &mark_end) |
bool | onKeyBack (const SEvent &event, s32 &mark_begin, s32 &mark_end) |
bool | onKeyDelete (const SEvent &event, s32 &mark_begin, s32 &mark_end) |
|
inline |
|
virtual |
References m_operator, m_override_font, and m_vscrollbar.
|
protectedpure virtual |
Implemented in irr::gui::intlGUIEditBox, and GUIEditBoxWithScrollBar.
Referenced by inputChar(), processKey(), setOverrideFont(), setText(), and setWordWrap().
|
protectedpure virtual |
calculates the current scroll position
Implemented in irr::gui::intlGUIEditBox, and GUIEditBoxWithScrollBar.
Referenced by inputChar(), processKey(), processMouse(), and updateVScrollBar().
|
virtual |
Reads attributes of the element.
Reimplemented in GUIEditBoxWithScrollBar.
References enableOverrideColor(), setAutoScroll(), setMax(), setMultiLine(), setOverrideColor(), setPasswordBox(), setTextAlignment(), setWordWrap(), and setWritable().
Referenced by GUIEditBoxWithScrollBar::deserializeAttributes().
|
virtual |
Sets if the text should use the overide color or the color in the gui skin.
References m_override_color_enabled.
Referenced by deserializeAttributes().
|
virtual |
Get the font which is used right now for drawing.
Currently this is the override font when one is set and the font of the active skin otherwise
References m_override_font.
Referenced by GUIEditBoxWithScrollBar::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), GUIEditBoxWithScrollBar::getCursorPos(), irr::gui::intlGUIEditBox::getCursorPos(), and GUIEditBoxWithScrollBar::setTextRect().
|
protectedpure virtual |
Implemented in irr::gui::intlGUIEditBox, and GUIEditBoxWithScrollBar.
Referenced by processMouse().
|
protected |
returns the line number that the cursor is on
References m_broken_text_positions, m_multiline, and m_word_wrap.
Referenced by GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), onKeyDown(), onKeyUp(), and processKey().
|
inlinevirtual |
Returns maximum amount of characters, previously set by setMax();.
|
virtual |
Gets the override color.
References m_override_color.
|
inlinevirtual |
|
virtual |
Gets the size area of the text in the edit box.
Gets the area of the text in the edit box.
References m_broken_text, m_current_text_rect, and setTextRect().
Referenced by updateVScrollBar().
|
protectedvirtual |
References breakText(), calculateScrollPos(), porting::getTimeMs(), m_blink_start_time, m_cursor_pos, m_mark_begin, m_mark_end, m_max, m_writable, sendGuiEvent(), and setTextMarkers().
Referenced by processKey().
|
inlinevirtual |
Checks to see if automatic scrolling is enabled.
|
inlinevirtual |
Reimplemented in GUIEditBoxWithScrollBar.
|
inlinevirtual |
Checks if multi line editing is enabled.
|
inlinevirtual |
Checks if an override color is enabled.
|
inlinevirtual |
Returns true if the edit box is currently a password box.
|
inlinevirtual |
Checks if word wrap is enabled.
|
virtual |
called if an event happened.
References m_mouse_marking, processKey(), processMouse(), and setTextMarkers().
|
private |
References porting::getTimeMs(), m_blink_start_time, m_cursor_pos, m_mark_begin, and m_mark_end.
Referenced by processKey().
|
private |
References m_mark_begin, m_mark_end, m_operator, and m_passwordbox.
Referenced by onKeyControlX(), and processKey().
|
private |
References m_cursor_pos, m_mark_begin, m_mark_end, m_max, m_operator, and p().
Referenced by processKey().
|
private |
References m_cursor_pos, m_mark_begin, m_mark_end, m_operator, m_passwordbox, and onKeyControlC().
Referenced by processKey().
|
private |
References porting::getTimeMs(), m_blink_start_time, m_cursor_pos, m_mark_begin, and m_mark_end.
Referenced by processKey().
|
private |
References getLineFromPos(), m_broken_text, m_broken_text_positions, m_cursor_pos, m_mark_begin, m_mark_end, m_multiline, and m_word_wrap.
Referenced by processKey().
|
private |
References getLineFromPos(), m_broken_text, m_broken_text_positions, m_cursor_pos, m_mark_begin, m_mark_end, m_multiline, and m_word_wrap.
Referenced by processKey().
|
protected |
References breakText(), calculateScrollPos(), getLineFromPos(), porting::getTimeMs(), inputChar(), m_blink_start_time, m_broken_text, m_broken_text_positions, m_cursor_pos, m_mark_begin, m_mark_end, m_multiline, m_word_wrap, m_writable, onKeyBack(), onKeyControlC(), onKeyControlV(), onKeyControlX(), onKeyDelete(), onKeyDown(), onKeyUp(), p(), sendGuiEvent(), and setTextMarkers().
Referenced by OnEvent().
|
private |
References calculateScrollPos(), getCursorPos(), GUIScrollBar::getPos(), GUIScrollBar::getSmallStep(), porting::getTimeMs(), m_blink_start_time, m_cursor_pos, m_mark_begin, m_mouse_marking, m_vscrollbar, GUIScrollBar::setPos(), and setTextMarkers().
Referenced by OnEvent().
|
protected |
send some gui event to parent
Referenced by inputChar(), processKey(), and setTextMarkers().
|
virtual |
Writes attributes of the element.
Reimplemented in GUIEditBoxWithScrollBar.
References m_autoscroll, m_halign, m_max, m_multiline, m_override_color, m_override_color_enabled, m_passwordbox, m_passwordchar, m_valign, m_word_wrap, and m_writable.
Referenced by GUIEditBoxWithScrollBar::serializeAttributes().
|
virtual |
Enables or disables automatic scrolling with cursor position.
enable | If set to true, the text will move around with the cursor position |
References m_autoscroll.
Referenced by deserializeAttributes().
|
virtual |
Turns the border on or off.
References m_border.
Referenced by GUIEditBoxWithScrollBar::deserializeAttributes().
|
virtual |
Sets the maximum amount of characters which may be entered in the box.
max | Maximum amount of characters. If 0, the character amount is infinity. |
References m_max.
Referenced by deserializeAttributes().
|
virtual |
Enables or disables newlines.
enable | If set to true, the EGET_EDITBOX_ENTER event will not be fired, instead a newline character will be inserted. |
References m_multiline.
Referenced by deserializeAttributes(), and setPasswordBox().
|
virtual |
Sets another color for the text.
References m_override_color, and m_override_color_enabled.
Referenced by deserializeAttributes().
|
virtual |
Sets another skin independent font.
References breakText(), and m_override_font.
|
virtual |
Sets whether the edit box is a password box. Setting this to true will.
disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
passwordBox | true to enable password, false to disable |
passwordChar | the character that is displayed instead of letters |
References m_broken_text, m_passwordbox, m_passwordchar, setMultiLine(), and setWordWrap().
Referenced by deserializeAttributes().
|
virtual |
Sets the new caption of this element.
References breakText(), m_cursor_pos, and m_hscroll_pos.
|
virtual |
Sets text justification.
References m_halign, and m_valign.
Referenced by deserializeAttributes().
|
protected |
set text markers
References m_mark_begin, m_mark_end, and sendGuiEvent().
Referenced by inputChar(), OnEvent(), processKey(), and processMouse().
|
protectedpure virtual |
sets the area of the given line
Implemented in irr::gui::intlGUIEditBox, and GUIEditBoxWithScrollBar.
Referenced by getTextDimension().
|
virtual |
Enables or disables word wrap for using the edit box as multiline text editor.
Enables or disables word wrap.
References breakText(), and m_word_wrap.
Referenced by deserializeAttributes(), and setPasswordBox().
|
virtual |
set true if this EditBox is writable
References m_writable.
Referenced by GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar(), irr::gui::intlGUIEditBox::intlGUIEditBox(), and deserializeAttributes().
|
protected |
update the vertical scrollBar (visibilty & position)
References calculateScrollPos(), GUIScrollBar::getMax(), GUIScrollBar::getPos(), getTextDimension(), m_current_text_rect, m_frame_rect, m_scrollbar_width, m_vscroll_pos, m_vscrollbar, GUIScrollBar::setMax(), GUIScrollBar::setPageSize(), and GUIScrollBar::setPos().
Referenced by GUIEditBoxWithScrollBar::calculateFrameRect(), and irr::gui::intlGUIEditBox::draw().
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), inputChar(), onKeyBack(), onKeyDelete(), processKey(), and processMouse().
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), irr::gui::intlGUIEditBox::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), GUIEditBoxWithScrollBar::getCursorPos(), irr::gui::intlGUIEditBox::getCursorPos(), getTextDimension(), onKeyDown(), onKeyUp(), processKey(), setPasswordBox(), GUIEditBoxWithScrollBar::setTextRect(), and irr::gui::intlGUIEditBox::setTextRect().
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), irr::gui::intlGUIEditBox::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), GUIEditBoxWithScrollBar::getCursorPos(), irr::gui::intlGUIEditBox::getCursorPos(), getLineFromPos(), onKeyDown(), onKeyUp(), and processKey().
|
protected |
Referenced by GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), GUIEditBoxWithScrollBar::getCursorPos(), irr::gui::intlGUIEditBox::getCursorPos(), getTextDimension(), GUIEditBoxWithScrollBar::setTextRect(), irr::gui::intlGUIEditBox::setTextRect(), and updateVScrollBar().
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), inputChar(), onKeyBack(), onKeyControlV(), onKeyControlX(), onKeyDelete(), onKeyDown(), onKeyUp(), processKey(), processMouse(), and setText().
|
protected |
Referenced by irr::gui::intlGUIEditBox::intlGUIEditBox(), GUIEditBoxWithScrollBar::calculateFrameRect(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::createVScrollBar(), irr::gui::intlGUIEditBox::createVScrollBar(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), GUIEditBoxWithScrollBar::setTextRect(), irr::gui::intlGUIEditBox::setTextRect(), and updateVScrollBar().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by inputChar(), onKeyControlV(), serializeAttributes(), and setMax().
|
protected |
Referenced by OnEvent(), and processMouse().
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), irr::gui::intlGUIEditBox::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), GUIEditBoxWithScrollBar::getCursorPos(), irr::gui::intlGUIEditBox::getCursorPos(), getLineFromPos(), onKeyDown(), onKeyUp(), processKey(), serializeAttributes(), setMultiLine(), GUIEditBoxWithScrollBar::setTextRect(), and irr::gui::intlGUIEditBox::setTextRect().
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by ~GUIEditBox(), irr::gui::intlGUIEditBox::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), irr::gui::intlGUIEditBox::createVScrollBar(), irr::gui::intlGUIEditBox::draw(), getActiveFont(), setOverrideFont(), and irr::gui::intlGUIEditBox::setTextRect().
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), serializeAttributes(), and setPasswordBox().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), irr::gui::intlGUIEditBox::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), irr::gui::intlGUIEditBox::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), irr::gui::intlGUIEditBox::draw(), GUIEditBoxWithScrollBar::getCursorPos(), irr::gui::intlGUIEditBox::getCursorPos(), getLineFromPos(), onKeyDown(), onKeyUp(), processKey(), serializeAttributes(), GUIEditBoxWithScrollBar::setTextRect(), irr::gui::intlGUIEditBox::setTextRect(), and setWordWrap().
|
protected |