CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
UILabel.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "UIView.hpp"
11
14
15namespace CeresEngine {
16
17 class UILabel : public UIView {
18 private:
23
25 UIColor mTextColor = UIColor::black;
26
29
31 HFont mFont = nullptr;
32
35
36 private:
38
39 public:
41 UILabel(const String& text);
42 ~UILabel() override;
43
44 public:
46 const String& getText() const { return mText; }
47
49 void setText(const String& text);
50
52 const UIColor& getTextColor() const { return mTextColor; }
53
56
59
62
64 const HFont& getFont() const { return mFont; }
65
67 void setFont(const HFont& font);
68
69 public: // UIView
72
74 void layoutSubviews() override;
75
77 void draw(UIGraphicsContext& context, const UIRect& dirtyRect) override;
78 };
79
80} // namespace CeresEngine
Scoped connection class.
Definition Event.hpp:104
An object that represents a graphics context.
Definition GraphicsContext.hpp:45
An object that coordinates the layout and display of text characters.
Definition TextLayoutManager.hpp:74
Definition UILabel.hpp:17
void setFont(const HFont &font)
void setTextColor(const UIColor &textColor)
UISize getIntrinsicContentSize() const override
The natural size for the receiving view, considering only properties of the view itself.
UIColor mTextColor
The color of the text.
Definition UILabel.hpp:25
const UIColor & getTextColor() const
Definition UILabel.hpp:52
void setText(const String &text)
void draw(UIGraphicsContext &context, const UIRect &dirtyRect) override
Displays the view and all its subviews if possible.
const String & getText() const
Definition UILabel.hpp:46
const HFont & getFont() const
Definition UILabel.hpp:64
EventConnection mFontLoadedEvent
Definition UILabel.hpp:37
HFont mFont
The font to render the label with.
Definition UILabel.hpp:31
const UITextAlignment & getTextAlignment() const
Definition UILabel.hpp:58
void setTextAlignment(const UITextAlignment &textAlignment)
UILabel(const String &text)
String mText
The text that the label is displaying.
Definition UILabel.hpp:22
UITextAlignment mTextAlignment
The technique to use for aligning the text.
Definition UILabel.hpp:28
TextLayoutManager mLayoutManager
The text layout manager.
Definition UILabel.hpp:34
void layoutSubviews() override
Lays out subviews.
The infrastructure for drawing and handling events in a UI.
Definition UIView.hpp:153
Definition Application.hpp:19
Color UIColor
Definition UIUtility.hpp:187
Size2 UISize
A type that contains width and height values.
Definition UIUtility.hpp:30
UITextAlignment
These constants specify text alignment.
Definition UIUtility.hpp:100
@ Left
Text is visually left aligned.
Rect2 UIRect
A structure that contains the location and dimensions of a rectangle.
Definition UIUtility.hpp:33
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25