HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
TextCell.hpp
1// Copyright 2020 Pokitec
2// All rights reserved.
3
4#pragma once
5
6#include "TTauri/Cells/Cell.hpp"
7#include "TTauri/Text/ShapedText.hpp"
8#include "TTauri/Text/TextStyle.hpp"
9#include <string_view>
10
11namespace tt {
12
13class TextCell: public Cell {
14 std::string text;
15 TextStyle style;
16 mutable ShapedText shapedText;
17
18public:
19 TextCell(std::string_view text, TextStyle style) noexcept;
20 TextCell(std::string text, TextStyle style) noexcept;
21
22 [[nodiscard]] vec preferredExtent() const noexcept override;
23
24 [[nodiscard]] float heightForWidth(float width) const noexcept override;
25
26 void draw(DrawContext const &drawContext, aarect rectangle, Alignment alignment, float middle) const noexcept override;
27
28};
29
30}
Definition Cell.hpp:12
Definition TextCell.hpp:13
void draw(DrawContext const &drawContext, aarect rectangle, Alignment alignment, float middle) const noexcept override
Draw the cell.
float heightForWidth(float width) const noexcept override
Get the height to draw this cell for the given width.
vec preferredExtent() const noexcept override
Return the extent that this cell wants to be drawn as.
Class which represents an axis-aligned rectangle.
Definition aarect.hpp:13
A 4D vector.
Definition vec.hpp:37
Draw context for drawing using the TTauri shaders.
Definition DrawContext.hpp:30
ShapedText represent a piece of text shaped to be displayed.
Definition ShapedText.hpp:21
Definition TextStyle.hpp:15