Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
GUIEditBoxWithScrollBar Class Reference

#include <guiEditBoxWithScrollbar.h>

+ Inheritance diagram for GUIEditBoxWithScrollBar:
+ Collaboration diagram for GUIEditBoxWithScrollBar:

Public Member Functions

 GUIEditBoxWithScrollBar (const wchar_t *text, bool border, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle, ISimpleTextureSource *tsrc, bool writable=true, bool has_vscrollbar=true)
 constructor
 
virtual ~GUIEditBoxWithScrollBar ()
 destructor
 
virtual void setDrawBackground (bool draw)
 Sets whether to draw the background.
 
virtual void draw ()
 draws the element and its children
 
virtual void updateAbsolutePosition ()
 Updates the absolute position, splits text if required.
 
virtual void setBackgroundColor (const video::SColor &bg_color)
 Change the background color.
 
virtual bool isDrawBackgroundEnabled () const
 
virtual bool isDrawBorderEnabled () const
 
virtual void setCursorChar (const wchar_t cursorChar)
 
virtual wchar_t getCursorChar () const
 
virtual void setCursorBlinkTime (irr::u32 timeMs)
 
virtual irr::u32 getCursorBlinkTime () const
 
- Public Member Functions inherited from GUIEditBox
 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 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 ()
 Breaks the single text line.
 
virtual void setTextRect (s32 line)
 sets the area of the given line
 
void calculateScrollPos ()
 calculates the current scroll position
 
void calculateFrameRect ()
 calculated the FrameRect
 
void createVScrollBar ()
 create a Vertical ScrollBar
 
s32 getCursorPos (s32 x, s32 y)
 
- Protected Member Functions inherited from GUIEditBox
void setTextMarkers (s32 begin, s32 end)
 set text markers
 
void sendGuiEvent (EGUI_EVENT_TYPE type)
 send some gui event to parent
 
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

bool m_background
 
bool m_bg_color_used
 
video::SColor m_bg_color
 
ISimpleTextureSourcem_tsrc
 
- Protected Attributes inherited from GUIEditBox
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
 
GUIScrollBarm_vscrollbar = nullptr
 

Constructor & Destructor Documentation

◆ GUIEditBoxWithScrollBar()

GUIEditBoxWithScrollBar::GUIEditBoxWithScrollBar ( const wchar_t * text,
bool border,
IGUIEnvironment * environment,
IGUIElement * parent,
s32 id,
const core::rect< s32 > & rectangle,
ISimpleTextureSource * tsrc,
bool writable = true,
bool has_vscrollbar = true )

constructor

References breakText(), calculateFrameRect(), calculateScrollPos(), createVScrollBar(), GUIEditBox::m_operator, and GUIEditBox::setWritable().

+ Here is the call graph for this function:

◆ ~GUIEditBoxWithScrollBar()

virtual GUIEditBoxWithScrollBar::~GUIEditBoxWithScrollBar ( )
inlinevirtual

destructor

Member Function Documentation

◆ breakText()

void GUIEditBoxWithScrollBar::breakText ( )
protectedvirtual

Breaks the single text line.

Implements GUIEditBox.

References GUIEditBox::getActiveFont(), GUIEditBox::m_broken_text, GUIEditBox::m_broken_text_positions, GUIEditBox::m_cursor_pos, GUIEditBox::m_last_break_font, GUIEditBox::m_multiline, GUIEditBox::m_scrollbar_width, and GUIEditBox::m_word_wrap.

Referenced by GUIEditBoxWithScrollBar(), draw(), and updateAbsolutePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateFrameRect()

void GUIEditBoxWithScrollBar::calculateFrameRect ( )
protected

calculated the FrameRect

References GUIEditBox::m_border, GUIEditBox::m_frame_rect, and GUIEditBox::updateVScrollBar().

Referenced by GUIEditBoxWithScrollBar(), draw(), and updateAbsolutePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateScrollPos()

void GUIEditBoxWithScrollBar::calculateScrollPos ( )
protectedvirtual

calculates the current scroll position

Implements GUIEditBox.

References GUIEditBox::getActiveFont(), GUIEditBox::getLineFromPos(), GUIEditBox::m_autoscroll, GUIEditBox::m_broken_text, GUIEditBox::m_broken_text_positions, GUIEditBox::m_current_text_rect, GUIEditBox::m_cursor_pos, GUIEditBox::m_frame_rect, GUIEditBox::m_hscroll_pos, GUIEditBox::m_multiline, GUIEditBox::m_override_font, GUIEditBox::m_valign, GUIEditBox::m_vscroll_pos, GUIEditBox::m_vscrollbar, GUIEditBox::m_word_wrap, GUIScrollBar::setPos(), and setTextRect().

Referenced by GUIEditBoxWithScrollBar(), and updateAbsolutePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createVScrollBar()

void GUIEditBoxWithScrollBar::createVScrollBar ( )
protected

create a Vertical ScrollBar

create a vertical scroll bar

References GUIEditBox::m_frame_rect, GUIEditBox::m_override_font, GUIEditBox::m_scrollbar_width, m_tsrc, GUIEditBox::m_vscrollbar, GUIScrollBar::setLargeStep(), and GUIScrollBar::setSmallStep().

Referenced by GUIEditBoxWithScrollBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw()

void GUIEditBoxWithScrollBar::draw ( )
virtual

◆ getCursorBlinkTime()

irr::u32 GUIEditBoxWithScrollBar::getCursorBlinkTime ( ) const
virtual

◆ getCursorChar()

wchar_t GUIEditBoxWithScrollBar::getCursorChar ( ) const
virtual

◆ getCursorPos()

s32 GUIEditBoxWithScrollBar::getCursorPos ( s32 x,
s32 y )
protectedvirtual

Implements GUIEditBox.

References GUIEditBox::getActiveFont(), idx, GUIEditBox::m_broken_text, GUIEditBox::m_broken_text_positions, GUIEditBox::m_current_text_rect, GUIEditBox::m_multiline, GUIEditBox::m_word_wrap, and setTextRect().

+ Here is the call graph for this function:

◆ isDrawBackgroundEnabled()

bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled ( ) const
virtual

◆ isDrawBorderEnabled()

bool GUIEditBoxWithScrollBar::isDrawBorderEnabled ( ) const
virtual

Reimplemented from GUIEditBox.

◆ setBackgroundColor()

void GUIEditBoxWithScrollBar::setBackgroundColor ( const video::SColor & bg_color)
virtual

Change the background color.

References m_bg_color, and m_bg_color_used.

◆ setCursorBlinkTime()

void GUIEditBoxWithScrollBar::setCursorBlinkTime ( irr::u32 timeMs)
virtual

◆ setCursorChar()

void GUIEditBoxWithScrollBar::setCursorChar ( const wchar_t cursorChar)
virtual

◆ setDrawBackground()

void GUIEditBoxWithScrollBar::setDrawBackground ( bool draw)
virtual

Sets whether to draw the background.

References draw(), and m_background.

+ Here is the call graph for this function:

◆ setTextRect()

void GUIEditBoxWithScrollBar::setTextRect ( s32 line)
protectedvirtual

sets the area of the given line

Implements GUIEditBox.

References GUIEditBox::getActiveFont(), GUIEditBox::m_broken_text, GUIEditBox::m_current_text_rect, GUIEditBox::m_frame_rect, GUIEditBox::m_halign, GUIEditBox::m_hscroll_pos, GUIEditBox::m_multiline, GUIEditBox::m_valign, GUIEditBox::m_vscroll_pos, and GUIEditBox::m_word_wrap.

Referenced by calculateScrollPos(), draw(), and getCursorPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAbsolutePosition()

void GUIEditBoxWithScrollBar::updateAbsolutePosition ( )
virtual

Updates the absolute position, splits text if required.

References breakText(), calculateFrameRect(), and calculateScrollPos().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_background

bool GUIEditBoxWithScrollBar::m_background
protected

Referenced by draw(), and setDrawBackground().

◆ m_bg_color

video::SColor GUIEditBoxWithScrollBar::m_bg_color
protected

Referenced by draw(), and setBackgroundColor().

◆ m_bg_color_used

bool GUIEditBoxWithScrollBar::m_bg_color_used
protected

Referenced by draw(), and setBackgroundColor().

◆ m_tsrc

ISimpleTextureSource* GUIEditBoxWithScrollBar::m_tsrc
protected

Referenced by createVScrollBar().


The documentation for this class was generated from the following files: