#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. | |
virtual IGUIFont * | getOverrideFont () const |
virtual IGUIFont * | getActiveFont () const |
Get the font which is used right now for drawing. | |
virtual void | setOverrideColor (video::SColor color) |
Sets another color for the text. | |
virtual video::SColor | getOverrideColor () const |
Gets the override color. | |
virtual void | enableOverrideColor (bool enable) |
Sets if the text should use the overide color or the color in the gui skin. | |
virtual bool | isOverrideColorEnabled (void) const |
Checks if an override color is enabled. | |
virtual void | setWordWrap (bool enable) |
Enables or disables word wrap for using the edit box as multiline text editor. | |
virtual bool | isWordWrapEnabled () const |
Checks if word wrap is enabled. | |
virtual void | setDrawBorder (bool border) |
Turns the border on or off. | |
virtual bool | isDrawBorderEnabled () const |
virtual void | setMultiLine (bool enable) |
Enables or disables newlines. | |
virtual bool | isMultiLineEnabled () const |
Checks if multi line editing is enabled. | |
virtual void | setAutoScroll (bool enable) |
Enables or disables automatic scrolling with cursor position. | |
virtual bool | isAutoScrollEnabled () const |
Checks to see if automatic scrolling is enabled. | |
virtual void | setPasswordBox (bool passwordBox, wchar_t passwordChar=L' *') |
Sets whether the edit box is a password box. Setting this to true will. | |
virtual bool | isPasswordBox () const |
Returns true if the edit box is currently a password box. | |
virtual void | setTextAlignment (EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) |
Sets text justification. | |
virtual void | setText (const wchar_t *text) |
Sets the new caption of this element. | |
virtual void | setMax (u32 max) |
Sets the maximum amount of characters which may be entered in the box. | |
virtual u32 | getMax () const |
Returns maximum amount of characters, previously set by setMax();. | |
virtual core::dimension2du | getTextDimension () |
Gets the size area of the text in the edit box. | |
virtual void | setWritable (bool can_write_text) |
set true if this EditBox is writable | |
virtual bool | OnEvent (const SEvent &event) |
called if an event happened. | |
virtual bool | acceptsIME () |
Protected Member Functions | |
virtual void | breakText ()=0 |
virtual void | setTextRect (s32 line)=0 |
sets the area of the given line | |
void | setTextMarkers (s32 begin, s32 end) |
set text markers | |
void | sendGuiEvent (EGUI_EVENT_TYPE type) |
send some gui event to parent | |
virtual void | calculateScrollPos ()=0 |
calculates the current scroll position | |
virtual s32 | getCursorPos (s32 x, s32 y)=0 |
bool | processKey (const SEvent &event) |
virtual void | inputString (const core::stringw &str) |
virtual void | inputChar (wchar_t c) |
s32 | getLineFromPos (s32 pos) |
returns the line number that the cursor is on | |
void | updateVScrollBar () |
update the vertical scrollBar (visibilty & position) | |
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.
|
inlinevirtual |
References m_writable.
|
protectedpure virtual |
Implemented in GUIEditBoxWithScrollBar.
Referenced by inputString(), processKey(), setOverrideFont(), setText(), and setWordWrap().
|
protectedpure virtual |
calculates the current scroll position
Implemented in GUIEditBoxWithScrollBar.
Referenced by inputString(), processKey(), processMouse(), and updateVScrollBar().
|
virtual |
Sets if the text should use the overide color or the color in the gui skin.
References m_override_color_enabled.
|
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(), and GUIEditBoxWithScrollBar::setTextRect().
|
protectedpure virtual |
Implemented in 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(), GUIEditBoxWithScrollBar::draw(), onKeyDown(), onKeyUp(), and processKey().
|
inlinevirtual |
|
virtual |
Gets the override color.
References m_override_color.
|
inlinevirtual |
References m_override_font.
|
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 inputString().
Referenced by processKey().
|
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 inputChar(), OnEvent(), and processMouse().
|
inlinevirtual |
Checks to see if automatic scrolling is enabled.
References m_autoscroll.
|
inlinevirtual |
Reimplemented in GUIEditBoxWithScrollBar.
References m_border.
|
inlinevirtual |
Checks if multi line editing is enabled.
References m_multiline.
|
inlinevirtual |
Checks if an override color is enabled.
References m_override_color_enabled.
|
inlinevirtual |
Returns true if the edit box is currently a password box.
References m_passwordbox.
|
inlinevirtual |
Checks if word wrap is enabled.
References m_word_wrap.
|
virtual |
called if an event happened.
References inputString(), m_mouse_marking, processKey(), processMouse(), and setTextMarkers().
|
private |
References porting::getTimeMs(), m_blink_start_time, m_cursor_pos, m_mark_begin, m_mark_end, and m_writable.
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, m_writable, and p().
Referenced by processKey().
|
private |
References m_cursor_pos, m_mark_begin, m_mark_end, m_operator, m_passwordbox, m_writable, and onKeyControlC().
Referenced by processKey().
|
private |
References porting::getTimeMs(), m_blink_start_time, m_cursor_pos, m_mark_begin, m_mark_end, and m_writable.
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, onKeyBack(), onKeyControlC(), onKeyControlV(), onKeyControlX(), onKeyDelete(), onKeyDown(), onKeyUp(), p(), sendGuiEvent(), and setTextMarkers().
Referenced by OnEvent().
|
private |
References calculateScrollPos(), getCursorPos(), GUIScrollBar::getSmallStep(), GUIScrollBar::getTargetPos(), porting::getTimeMs(), inputString(), m_blink_start_time, m_cursor_pos, m_mark_begin, m_mouse_marking, m_operator, m_vscrollbar, GUIScrollBar::setPosInterpolated(), and setTextMarkers().
Referenced by OnEvent().
|
protected |
send some gui event to parent
Referenced by inputString(), processKey(), and setTextMarkers().
|
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.
|
virtual |
Turns the border on or off.
References m_border.
|
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.
|
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 setPasswordBox().
|
virtual |
Sets another color for the text.
References m_override_color, and m_override_color_enabled.
|
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().
|
virtual |
Sets the new caption of this element.
References breakText(), m_cursor_pos, and m_hscroll_pos.
|
virtual |
|
protected |
set text markers
References m_mark_begin, m_mark_end, m_operator, m_passwordbox, and sendGuiEvent().
Referenced by inputString(), OnEvent(), processKey(), and processMouse().
|
protectedpure virtual |
sets the area of the given line
Implemented in 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 setPasswordBox().
|
virtual |
set true if this EditBox is writable
References m_writable.
Referenced by GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar().
|
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().
|
protected |
Referenced by GUIEditBoxWithScrollBar::calculateScrollPos(), isAutoScrollEnabled(), and setAutoScroll().
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), inputString(), onKeyBack(), onKeyDelete(), processKey(), and processMouse().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by setTextAlignment(), and GUIEditBoxWithScrollBar::setTextRect().
|
protected |
Referenced by GUIEditBoxWithScrollBar::calculateScrollPos(), setText(), and GUIEditBoxWithScrollBar::setTextRect().
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), and GUIEditBoxWithScrollBar::draw().
|
protected |
|
protected |
|
protected |
Referenced by getMax(), inputString(), onKeyControlV(), and setMax().
|
protected |
Referenced by OnEvent(), and processMouse().
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), GUIEditBoxWithScrollBar::getCursorPos(), getLineFromPos(), isMultiLineEnabled(), onKeyDown(), onKeyUp(), processKey(), setMultiLine(), and GUIEditBoxWithScrollBar::setTextRect().
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), getOverrideColor(), and setOverrideColor().
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), enableOverrideColor(), isOverrideColorEnabled(), and setOverrideColor().
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), isPasswordBox(), onKeyControlC(), onKeyControlX(), setPasswordBox(), and setTextMarkers().
|
protected |
Referenced by GUIEditBoxWithScrollBar::draw(), and setPasswordBox().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by GUIEditBoxWithScrollBar::breakText(), GUIEditBoxWithScrollBar::calculateScrollPos(), GUIEditBoxWithScrollBar::draw(), GUIEditBoxWithScrollBar::getCursorPos(), getLineFromPos(), isWordWrapEnabled(), onKeyDown(), onKeyUp(), processKey(), GUIEditBoxWithScrollBar::setTextRect(), and setWordWrap().
|
protected |
Referenced by acceptsIME(), GUIEditBoxWithScrollBar::draw(), inputString(), onKeyBack(), onKeyControlV(), onKeyControlX(), onKeyDelete(), and setWritable().