diff options
Diffstat (limited to 'src/gui/guiEditBoxWithScrollbar.cpp')
-rw-r--r-- | src/gui/guiEditBoxWithScrollbar.cpp | 586 |
1 files changed, 359 insertions, 227 deletions
diff --git a/src/gui/guiEditBoxWithScrollbar.cpp b/src/gui/guiEditBoxWithScrollbar.cpp index 442406688..c803ba58c 100644 --- a/src/gui/guiEditBoxWithScrollbar.cpp +++ b/src/gui/guiEditBoxWithScrollbar.cpp @@ -17,31 +17,30 @@ todo: optional scrollbars [done] ctrl+left/right to select word -double click/ctrl click: word select + drag to select whole words, triple click to select line -optional? dragging selected text -numerical +double click/ctrl click: word select + drag to select whole words, triple click to select +line optional? dragging selected text numerical */ - //! constructor -GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar(const wchar_t* text, bool border, - IGUIEnvironment* environment, IGUIElement* parent, s32 id, - const core::rect<s32>& rectangle, bool writable, bool has_vscrollbar) - : IGUIEditBox(environment, parent, id, rectangle), m_mouse_marking(false), - m_border(border), m_background(true), m_override_color_enabled(false), m_mark_begin(0), m_mark_end(0), - m_override_color(video::SColor(101, 255, 255, 255)), m_override_font(0), m_last_break_font(0), - m_operator(0), m_blink_start_time(0), m_cursor_pos(0), m_hscroll_pos(0), m_vscroll_pos(0), m_max(0), - m_word_wrap(false), m_multiline(false), m_autoscroll(true), m_passwordbox(false), - m_passwordchar(L'*'), m_halign(EGUIA_UPPERLEFT), m_valign(EGUIA_CENTER), - m_current_text_rect(0, 0, 1, 1), m_frame_rect(rectangle), - m_scrollbar_width(0), m_vscrollbar(NULL), m_writable(writable), - m_bg_color_used(false) +GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar(const wchar_t *text, bool border, + IGUIEnvironment *environment, IGUIElement *parent, s32 id, + const core::rect<s32> &rectangle, bool writable, bool has_vscrollbar) : + IGUIEditBox(environment, parent, id, rectangle), + m_mouse_marking(false), m_border(border), m_background(true), + m_override_color_enabled(false), m_mark_begin(0), m_mark_end(0), + m_override_color(video::SColor(101, 255, 255, 255)), m_override_font(0), + m_last_break_font(0), m_operator(0), m_blink_start_time(0), + m_cursor_pos(0), m_hscroll_pos(0), m_vscroll_pos(0), m_max(0), + m_word_wrap(false), m_multiline(false), m_autoscroll(true), + m_passwordbox(false), m_passwordchar(L'*'), m_halign(EGUIA_UPPERLEFT), + m_valign(EGUIA_CENTER), m_current_text_rect(0, 0, 1, 1), + m_frame_rect(rectangle), m_scrollbar_width(0), m_vscrollbar(NULL), + m_writable(writable), m_bg_color_used(false) { #ifdef _DEBUG setDebugName("GUIEditBoxWithScrollBar"); #endif - Text = text; if (Environment) @@ -65,7 +64,6 @@ GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar(const wchar_t* text, bool borde setWritable(writable); } - //! destructor GUIEditBoxWithScrollBar::~GUIEditBoxWithScrollBar() { @@ -79,9 +77,8 @@ GUIEditBoxWithScrollBar::~GUIEditBoxWithScrollBar() m_vscrollbar->drop(); } - //! Sets another skin independent font. -void GUIEditBoxWithScrollBar::setOverrideFont(IGUIFont* font) +void GUIEditBoxWithScrollBar::setOverrideFont(IGUIFont *font) { if (m_override_font == font) return; @@ -98,17 +95,17 @@ void GUIEditBoxWithScrollBar::setOverrideFont(IGUIFont* font) } //! Gets the override font (if any) -IGUIFont * GUIEditBoxWithScrollBar::getOverrideFont() const +IGUIFont *GUIEditBoxWithScrollBar::getOverrideFont() const { return m_override_font; } //! Get the font which is used right now for drawing -IGUIFont* GUIEditBoxWithScrollBar::getActiveFont() const +IGUIFont *GUIEditBoxWithScrollBar::getActiveFont() const { if (m_override_font) return m_override_font; - IGUISkin* skin = Environment->getSkin(); + IGUISkin *skin = Environment->getSkin(); if (skin) return skin->getFont(); return 0; @@ -121,13 +118,11 @@ void GUIEditBoxWithScrollBar::setOverrideColor(video::SColor color) m_override_color_enabled = true; } - video::SColor GUIEditBoxWithScrollBar::getOverrideColor() const { return m_override_color; } - //! Turns the border on or off void GUIEditBoxWithScrollBar::setDrawBorder(bool border) { @@ -158,7 +153,6 @@ void GUIEditBoxWithScrollBar::setWordWrap(bool enable) breakText(); } - void GUIEditBoxWithScrollBar::updateAbsolutePosition() { core::rect<s32> old_absolute_rect(AbsoluteRect); @@ -176,21 +170,18 @@ bool GUIEditBoxWithScrollBar::isWordWrapEnabled() const return m_word_wrap; } - //! Enables or disables newlines. void GUIEditBoxWithScrollBar::setMultiLine(bool enable) { m_multiline = enable; } - //! Checks if multi line editing is enabled bool GUIEditBoxWithScrollBar::isMultiLineEnabled() const { return m_multiline; } - void GUIEditBoxWithScrollBar::setPasswordBox(bool password_box, wchar_t password_char) { m_passwordbox = password_box; @@ -202,27 +193,24 @@ void GUIEditBoxWithScrollBar::setPasswordBox(bool password_box, wchar_t password } } - bool GUIEditBoxWithScrollBar::isPasswordBox() const { return m_passwordbox; } - //! Sets text justification -void GUIEditBoxWithScrollBar::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) +void GUIEditBoxWithScrollBar::setTextAlignment( + EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) { m_halign = horizontal; m_valign = vertical; } - //! called if an event happened. -bool GUIEditBoxWithScrollBar::OnEvent(const SEvent& event) +bool GUIEditBoxWithScrollBar::OnEvent(const SEvent &event) { if (isEnabled()) { - switch (event.EventType) - { + switch (event.EventType) { case EET_GUI_EVENT: if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST) { if (event.GUIEvent.Caller == this) { @@ -247,8 +235,7 @@ bool GUIEditBoxWithScrollBar::OnEvent(const SEvent& event) return IGUIElement::OnEvent(event); } - -bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) +bool GUIEditBoxWithScrollBar::processKey(const SEvent &event) { if (!m_writable) { return false; @@ -279,10 +266,13 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) break; case KEY_KEY_C: // copy to clipboard - if (!m_passwordbox && m_operator && m_mark_begin != m_mark_end) - { - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + if (!m_passwordbox && m_operator && m_mark_begin != m_mark_end) { + const s32 realmbgn = m_mark_begin < m_mark_end + ? m_mark_begin + : m_mark_end; + const s32 realmend = m_mark_begin < m_mark_end + ? m_mark_end + : m_mark_begin; core::stringc s; s = Text.subString(realmbgn, realmend - realmbgn).c_str(); @@ -292,20 +282,25 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) case KEY_KEY_X: // cut to the clipboard if (!m_passwordbox && m_operator && m_mark_begin != m_mark_end) { - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + const s32 realmbgn = m_mark_begin < m_mark_end + ? m_mark_begin + : m_mark_end; + const s32 realmend = m_mark_begin < m_mark_end + ? m_mark_end + : m_mark_begin; // copy core::stringc sc; - sc = Text.subString(realmbgn, realmend - realmbgn).c_str(); + sc = Text.subString(realmbgn, realmend - realmbgn) + .c_str(); m_operator->copyToClipboard(sc.c_str()); - if (isEnabled()) - { + if (isEnabled()) { // delete core::stringw s; s = Text.subString(0, realmbgn); - s.append(Text.subString(realmend, Text.size() - realmend)); + s.append(Text.subString(realmend, + Text.size() - realmend)); Text = s; m_cursor_pos = realmbgn; @@ -321,19 +316,28 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) // paste from the clipboard if (m_operator) { - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + const s32 realmbgn = m_mark_begin < m_mark_end + ? m_mark_begin + : m_mark_end; + const s32 realmend = m_mark_begin < m_mark_end + ? m_mark_end + : m_mark_begin; // add new character - const c8* p = m_operator->getTextFromClipboard(); + const c8 *p = m_operator->getTextFromClipboard(); if (p) { if (m_mark_begin == m_mark_end) { // insert text - core::stringw s = Text.subString(0, m_cursor_pos); + core::stringw s = Text.subString( + 0, m_cursor_pos); s.append(p); - s.append(Text.subString(m_cursor_pos, Text.size() - m_cursor_pos)); + s.append(Text.subString(m_cursor_pos, + Text.size() - m_cursor_pos)); - if (!m_max || s.size() <= m_max) // thx to Fish FH for fix + if (!m_max || s.size() <= m_max) // thx to + // Fish + // FH for + // fix { Text = s; s = p; @@ -342,15 +346,21 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) } else { // replace text - core::stringw s = Text.subString(0, realmbgn); + core::stringw s = Text.subString( + 0, realmbgn); s.append(p); - s.append(Text.subString(realmend, Text.size() - realmend)); + s.append(Text.subString(realmend, + Text.size() - realmend)); - if (!m_max || s.size() <= m_max) // thx to Fish FH for fix + if (!m_max || s.size() <= m_max) // thx to + // Fish + // FH for + // fix { Text = s; s = p; - m_cursor_pos = realmbgn + s.size(); + m_cursor_pos = realmbgn + + s.size(); } } } @@ -390,14 +400,15 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) } // default keyboard handling else - switch (event.KeyInput.Key) { - case KEY_END: - { + switch (event.KeyInput.Key) { + case KEY_END: { s32 p = Text.size(); if (m_word_wrap || m_multiline) { p = getLineFromPos(m_cursor_pos); - p = m_broken_text_positions[p] + (s32)m_broken_text[p].size(); - if (p > 0 && (Text[p - 1] == L'\r' || Text[p - 1] == L'\n')) + p = m_broken_text_positions[p] + + (s32)m_broken_text[p].size(); + if (p > 0 && (Text[p - 1] == L'\r' || + Text[p - 1] == L'\n')) p -= 1; } @@ -412,10 +423,8 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) } m_cursor_pos = p; m_blink_start_time = porting::getTimeMs(); - } - break; - case KEY_HOME: - { + } break; + case KEY_HOME: { s32 p = 0; if (m_word_wrap || m_multiline) { @@ -433,8 +442,7 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) } m_cursor_pos = p; m_blink_start_time = porting::getTimeMs(); - } - break; + } break; case KEY_RETURN: if (m_multiline) { inputChar(L'\n'); @@ -482,13 +490,25 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) case KEY_UP: if (m_multiline || (m_word_wrap && m_broken_text.size() > 1)) { s32 lineNo = getLineFromPos(m_cursor_pos); - s32 mb = (m_mark_begin == m_mark_end) ? m_cursor_pos : (m_mark_begin > m_mark_end ? m_mark_begin : m_mark_end); - if (lineNo > 0) { - s32 cp = m_cursor_pos - m_broken_text_positions[lineNo]; + s32 mb = (m_mark_begin == m_mark_end) + ? m_cursor_pos + : (m_mark_begin > m_mark_end ? m_mark_begin + : m_mark_end); + if (lineNo > 0) { + s32 cp = m_cursor_pos - + m_broken_text_positions[lineNo]; if ((s32)m_broken_text[lineNo - 1].size() < cp) - m_cursor_pos = m_broken_text_positions[lineNo - 1] + core::max_((u32)1, m_broken_text[lineNo - 1].size()) - 1; + m_cursor_pos = m_broken_text_positions + [lineNo - 1] + + core::max_((u32)1, + m_broken_text[lineNo - + 1] + .size()) - + 1; else - m_cursor_pos = m_broken_text_positions[lineNo - 1] + cp; + m_cursor_pos = m_broken_text_positions + [lineNo - 1] + + cp; } if (event.KeyInput.Shift) { @@ -505,14 +525,25 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) case KEY_DOWN: if (m_multiline || (m_word_wrap && m_broken_text.size() > 1)) { s32 lineNo = getLineFromPos(m_cursor_pos); - s32 mb = (m_mark_begin == m_mark_end) ? m_cursor_pos : (m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end); - if (lineNo < (s32)m_broken_text.size() - 1) - { - s32 cp = m_cursor_pos - m_broken_text_positions[lineNo]; + s32 mb = (m_mark_begin == m_mark_end) + ? m_cursor_pos + : (m_mark_begin < m_mark_end ? m_mark_begin + : m_mark_end); + if (lineNo < (s32)m_broken_text.size() - 1) { + s32 cp = m_cursor_pos - + m_broken_text_positions[lineNo]; if ((s32)m_broken_text[lineNo + 1].size() < cp) - m_cursor_pos = m_broken_text_positions[lineNo + 1] + core::max_((u32)1, m_broken_text[lineNo + 1].size()) - 1; + m_cursor_pos = m_broken_text_positions + [lineNo + 1] + + core::max_((u32)1, + m_broken_text[lineNo + + 1] + .size()) - + 1; else - m_cursor_pos = m_broken_text_positions[lineNo + 1] + cp; + m_cursor_pos = m_broken_text_positions + [lineNo + 1] + + cp; } if (event.KeyInput.Shift) { @@ -537,11 +568,18 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) if (m_mark_begin != m_mark_end) { // delete marked text - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + const s32 realmbgn = + m_mark_begin < m_mark_end + ? m_mark_begin + : m_mark_end; + const s32 realmend = + m_mark_begin < m_mark_end + ? m_mark_end + : m_mark_begin; s = Text.subString(0, realmbgn); - s.append(Text.subString(realmend, Text.size() - realmend)); + s.append(Text.subString(realmend, + Text.size() - realmend)); Text = s; m_cursor_pos = realmbgn; @@ -551,14 +589,16 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) s = Text.subString(0, m_cursor_pos - 1); else s = L""; - s.append(Text.subString(m_cursor_pos, Text.size() - m_cursor_pos)); + s.append(Text.subString(m_cursor_pos, + Text.size() - m_cursor_pos)); Text = s; --m_cursor_pos; } if (m_cursor_pos < 0) m_cursor_pos = 0; - m_blink_start_time = porting::getTimeMs(); // os::Timer::getTime(); + m_blink_start_time = porting:: + getTimeMs(); // os::Timer::getTime(); new_mark_begin = 0; new_mark_end = 0; text_changed = true; @@ -573,25 +613,34 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) if (m_mark_begin != m_mark_end) { // delete marked text - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + const s32 realmbgn = + m_mark_begin < m_mark_end + ? m_mark_begin + : m_mark_end; + const s32 realmend = + m_mark_begin < m_mark_end + ? m_mark_end + : m_mark_begin; s = Text.subString(0, realmbgn); - s.append(Text.subString(realmend, Text.size() - realmend)); + s.append(Text.subString(realmend, + Text.size() - realmend)); Text = s; m_cursor_pos = realmbgn; } else { // delete text before cursor s = Text.subString(0, m_cursor_pos); - s.append(Text.subString(m_cursor_pos + 1, Text.size() - m_cursor_pos - 1)); + s.append(Text.subString(m_cursor_pos + 1, + Text.size() - m_cursor_pos - 1)); Text = s; } if (m_cursor_pos > (s32)Text.size()) m_cursor_pos = (s32)Text.size(); - m_blink_start_time = porting::getTimeMs(); // os::Timer::getTime(); + m_blink_start_time = porting:: + getTimeMs(); // os::Timer::getTime(); new_mark_begin = 0; new_mark_end = 0; text_changed = true; @@ -641,16 +690,13 @@ bool GUIEditBoxWithScrollBar::processKey(const SEvent& event) breakText(); calculateScrollPos(); sendGuiEvent(EGET_EDITBOX_CHANGED); - } - else - { + } else { calculateScrollPos(); } return true; } - //! draws the element and its children void GUIEditBoxWithScrollBar::draw() { @@ -659,7 +705,7 @@ void GUIEditBoxWithScrollBar::draw() const bool focus = Environment->hasFocus(this); - IGUISkin* skin = Environment->getSkin(); + IGUISkin *skin = Environment->getSkin(); if (!skin) return; @@ -670,7 +716,8 @@ void GUIEditBoxWithScrollBar::draw() bg_color = m_bg_color_used ? m_bg_color : default_bg_color; if (!m_border && m_background) { - skin->draw2DRectangle(this, bg_color, AbsoluteRect, &AbsoluteClippingRect); + skin->draw2DRectangle( + this, bg_color, AbsoluteRect, &AbsoluteClippingRect); } // draw the border @@ -679,7 +726,7 @@ void GUIEditBoxWithScrollBar::draw() if (m_writable) { skin->draw3DSunkenPane(this, bg_color, false, m_background, - AbsoluteRect, &AbsoluteClippingRect); + AbsoluteRect, &AbsoluteClippingRect); } calculateFrameRect(); @@ -690,7 +737,7 @@ void GUIEditBoxWithScrollBar::draw() // draw the text - IGUIFont* font = getActiveFont(); + IGUIFont *font = getActiveFont(); s32 cursor_line = 0; s32 charcursorpos = 0; @@ -709,10 +756,13 @@ void GUIEditBoxWithScrollBar::draw() // get mark position const bool ml = (!m_passwordbox && (m_word_wrap || m_multiline)); - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + const s32 realmbgn = + m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; + const s32 realmend = + m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; const s32 hline_start = ml ? getLineFromPos(realmbgn) : 0; - const s32 hline_count = ml ? getLineFromPos(realmend) - hline_start + 1 : 1; + const s32 hline_count = + ml ? getLineFromPos(realmend) - hline_start + 1 : 1; const s32 line_count = ml ? m_broken_text.size() : 1; // Save the override color information. @@ -729,7 +779,8 @@ void GUIEditBoxWithScrollBar::draw() for (s32 i = 0; i < line_count; ++i) { setTextRect(i); - // clipping test - don't draw anything outside the visible area + // clipping test - don't draw anything outside the visible + // area core::rect<s32> c = local_clip_rect; c.clipAgainst(m_current_text_rect); if (!c.isValid()) @@ -741,11 +792,11 @@ void GUIEditBoxWithScrollBar::draw() m_broken_text.clear(); m_broken_text.emplace_back(); } - if (m_broken_text[0].size() != Text.size()){ + if (m_broken_text[0].size() != Text.size()) { m_broken_text[0] = Text; - for (u32 q = 0; q < Text.size(); ++q) - { - m_broken_text[0][q] = m_passwordchar; + for (u32 q = 0; q < Text.size(); ++q) { + m_broken_text[0][q] = + m_passwordchar; } } txt_line = &m_broken_text[0]; @@ -755,55 +806,77 @@ void GUIEditBoxWithScrollBar::draw() start_pos = ml ? m_broken_text_positions[i] : 0; } - // draw normal text font->draw(txt_line->c_str(), m_current_text_rect, - m_override_color_enabled ? m_override_color : skin->getColor(EGDC_BUTTON_TEXT), - false, true, &local_clip_rect); + m_override_color_enabled + ? m_override_color + : skin->getColor(EGDC_BUTTON_TEXT), + false, true, &local_clip_rect); // draw mark and marked text - if (focus && m_mark_begin != m_mark_end && i >= hline_start && i < hline_start + hline_count) { + if (focus && m_mark_begin != m_mark_end && + i >= hline_start && + i < hline_start + hline_count) { s32 mbegin = 0, mend = 0; - s32 lineStartPos = 0, lineEndPos = txt_line->size(); + s32 lineStartPos = 0, + lineEndPos = txt_line->size(); if (i == hline_start) { // highlight start is on this line - s = txt_line->subString(0, realmbgn - start_pos); - mbegin = font->getDimension(s.c_str()).Width; + s = txt_line->subString( + 0, realmbgn - start_pos); + mbegin = font->getDimension(s.c_str()) + .Width; // deal with kerning mbegin += font->getKerningWidth( - &((*txt_line)[realmbgn - start_pos]), - realmbgn - start_pos > 0 ? &((*txt_line)[realmbgn - start_pos - 1]) : 0); + &((*txt_line)[realmbgn - + start_pos]), + realmbgn - start_pos > 0 + ? &((*txt_line)[realmbgn - + start_pos - + 1]) + : 0); lineStartPos = realmbgn - start_pos; } if (i == hline_start + hline_count - 1) { // highlight end is on this line - s2 = txt_line->subString(0, realmend - start_pos); - mend = font->getDimension(s2.c_str()).Width; + s2 = txt_line->subString( + 0, realmend - start_pos); + mend = font->getDimension(s2.c_str()) + .Width; lineEndPos = (s32)s2.size(); } else { - mend = font->getDimension(txt_line->c_str()).Width; + mend = font->getDimension(txt_line->c_str()) + .Width; } - m_current_text_rect.UpperLeftCorner.X += mbegin; - m_current_text_rect.LowerRightCorner.X = m_current_text_rect.UpperLeftCorner.X + mend - mbegin; - + m_current_text_rect.LowerRightCorner.X = + m_current_text_rect + .UpperLeftCorner + .X + + mend - mbegin; // draw mark - skin->draw2DRectangle(this, skin->getColor(EGDC_HIGH_LIGHT), m_current_text_rect, &local_clip_rect); + skin->draw2DRectangle(this, + skin->getColor(EGDC_HIGH_LIGHT), + m_current_text_rect, + &local_clip_rect); // draw marked text - s = txt_line->subString(lineStartPos, lineEndPos - lineStartPos); + s = txt_line->subString(lineStartPos, + lineEndPos - lineStartPos); if (s.size()) font->draw(s.c_str(), m_current_text_rect, - m_override_color_enabled ? m_override_color : skin->getColor(EGDC_HIGH_LIGHT_TEXT), - false, true, &local_clip_rect); - + m_override_color_enabled + ? m_override_color + : skin->getColor(EGDC_HIGH_LIGHT_TEXT), + false, true, + &local_clip_rect); } } @@ -821,15 +894,23 @@ void GUIEditBoxWithScrollBar::draw() } s = txt_line->subString(0, m_cursor_pos - start_pos); charcursorpos = font->getDimension(s.c_str()).Width + - font->getKerningWidth(L"_", m_cursor_pos - start_pos > 0 ? &((*txt_line)[m_cursor_pos - start_pos - 1]) : 0); - - if (focus && (porting::getTimeMs() - m_blink_start_time) % 700 < 350) { + font->getKerningWidth(L"_", + m_cursor_pos - start_pos > 0 + ? &((*txt_line)[m_cursor_pos - + start_pos - + 1]) + : 0); + + if (focus && (porting::getTimeMs() - m_blink_start_time) % 700 < + 350) { setTextRect(cursor_line); m_current_text_rect.UpperLeftCorner.X += charcursorpos; font->draw(L"_", m_current_text_rect, - m_override_color_enabled ? m_override_color : skin->getColor(EGDC_BUTTON_TEXT), - false, true, &local_clip_rect); + m_override_color_enabled + ? m_override_color + : skin->getColor(EGDC_BUTTON_TEXT), + false, true, &local_clip_rect); } } } @@ -838,9 +919,8 @@ void GUIEditBoxWithScrollBar::draw() IGUIElement::draw(); } - //! Sets the new caption of this element. -void GUIEditBoxWithScrollBar::setText(const wchar_t* text) +void GUIEditBoxWithScrollBar::setText(const wchar_t *text) { Text = text; if (u32(m_cursor_pos) > Text.size()) @@ -849,7 +929,6 @@ void GUIEditBoxWithScrollBar::setText(const wchar_t* text) breakText(); } - //! Enables or disables automatic scrolling with cursor position //! \param enable: If set to true, the text will move around with the cursor position void GUIEditBoxWithScrollBar::setAutoScroll(bool enable) @@ -857,7 +936,6 @@ void GUIEditBoxWithScrollBar::setAutoScroll(bool enable) m_autoscroll = enable; } - //! Checks to see if automatic scrolling is enabled //! \return true if automatic scrolling is enabled, false if not bool GUIEditBoxWithScrollBar::isAutoScrollEnabled() const @@ -865,7 +943,6 @@ bool GUIEditBoxWithScrollBar::isAutoScrollEnabled() const return m_autoscroll; } - //! Gets the area of the text in the edit box //! \return Returns the size in pixels of the text core::dimension2du GUIEditBoxWithScrollBar::getTextDimension() @@ -884,7 +961,6 @@ core::dimension2du GUIEditBoxWithScrollBar::getTextDimension() return core::dimension2du(ret.getSize()); } - //! Sets the maximum amount of characters which may be entered in the box. //! \param max: Maximum amount of characters. If 0, the character amount is //! infinity. @@ -896,21 +972,19 @@ void GUIEditBoxWithScrollBar::setMax(u32 max) Text = Text.subString(0, m_max); } - //! Returns maximum amount of characters, previously set by setMax(); u32 GUIEditBoxWithScrollBar::getMax() const { return m_max; } - -bool GUIEditBoxWithScrollBar::processMouse(const SEvent& event) +bool GUIEditBoxWithScrollBar::processMouse(const SEvent &event) { - switch (event.MouseInput.Event) - { + switch (event.MouseInput.Event) { case irr::EMIE_LMOUSE_LEFT_UP: if (Environment->hasFocus(this)) { - m_cursor_pos = getCursorPos(event.MouseInput.X, event.MouseInput.Y); + m_cursor_pos = getCursorPos( + event.MouseInput.X, event.MouseInput.Y); if (m_mouse_marking) { setTextMarkers(m_mark_begin, m_cursor_pos); } @@ -919,32 +993,33 @@ bool GUIEditBoxWithScrollBar::processMouse(const SEvent& event) return true; } break; - case irr::EMIE_MOUSE_MOVED: - { + case irr::EMIE_MOUSE_MOVED: { if (m_mouse_marking) { - m_cursor_pos = getCursorPos(event.MouseInput.X, event.MouseInput.Y); + m_cursor_pos = getCursorPos( + event.MouseInput.X, event.MouseInput.Y); setTextMarkers(m_mark_begin, m_cursor_pos); calculateScrollPos(); return true; } - } - break; + } break; case EMIE_LMOUSE_PRESSED_DOWN: if (!Environment->hasFocus(this)) { m_blink_start_time = porting::getTimeMs(); m_mouse_marking = true; - m_cursor_pos = getCursorPos(event.MouseInput.X, event.MouseInput.Y); + m_cursor_pos = getCursorPos( + event.MouseInput.X, event.MouseInput.Y); setTextMarkers(m_cursor_pos, m_cursor_pos); calculateScrollPos(); return true; } else { - if (!AbsoluteClippingRect.isPointInside( - core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y))) { + if (!AbsoluteClippingRect.isPointInside(core::position2d<s32>( + event.MouseInput.X, event.MouseInput.Y))) { return false; } else { // move cursor - m_cursor_pos = getCursorPos(event.MouseInput.X, event.MouseInput.Y); + m_cursor_pos = getCursorPos( + event.MouseInput.X, event.MouseInput.Y); s32 newMarkBegin = m_mark_begin; if (!m_mouse_marking) @@ -963,10 +1038,9 @@ bool GUIEditBoxWithScrollBar::processMouse(const SEvent& event) return false; } - s32 GUIEditBoxWithScrollBar::getCursorPos(s32 x, s32 y) { - IGUIFont* font = getActiveFont(); + IGUIFont *font = getActiveFont(); const u32 line_count = (m_word_wrap || m_multiline) ? m_broken_text.size() : 1; @@ -982,10 +1056,14 @@ s32 GUIEditBoxWithScrollBar::getCursorPos(s32 x, s32 y) y = m_current_text_rect.LowerRightCorner.Y; // is it inside this region? - if (y >= m_current_text_rect.UpperLeftCorner.Y && y <= m_current_text_rect.LowerRightCorner.Y) { + if (y >= m_current_text_rect.UpperLeftCorner.Y && + y <= m_current_text_rect.LowerRightCorner.Y) { // we've found the clicked line - txt_line = (m_word_wrap || m_multiline) ? &m_broken_text[i] : &Text; - start_pos = (m_word_wrap || m_multiline) ? m_broken_text_positions[i] : 0; + txt_line = (m_word_wrap || m_multiline) ? &m_broken_text[i] + : &Text; + start_pos = (m_word_wrap || m_multiline) + ? m_broken_text_positions[i] + : 0; break; } } @@ -996,7 +1074,8 @@ s32 GUIEditBoxWithScrollBar::getCursorPos(s32 x, s32 y) if (!txt_line) return 0; - s32 idx = font->getCharacterFromPos(txt_line->c_str(), x - m_current_text_rect.UpperLeftCorner.X); + s32 idx = font->getCharacterFromPos( + txt_line->c_str(), x - m_current_text_rect.UpperLeftCorner.X); // click was on or left of the line if (idx != -1) @@ -1006,7 +1085,6 @@ s32 GUIEditBoxWithScrollBar::getCursorPos(s32 x, s32 y) return txt_line->size() + start_pos; } - //! Breaks the single text line. void GUIEditBoxWithScrollBar::breakText() { @@ -1016,7 +1094,7 @@ void GUIEditBoxWithScrollBar::breakText() m_broken_text.clear(); // need to reallocate :/ m_broken_text_positions.clear(); - IGUIFont* font = getActiveFont(); + IGUIFont *font = getActiveFont(); if (!font) return; @@ -1040,9 +1118,11 @@ void GUIEditBoxWithScrollBar::breakText() line_break = true; c = 0; if (Text[i + 1] == L'\n') { // Windows breaks - // TODO: I (Michael) think that we shouldn't change the text given by the user for whatever reason. - // Instead rework the cursor positioning to be able to handle this (but not in stable release - // branch as users might already expect this behavior). + // TODO: I (Michael) think that we shouldn't change the + // text given by the user for whatever reason. Instead + // rework the cursor positioning to be able to handle this + // (but not in stable release branch as users might + // already expect this behavior). Text.erase(i + 1); --size; if (m_cursor_pos > i) @@ -1060,11 +1140,13 @@ void GUIEditBoxWithScrollBar::breakText() if (c == L' ' || c == 0 || i == (size - 1)) { // here comes the next whitespace, look if // we can break the last word to the next line - // We also break whitespace, otherwise cursor would vanish beside the right border. + // We also break whitespace, otherwise cursor would vanish beside + // the right border. s32 whitelgth = font->getDimension(whitespace.c_str()).Width; s32 worldlgth = font->getDimension(word.c_str()).Width; - if (m_word_wrap && length + worldlgth + whitelgth > el_width && line.size() > 0) { + if (m_word_wrap && length + worldlgth + whitelgth > el_width && + line.size() > 0) { // break to next line length = worldlgth; m_broken_text.push_back(line); @@ -1081,7 +1163,6 @@ void GUIEditBoxWithScrollBar::breakText() word = L""; whitespace = L""; - if (c) whitespace += c; @@ -1121,7 +1202,7 @@ void GUIEditBoxWithScrollBar::setTextRect(s32 line) if (line < 0) return; - IGUIFont* font = getActiveFont(); + IGUIFont *font = getActiveFont(); if (!font) return; @@ -1141,8 +1222,10 @@ void GUIEditBoxWithScrollBar::setTextRect(s32 line) switch (m_halign) { case EGUIA_CENTER: // align to h centre - m_current_text_rect.UpperLeftCorner.X = (m_frame_rect.getWidth() / 2) - (d.Width / 2); - m_current_text_rect.LowerRightCorner.X = (m_frame_rect.getWidth() / 2) + (d.Width / 2); + m_current_text_rect.UpperLeftCorner.X = + (m_frame_rect.getWidth() / 2) - (d.Width / 2); + m_current_text_rect.LowerRightCorner.X = + (m_frame_rect.getWidth() / 2) + (d.Width / 2); break; case EGUIA_LOWERRIGHT: // align to right edge @@ -1153,35 +1236,36 @@ void GUIEditBoxWithScrollBar::setTextRect(s32 line) // align to left edge m_current_text_rect.UpperLeftCorner.X = 0; m_current_text_rect.LowerRightCorner.X = d.Width; - } switch (m_valign) { case EGUIA_CENTER: // align to v centre - m_current_text_rect.UpperLeftCorner.Y = - (m_frame_rect.getHeight() / 2) - (line_count*d.Height) / 2 + d.Height*line; + m_current_text_rect.UpperLeftCorner.Y = (m_frame_rect.getHeight() / 2) - + (line_count * d.Height) / 2 + + d.Height * line; break; case EGUIA_LOWERRIGHT: // align to bottom edge - m_current_text_rect.UpperLeftCorner.Y = - m_frame_rect.getHeight() - line_count*d.Height + d.Height*line; + m_current_text_rect.UpperLeftCorner.Y = m_frame_rect.getHeight() - + line_count * d.Height + + d.Height * line; break; default: // align to top edge - m_current_text_rect.UpperLeftCorner.Y = d.Height*line; + m_current_text_rect.UpperLeftCorner.Y = d.Height * line; break; } m_current_text_rect.UpperLeftCorner.X -= m_hscroll_pos; m_current_text_rect.LowerRightCorner.X -= m_hscroll_pos; m_current_text_rect.UpperLeftCorner.Y -= m_vscroll_pos; - m_current_text_rect.LowerRightCorner.Y = m_current_text_rect.UpperLeftCorner.Y + d.Height; + m_current_text_rect.LowerRightCorner.Y = + m_current_text_rect.UpperLeftCorner.Y + d.Height; m_current_text_rect += m_frame_rect.UpperLeftCorner; } - s32 GUIEditBoxWithScrollBar::getLineFromPos(s32 pos) { if (!m_word_wrap && !m_multiline) @@ -1196,31 +1280,36 @@ s32 GUIEditBoxWithScrollBar::getLineFromPos(s32 pos) return (s32)m_broken_text_positions.size() - 1; } - void GUIEditBoxWithScrollBar::inputChar(wchar_t c) { if (!isEnabled()) return; - if (c != 0) { + if (c != 0) { if (Text.size() < m_max || m_max == 0) { core::stringw s; if (m_mark_begin != m_mark_end) { // replace marked text - const s32 realmbgn = m_mark_begin < m_mark_end ? m_mark_begin : m_mark_end; - const s32 realmend = m_mark_begin < m_mark_end ? m_mark_end : m_mark_begin; + const s32 realmbgn = m_mark_begin < m_mark_end + ? m_mark_begin + : m_mark_end; + const s32 realmend = m_mark_begin < m_mark_end + ? m_mark_end + : m_mark_begin; s = Text.subString(0, realmbgn); s.append(c); - s.append(Text.subString(realmend, Text.size() - realmend)); + s.append(Text.subString( + realmend, Text.size() - realmend)); Text = s; m_cursor_pos = realmbgn + 1; } else { // add new character s = Text.subString(0, m_cursor_pos); s.append(c); - s.append(Text.subString(m_cursor_pos, Text.size() - m_cursor_pos)); + s.append(Text.subString(m_cursor_pos, + Text.size() - m_cursor_pos)); Text = s; ++m_cursor_pos; } @@ -1240,10 +1329,10 @@ void GUIEditBoxWithScrollBar::calculateScrollPos() if (!m_autoscroll) return; - IGUISkin* skin = Environment->getSkin(); + IGUISkin *skin = Environment->getSkin(); if (!skin) return; - IGUIFont* font = m_override_font ? m_override_font : skin->getFont(); + IGUIFont *font = m_override_font ? m_override_font : skin->getFont(); if (!font) return; @@ -1254,46 +1343,59 @@ void GUIEditBoxWithScrollBar::calculateScrollPos() const bool has_broken_text = m_multiline || m_word_wrap; // Check horizonal scrolling - // NOTE: Calculations different to vertical scrolling because setTextRect interprets VAlign relative to line but HAlign not relative to row + // NOTE: Calculations different to vertical scrolling because setTextRect + // interprets VAlign relative to line but HAlign not relative to row { // get cursor position - IGUIFont* font = getActiveFont(); + IGUIFont *font = getActiveFont(); if (!font) return; // get cursor area irr::u32 cursor_width = font->getDimension(L"_").Width; - core::stringw *txt_line = has_broken_text ? &m_broken_text[curs_line] : &Text; - s32 cpos = has_broken_text ? m_cursor_pos - m_broken_text_positions[curs_line] : m_cursor_pos; // column - s32 cstart = font->getDimension(txt_line->subString(0, cpos).c_str()).Width; // pixels from text-start + core::stringw *txt_line = + has_broken_text ? &m_broken_text[curs_line] : &Text; + s32 cpos = has_broken_text ? m_cursor_pos - m_broken_text_positions + [curs_line] + : m_cursor_pos; // column + s32 cstart = font->getDimension(txt_line->subString(0, cpos).c_str()) + .Width; // pixels from text-start s32 cend = cstart + cursor_width; s32 txt_width = font->getDimension(txt_line->c_str()).Width; if (txt_width < m_frame_rect.getWidth()) { - // TODO: Needs a clean left and right gap removal depending on HAlign, similar to vertical scrolling tests for top/bottom. - // This check just fixes the case where it was most noticable (text smaller than clipping area). + // TODO: Needs a clean left and right gap removal depending on + // HAlign, similar to vertical scrolling tests for top/bottom. + // This check just fixes the case where it was most noticable + // (text smaller than clipping area). m_hscroll_pos = 0; setTextRect(curs_line); } - if (m_current_text_rect.UpperLeftCorner.X + cstart < m_frame_rect.UpperLeftCorner.X) { + if (m_current_text_rect.UpperLeftCorner.X + cstart < + m_frame_rect.UpperLeftCorner.X) { // cursor to the left of the clipping area - m_hscroll_pos -= m_frame_rect.UpperLeftCorner.X - (m_current_text_rect.UpperLeftCorner.X + cstart); + m_hscroll_pos -= m_frame_rect.UpperLeftCorner.X - + (m_current_text_rect.UpperLeftCorner.X + cstart); setTextRect(curs_line); - // TODO: should show more characters to the left when we're scrolling left + // TODO: should show more characters to the left when we're + // scrolling left // and the cursor reaches the border. - } else if (m_current_text_rect.UpperLeftCorner.X + cend > m_frame_rect.LowerRightCorner.X) { + } else if (m_current_text_rect.UpperLeftCorner.X + cend > + m_frame_rect.LowerRightCorner.X) { // cursor to the right of the clipping area - m_hscroll_pos += (m_current_text_rect.UpperLeftCorner.X + cend) - m_frame_rect.LowerRightCorner.X; + m_hscroll_pos += (m_current_text_rect.UpperLeftCorner.X + cend) - + m_frame_rect.LowerRightCorner.X; setTextRect(curs_line); } } // calculate vertical scrolling if (has_broken_text) { - irr::u32 line_height = font->getDimension(L"A").Height + font->getKerningHeight(); + irr::u32 line_height = font->getDimension(L"A").Height + + font->getKerningHeight(); // only up to 1 line fits? if (line_height >= (irr::u32)m_frame_rect.getHeight()) { m_vscroll_pos = 0; @@ -1317,27 +1419,39 @@ void GUIEditBoxWithScrollBar::calculateScrollPos() } else { // First 2 checks are necessary when people delete lines setTextRect(0); - if (m_current_text_rect.UpperLeftCorner.Y > m_frame_rect.UpperLeftCorner.Y && m_valign != EGUIA_LOWERRIGHT) { + if (m_current_text_rect.UpperLeftCorner.Y > + m_frame_rect.UpperLeftCorner.Y && + m_valign != EGUIA_LOWERRIGHT) { // first line is leaving a gap on top m_vscroll_pos = 0; } else if (m_valign != EGUIA_UPPERLEFT) { - u32 lastLine = m_broken_text_positions.empty() ? 0 : m_broken_text_positions.size() - 1; + u32 lastLine = m_broken_text_positions.empty() + ? 0 + : m_broken_text_positions.size() - + 1; setTextRect(lastLine); - if (m_current_text_rect.LowerRightCorner.Y < m_frame_rect.LowerRightCorner.Y) - { + if (m_current_text_rect.LowerRightCorner.Y < + m_frame_rect.LowerRightCorner.Y) { // last line is leaving a gap on bottom - m_vscroll_pos -= m_frame_rect.LowerRightCorner.Y - m_current_text_rect.LowerRightCorner.Y; + m_vscroll_pos -= m_frame_rect.LowerRightCorner.Y - + m_current_text_rect + .LowerRightCorner + .Y; } } setTextRect(curs_line); - if (m_current_text_rect.UpperLeftCorner.Y < m_frame_rect.UpperLeftCorner.Y) { + if (m_current_text_rect.UpperLeftCorner.Y < + m_frame_rect.UpperLeftCorner.Y) { // text above valid area - m_vscroll_pos -= m_frame_rect.UpperLeftCorner.Y - m_current_text_rect.UpperLeftCorner.Y; + m_vscroll_pos -= m_frame_rect.UpperLeftCorner.Y - + m_current_text_rect.UpperLeftCorner.Y; setTextRect(curs_line); - } else if (m_current_text_rect.LowerRightCorner.Y > m_frame_rect.LowerRightCorner.Y){ + } else if (m_current_text_rect.LowerRightCorner.Y > + m_frame_rect.LowerRightCorner.Y) { // text below valid area - m_vscroll_pos += m_current_text_rect.LowerRightCorner.Y - m_frame_rect.LowerRightCorner.Y; + m_vscroll_pos += m_current_text_rect.LowerRightCorner.Y - + m_frame_rect.LowerRightCorner.Y; setTextRect(curs_line); } } @@ -1352,15 +1466,16 @@ void GUIEditBoxWithScrollBar::calculateFrameRect() { m_frame_rect = AbsoluteRect; - IGUISkin *skin = 0; if (Environment) skin = Environment->getSkin(); if (m_border && skin) { m_frame_rect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X) + 1; m_frame_rect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y) + 1; - m_frame_rect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X) + 1; - m_frame_rect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y) + 1; + m_frame_rect.LowerRightCorner.X -= + skin->getSize(EGDS_TEXT_DISTANCE_X) + 1; + m_frame_rect.LowerRightCorner.Y -= + skin->getSize(EGDS_TEXT_DISTANCE_Y) + 1; } updateVScrollBar(); @@ -1403,8 +1518,8 @@ void GUIEditBoxWithScrollBar::createVScrollBar() irr::core::rect<s32> scrollbarrect = m_frame_rect; scrollbarrect.UpperLeftCorner.X += m_frame_rect.getWidth() - m_scrollbar_width; - m_vscrollbar = new GUIScrollBar(Environment, getParent(), -1, - scrollbarrect, false, true); + m_vscrollbar = new GUIScrollBar( + Environment, getParent(), -1, scrollbarrect, false, true); m_vscrollbar->setVisible(false); m_vscrollbar->setSmallStep(1); @@ -1436,7 +1551,7 @@ void GUIEditBoxWithScrollBar::updateVScrollBar() } // check if a vertical scrollbar is needed ? - if (getTextDimension().Height > (u32) m_frame_rect.getHeight()) { + if (getTextDimension().Height > (u32)m_frame_rect.getHeight()) { m_frame_rect.LowerRightCorner.X -= m_scrollbar_width; s32 scrollymax = getTextDimension().Height - m_frame_rect.getHeight(); @@ -1449,8 +1564,7 @@ void GUIEditBoxWithScrollBar::updateVScrollBar() m_vscrollbar->setVisible(true); } } else { - if (m_vscrollbar->isVisible()) - { + if (m_vscrollbar->isVisible()) { m_vscrollbar->setVisible(false); m_vscroll_pos = 0; m_vscrollbar->setPos(0); @@ -1458,7 +1572,6 @@ void GUIEditBoxWithScrollBar::updateVScrollBar() m_vscrollbar->setPageSize(s32(getTextDimension().Height)); } } - } //! set true if this editbox is writable @@ -1475,7 +1588,8 @@ void GUIEditBoxWithScrollBar::setBackgroundColor(const video::SColor &bg_color) } //! Writes attributes of the element. -void GUIEditBoxWithScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options = 0) const +void GUIEditBoxWithScrollBar::serializeAttributes( + io::IAttributes *out, io::SAttributeReadWriteOptions *options = 0) const { // IGUIEditBox::serializeAttributes(out,options); @@ -1499,9 +1613,9 @@ void GUIEditBoxWithScrollBar::serializeAttributes(io::IAttributes* out, io::SAtt IGUIEditBox::serializeAttributes(out, options); } - //! Reads attributes of the element -void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options = 0) +void GUIEditBoxWithScrollBar::deserializeAttributes( + io::IAttributes *in, io::SAttributeReadWriteOptions *options = 0) { IGUIEditBox::deserializeAttributes(in, options); @@ -1520,16 +1634,34 @@ void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAt else setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]); - setTextAlignment((EGUI_ALIGNMENT)in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames), - (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames)); + setTextAlignment((EGUI_ALIGNMENT)in->getAttributeAsEnumeration( + "HTextAlign", GUIAlignmentNames), + (EGUI_ALIGNMENT)in->getAttributeAsEnumeration( + "VTextAlign", GUIAlignmentNames)); // setOverrideFont(in->getAttributeAsFont("OverrideFont")); setWritable(in->getAttributeAsBool("Writable")); } -bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; } -bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; } -void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { } -wchar_t GUIEditBoxWithScrollBar::getCursorChar() const { return '|'; } -void GUIEditBoxWithScrollBar::setCursorBlinkTime(irr::u32 timeMs) { } -irr::u32 GUIEditBoxWithScrollBar::getCursorBlinkTime() const { return 500; } +bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const +{ + return false; +} +bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const +{ + return false; +} +void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) +{ +} +wchar_t GUIEditBoxWithScrollBar::getCursorChar() const +{ + return '|'; +} +void GUIEditBoxWithScrollBar::setCursorBlinkTime(irr::u32 timeMs) +{ +} +irr::u32 GUIEditBoxWithScrollBar::getCursorBlinkTime() const +{ + return 500; +} |