19 static constexpr std::string_view CallPattern =
"[A-Z]+[0-9][A-Z]+";
20 static constexpr std::string_view FloatPattern =
"([+-]?([0-9]+([.][0-9]*)?|[.][0-9]+))?";
25 explicit PointSize(
int size) : pointSize(size) {}
31 explicit FontName(std::string name) : fontName(std::move(name)) {}
33 fontName = name.fontName;
60 std::string mSuffix{};
66 float mCaretAlpha{0.f};
69 std::shared_ptr<_TTF_Font> mFont{};
74 int mCaretLocation{0};
75 bool mEditingActive{
false};
77 bool mEditable{
false};
78 bool mTextValidated{
true};
79 bool mSaveToSettings{
false};
82 std::unique_ptr<std::regex> mValidationPattern{};
85 void setEditingMode(
bool editing,
int carret);
89 virtual ~
Text() =
default;
93 Text& operator=(
const Text &) =
delete;
109 mPointSize = pointSize;
114 mFontName = fontName;
133 void setSuffix(
const std::string &suffix) {
137 void setTextMaxSize(
int maxSize,
char em =
'\0') {
143 void setTextValidationPattern(
const std::string& regex) {
144 mValidationPattern = std::make_unique<std::regex>(regex);
156 template<
class W
idgetClass>
157 inline std::shared_ptr<WidgetClass> operator<<(std::shared_ptr<WidgetClass> widget,
rose::PointSize pointSize) {
158 static_assert(std::is_base_of_v<rose::Text,WidgetClass>,
"WidgetClass must be derived from rose::Text." );
159 widget->setPointSize(pointSize.pointSize);
170 template<
class W
idgetClass>
171 inline std::shared_ptr<WidgetClass> operator<<(std::shared_ptr<WidgetClass> widget,
rose::FontName fontName) {
172 static_assert(std::is_base_of_v<rose::Text,WidgetClass>,
"WidgetClass must be derived from rose::Text." );
173 widget->setFontName(fontName.fontName);
color::RGBA mTextBgColor
The background color to use if rendering Shaded.
Definition: Text.h:62
True Type Fonts and supporting types and functions.
Render text shaded on a solid background.
Definition: Text.h:46
Render text blended on a transparent background.
Definition: Text.h:45
Red Green Blue Alpha representation of a color.
Definition: Color.h:64
The Font was not found.
Definition: Text.h:53
A structure to pass a Font name to a Widget through a manipulator.
Definition: Text.h:28
void setPointSize(int pointSize)
Set the font point size.
Definition: Text.h:108
Status
Definition: Text.h:50
bool setText(const std::string &text)
Set the text displayed.
Definition: Text.h:122
Abstraction of SDL_Texture.
Definition: Texture.h:46
Context
Definition: GraphicsModel.h:76
Encapsulation of code for rendering Text.
Definition: Text.h:42
void setFontName(const std::string &fontName)
Set the font name.
Definition: Text.h:113
Abstraction of the graphics model.
std::string mFontName
The name of the True Type Font to use.
Definition: Text.h:68
int mPointSize
The point (pixel) size of the font.
Definition: Text.h:70
The text to be rendered was empty.
Definition: Text.h:52
color::RGBA mTextFgColor
The foreground color to use.
Definition: Text.h:61
RenderStyle
Definition: Text.h:44
The API returned a nullptr Surface.
Definition: Text.h:54
A size in integer dimensions.
Definition: Types.h:230
The API returned a nullptr Texture.
Definition: Text.h:55
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13
Operation succeeded.
Definition: Text.h:51