TGUI  0.9.5
Loading...
Searching...
No Matches
TextStyle.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2022 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25
26#ifndef TGUI_TEXT_STYLE_HPP
27#define TGUI_TEXT_STYLE_HPP
28
29#include <TGUI/String.hpp>
30#include <string>
31
33
34namespace tgui
35{
40 {
41 Regular = 0,
42 Bold = 1 << 0,
43 Italic = 1 << 1,
44 Underlined = 1 << 2,
45 StrikeThrough = 1 << 3
46 };
47
48
57 class TGUI_API TextStyles
58 {
59 public:
60
66 TGUI_CONSTEXPR TextStyles() :
67 m_isSet{false},
68 m_style{Regular}
69 {
70 }
71
72
82 TGUI_CONSTEXPR TextStyles(unsigned int style) :
83 m_isSet{true},
84 m_style{style}
85 {
86 }
87
88
94 TextStyles(const String& string);
95
96
106 TextStyles(const char* string);
107
108
114 TGUI_CONSTEXPR bool isSet() const
115 {
116 return m_isSet;
117 }
118
119
125 TGUI_CONSTEXPR operator unsigned int() const
126 {
127 return m_style;
128 }
129
130
132 private:
133
134 bool m_isSet;
135 unsigned int m_style;
136 };
137
139}
140
142
143#endif // TGUI_TEXT_STYLE_HPP
Wrapper class to store strings.
Definition String.hpp:79
Wrapper for text styles.
Definition TextStyle.hpp:58
TextStyles(const char *string)
Creates the object from a string representing the text styles.
TGUI_CONSTEXPR TextStyles(unsigned int style)
Creates the object from one or more tgui::TextStyle::Style enum members.
Definition TextStyle.hpp:82
TextStyles(const String &string)
Creates the object from a string representing the text styles.
TGUI_CONSTEXPR TextStyles()
Creates the object without a text style.
Definition TextStyle.hpp:66
TGUI_CONSTEXPR bool isSet() const
Checks if a style was set.
Definition TextStyle.hpp:114
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36
TextStyle
Enumeration of the text drawing styles.
Definition TextStyle.hpp:40
@ Underlined
Underlined characters.
Definition TextStyle.hpp:44
@ Bold
Bold characters.
Definition TextStyle.hpp:42
@ Italic
Italic characters.
Definition TextStyle.hpp:43
@ Regular
Regular characters, no style.
Definition TextStyle.hpp:41
@ StrikeThrough
Strike through characters.
Definition TextStyle.hpp:45