Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
irr::gui::StaticText Class Reference

#include <static_text.h>

+ Inheritance diagram for irr::gui::StaticText:
+ Collaboration diagram for irr::gui::StaticText:

Public Member Functions

 StaticText (const EnrichedString &text, bool border, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle, bool background=false)
 constructor
 
virtual ~StaticText ()
 destructor
 
virtual void draw ()
 draws the element and its children
 
virtual void setOverrideFont (IGUIFont *font=0)
 Sets another skin independent font.
 
virtual IGUIFont * getOverrideFont () const
 Gets the override font (if any)
 
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 void setBackgroundColor (video::SColor color)
 Sets another color for the background.
 
virtual void setDrawBackground (bool draw)
 Sets whether to draw the background.
 
virtual video::SColor getBackgroundColor () const
 Gets the background color.
 
virtual bool isDrawBackgroundEnabled () const
 Checks if background drawing is enabled.
 
virtual void setDrawBorder (bool draw)
 Sets whether to draw the border.
 
virtual bool isDrawBorderEnabled () const
 Checks if border drawing is enabled.
 
virtual void setTextAlignment (EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
 Sets alignment mode for text.
 
virtual video::SColor getOverrideColor () const
 Gets the override color.
 
virtual video::SColor getActiveColor () const
 Gets the currently used text color.
 
virtual void enableOverrideColor (bool enable)
 Sets if the static text should use the overide color or the color in the gui skin.
 
virtual bool isOverrideColorEnabled () const
 Checks if an override color is enabled.
 
virtual void setTextRestrainedInside (bool restrainedInside)
 Set whether the text in this label should be clipped if it goes outside bounds.
 
virtual bool isTextRestrainedInside () const
 Checks if the text in this label should be clipped if it goes outside bounds.
 
virtual void setWordWrap (bool enable)
 Enables or disables word wrap for using the static text as multiline text control.
 
virtual bool isWordWrapEnabled () const
 Checks if word wrap is enabled.
 
virtual void setText (const wchar_t *text)
 Sets the new caption of this element.
 
virtual s32 getTextHeight () const
 Returns the height of the text in pixels when it is drawn.
 
virtual s32 getTextWidth () const
 Returns the width of the current text, in the current font.
 
virtual void updateAbsolutePosition ()
 Updates the absolute position, splits text if word wrap is enabled.
 
virtual void setRightToLeft (bool rtl)
 Set whether the string should be interpreted as right-to-left (RTL) text.
 
virtual bool isRightToLeft () const
 Checks if the text should be interpreted as right-to-left text.
 
virtual bool hasType (EGUI_ELEMENT_TYPE t) const
 
virtual bool hasType (EGUI_ELEMENT_TYPE t)
 
void setText (const EnrichedString &text)
 

Static Public Member Functions

static irr::gui::IGUIStaticText * add (irr::gui::IGUIEnvironment *guienv, const EnrichedString &text, const core::rect< s32 > &rectangle, bool border=false, bool wordWrap=true, irr::gui::IGUIElement *parent=NULL, s32 id=-1, bool fillBackground=false)
 
static irr::gui::IGUIStaticText * add (irr::gui::IGUIEnvironment *guienv, std::wstring_view text, const core::rect< s32 > &rectangle, bool border=false, bool wordWrap=true, irr::gui::IGUIElement *parent=NULL, s32 id=-1, bool fillBackground=false)
 

Private Member Functions

void updateText ()
 Breaks the single text line.
 

Private Attributes

EGUI_ALIGNMENT HAlign
 
EGUI_ALIGNMENT VAlign
 
bool Border
 
bool WordWrap
 
bool Background
 
bool RestrainTextInside
 
bool RightToLeft
 
gui::IGUIFont * OverrideFont
 
gui::IGUIFont * LastBreakFont
 
EnrichedString ColoredText
 
std::vector< EnrichedStringBrokenText
 

Constructor & Destructor Documentation

◆ StaticText()

irr::gui::StaticText::StaticText ( const EnrichedString & text,
bool border,
IGUIEnvironment * environment,
IGUIElement * parent,
s32 id,
const core::rect< s32 > & rectangle,
bool background = false )

constructor

References setText().

+ Here is the call graph for this function:

◆ ~StaticText()

irr::gui::StaticText::~StaticText ( )
virtual

destructor

References OverrideFont.

Member Function Documentation

◆ add() [1/2]

static irr::gui::IGUIStaticText * irr::gui::StaticText::add ( irr::gui::IGUIEnvironment * guienv,
const EnrichedString & text,
const core::rect< s32 > & rectangle,
bool border = false,
bool wordWrap = true,
irr::gui::IGUIElement * parent = NULL,
s32 id = -1,
bool fillBackground = false )
inlinestatic

◆ add() [2/2]

static irr::gui::IGUIStaticText * irr::gui::StaticText::add ( irr::gui::IGUIEnvironment * guienv,
std::wstring_view text,
const core::rect< s32 > & rectangle,
bool border = false,
bool wordWrap = true,
irr::gui::IGUIElement * parent = NULL,
s32 id = -1,
bool fillBackground = false )
inlinestatic

References add(), and guienv.

+ Here is the call graph for this function:

◆ draw()

void irr::gui::StaticText::draw ( )
virtual

draws the element and its children

References Background, Border, BrokenText, irr::gui::CGUITTFont::draw(), getActiveFont(), getBackgroundColor(), getTextWidth(), HAlign, LastBreakFont, RestrainTextInside, updateText(), VAlign, and WordWrap.

Referenced by setDrawBackground(), and setDrawBorder().

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

◆ enableOverrideColor()

void irr::gui::StaticText::enableOverrideColor ( bool enable)
virtual

Sets if the static text should use the overide color or the color in the gui skin.

◆ getActiveColor()

video::SColor irr::gui::StaticText::getActiveColor ( ) const
virtual

Gets the currently used text color.

References getOverrideColor().

+ Here is the call graph for this function:

◆ getActiveFont()

IGUIFont * irr::gui::StaticText::getActiveFont ( ) const
virtual

Get the font which is used right now for drawing.

References OverrideFont.

Referenced by draw(), getTextHeight(), getTextWidth(), and updateText().

+ Here is the caller graph for this function:

◆ getBackgroundColor()

video::SColor irr::gui::StaticText::getBackgroundColor ( ) const
virtual

Gets the background color.

References ColoredText, EnrichedString::getBackground(), and EnrichedString::hasBackground().

Referenced by draw().

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

◆ getOverrideColor()

video::SColor irr::gui::StaticText::getOverrideColor ( ) const
virtual

Gets the override color.

References ColoredText, and EnrichedString::getDefaultColor().

Referenced by getActiveColor(), and setText().

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

◆ getOverrideFont()

IGUIFont * irr::gui::StaticText::getOverrideFont ( ) const
virtual

Gets the override font (if any)

References OverrideFont.

◆ getTextHeight()

s32 irr::gui::StaticText::getTextHeight ( ) const
virtual

Returns the height of the text in pixels when it is drawn.

References BrokenText, getActiveFont(), and WordWrap.

+ Here is the call graph for this function:

◆ getTextWidth()

s32 irr::gui::StaticText::getTextWidth ( ) const
virtual

Returns the width of the current text, in the current font.

References BrokenText, and getActiveFont().

Referenced by draw().

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

◆ hasType() [1/2]

virtual bool irr::gui::StaticText::hasType ( EGUI_ELEMENT_TYPE t)
inlinevirtual

◆ hasType() [2/2]

virtual bool irr::gui::StaticText::hasType ( EGUI_ELEMENT_TYPE t) const
inlinevirtual

◆ isDrawBackgroundEnabled()

bool irr::gui::StaticText::isDrawBackgroundEnabled ( ) const
virtual

Checks if background drawing is enabled.

References Background.

◆ isDrawBorderEnabled()

bool irr::gui::StaticText::isDrawBorderEnabled ( ) const
virtual

Checks if border drawing is enabled.

References Border.

◆ isOverrideColorEnabled()

bool irr::gui::StaticText::isOverrideColorEnabled ( ) const
virtual

Checks if an override color is enabled.

◆ isRightToLeft()

bool irr::gui::StaticText::isRightToLeft ( ) const
virtual

Checks if the text should be interpreted as right-to-left text.

References RightToLeft.

◆ isTextRestrainedInside()

bool irr::gui::StaticText::isTextRestrainedInside ( ) const
virtual

Checks if the text in this label should be clipped if it goes outside bounds.

References RestrainTextInside.

◆ isWordWrapEnabled()

bool irr::gui::StaticText::isWordWrapEnabled ( ) const
virtual

Checks if word wrap is enabled.

References WordWrap.

◆ setBackgroundColor()

void irr::gui::StaticText::setBackgroundColor ( video::SColor color)
virtual

Sets another color for the background.

Sets another color for the text.

References Background, ColoredText, and EnrichedString::setBackground().

Referenced by updateText().

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

◆ setDrawBackground()

void irr::gui::StaticText::setDrawBackground ( bool draw)
virtual

Sets whether to draw the background.

References Background, and draw().

Referenced by updateText().

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

◆ setDrawBorder()

void irr::gui::StaticText::setDrawBorder ( bool draw)
virtual

Sets whether to draw the border.

References Border, and draw().

+ Here is the call graph for this function:

◆ setOverrideColor()

void irr::gui::StaticText::setOverrideColor ( video::SColor color)
virtual

Sets another color for the text.

References ColoredText, EnrichedString::setDefaultColor(), and updateText().

Referenced by GUIButton::setOverrideColor().

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

◆ setOverrideFont()

void irr::gui::StaticText::setOverrideFont ( IGUIFont * font = 0)
virtual

Sets another skin independent font.

References OverrideFont, and updateText().

Referenced by GUIButton::setOverrideFont().

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

◆ setRightToLeft()

void irr::gui::StaticText::setRightToLeft ( bool rtl)
virtual

Set whether the string should be interpreted as right-to-left (RTL) text.

Note
This component does not implement the Unicode bidi standard, the text of the component should be already RTL if you call this. The main difference when RTL is enabled is that the linebreaks for multiline elements are performed starting from the end.

References RightToLeft, and updateText().

+ Here is the call graph for this function:

◆ setText() [1/2]

void irr::gui::StaticText::setText ( const EnrichedString & text)

References EnrichedString::c_str(), ColoredText, and updateText().

+ Here is the call graph for this function:

◆ setText() [2/2]

void irr::gui::StaticText::setText ( const wchar_t * text)
virtual

Sets the new caption of this element.

References getOverrideColor(), and setText().

Referenced by StaticText(), setStaticText(), GUIButton::setText(), and setText().

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

◆ setTextAlignment()

void irr::gui::StaticText::setTextAlignment ( EGUI_ALIGNMENT horizontal,
EGUI_ALIGNMENT vertical )
virtual

Sets alignment mode for text.

References HAlign, and VAlign.

Referenced by GUIButton::GUIButton().

+ Here is the caller graph for this function:

◆ setTextRestrainedInside()

void irr::gui::StaticText::setTextRestrainedInside ( bool restrainedInside)
virtual

Set whether the text in this label should be clipped if it goes outside bounds.

References RestrainTextInside.

◆ setWordWrap()

void irr::gui::StaticText::setWordWrap ( bool enable)
virtual

Enables or disables word wrap for using the static text as multiline text control.

References updateText(), and WordWrap.

+ Here is the call graph for this function:

◆ updateAbsolutePosition()

void irr::gui::StaticText::updateAbsolutePosition ( )
virtual

Updates the absolute position, splits text if word wrap is enabled.

References updateText().

+ Here is the call graph for this function:

◆ updateText()

void irr::gui::StaticText::updateText ( )
private

Breaks the single text line.

References EnrichedString::addChar(), EnrichedString::addCharNoColor(), Border, BrokenText, EnrichedString::c_str(), EnrichedString::clear(), ColoredText, getActiveFont(), EnrichedString::getBackground(), EnrichedString::getString(), EnrichedString::hasBackground(), LastBreakFont, RightToLeft, setBackgroundColor(), setDrawBackground(), EnrichedString::size(), EnrichedString::substr(), and WordWrap.

Referenced by draw(), setOverrideColor(), setOverrideFont(), setRightToLeft(), setText(), setWordWrap(), and updateAbsolutePosition().

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

Member Data Documentation

◆ Background

bool irr::gui::StaticText::Background
private

◆ Border

bool irr::gui::StaticText::Border
private

◆ BrokenText

std::vector<EnrichedString> irr::gui::StaticText::BrokenText
private

◆ ColoredText

EnrichedString irr::gui::StaticText::ColoredText
private

◆ HAlign

EGUI_ALIGNMENT irr::gui::StaticText::HAlign
private

Referenced by draw(), and setTextAlignment().

◆ LastBreakFont

gui::IGUIFont* irr::gui::StaticText::LastBreakFont
private

Referenced by draw(), and updateText().

◆ OverrideFont

gui::IGUIFont* irr::gui::StaticText::OverrideFont
private

◆ RestrainTextInside

bool irr::gui::StaticText::RestrainTextInside
private

◆ RightToLeft

bool irr::gui::StaticText::RightToLeft
private

◆ VAlign

EGUI_ALIGNMENT irr::gui::StaticText::VAlign
private

Referenced by draw(), and setTextAlignment().

◆ WordWrap

bool irr::gui::StaticText::WordWrap
private

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