TGUI  1.6.1
Loading...
Searching...
No Matches
tgui::TextStyles Class Reference

Wrapper for text styles. More...

#include <TGUI/TextStyle.hpp>

Public Member Functions

constexpr TextStyles ()
 Creates the object without a text style.
 
constexpr TextStyles (unsigned int style)
 Creates the object from one or more tgui::TextStyle::Style enum members.
 
 TextStyles (const String &string)
 Creates the object from a string representing the text styles.
 
 TextStyles (const char *string)
 Creates the object from a string representing the text styles.
 
constexpr bool isSet () const
 Checks if a style was set.
 
constexpr operator unsigned int () const
 Converts this object into an unsigned int.
 

Detailed Description

Wrapper for text styles.

The class is used for 2 purposes:

  • Implicit converter for parameters. A function taking a TextStyles as parameter can be given either a tgui::TextStyle (or multiple combined with | operator) or a string representation as argument.
  • Storing no style at all. Some style settings may be optionally set and can thus remain unspecified.

Constructor & Destructor Documentation

◆ TextStyles() [1/4]

tgui::TextStyles::TextStyles ( )
inlineconstexpr

Creates the object without a text style.

The isSet function will return false when the object was created using this constructor.

◆ TextStyles() [2/4]

tgui::TextStyles::TextStyles ( unsigned int style)
inlineconstexpr

Creates the object from one or more tgui::TextStyle::Style enum members.

Parameters
styleText style to set
Wrapper for text styles.
Definition TextStyle.hpp:55
@ Bold
Bold characters.
Definition TextStyle.hpp:40
@ Italic
Italic characters.
Definition TextStyle.hpp:41

◆ TextStyles() [3/4]

tgui::TextStyles::TextStyles ( const String & string)

Creates the object from a string representing the text styles.

Parameters
stringString to be deserialized as text styles

◆ TextStyles() [4/4]

tgui::TextStyles::TextStyles ( const char * string)

Creates the object from a string representing the text styles.

Parameters
stringString to be deserialized as text styles
TextStyles style{"Italic | Bold"};

Member Function Documentation

◆ isSet()

bool tgui::TextStyles::isSet ( ) const
inlinenodiscardconstexpr

Checks if a style was set.

Returns
True if a text style was passed to the constructor, false when the default constructor was used

◆ operator unsigned int()

tgui::TextStyles::operator unsigned int ( ) const
inlineconstexpr

Converts this object into an unsigned int.

Returns
The text styles stored in this object, or tgui::TextStyle::Regular if no style was set

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