30 TextArea(std::string initial =
"",
int rows = 3);
32 void setText(std::string t);
33 const std::string &getText()
const {
return text; }
34 void clear() { setText(
""); }
36 int getCursorPos()
const {
return cursorPos; }
37 void setCursorPos(
int pos);
39 const std::string &getCompositionText()
const noexcept {
return compositionText_; }
40 int getCompositionCursor()
const noexcept {
return compositionCursor_; }
41 bool isComposing()
const noexcept {
return !compositionText_.empty(); }
43 void setPlaceholder(std::string p);
44 const std::string &getPlaceholder()
const {
return placeholder; }
46 void setPlaceholderWrap(
bool w);
47 bool getPlaceholderWrap()
const {
return placeholderWrap_; }
50 int getRows()
const {
return rows_; }
54 std::function<void(
const std::string &)> onTextChanged;
56 static constexpr const char *PART_SELECTION =
"selection";
57 static constexpr const char *PART_PLACEHOLDER =
"placeholder";
58 static constexpr const char *PART_CURSOR =
"cursor";
69 void ensurePlaceholderLines(
float availW,
const ComputedStyle &style);
70 int cursorIndexFromPos(
float localX,
float localY,
float pl,
float pt)
const;
77 std::deque<HistoryState> undoStack;
78 std::deque<HistoryState> redoStack;
83 void selectWordAtCursor();
86 std::string placeholder;
87 bool placeholderWrap_{
true};
88 bool placeholder_dirty{
true};
89 float lastPhWrapW{-1.0f};
90 float lastPhFontSize{-1.0f};
91 float lastPhLetterSpacing{-1.0f};
92 uint32_t lastPhFontId{0};
93 FontStack lastPhFontStack;
94 std::shared_ptr<const TextLayout> placeholderLayout_;
98 int selectionStart{-1};
99 std::string compositionText_;
100 std::string displayText_;
101 int compositionCursor_{0};
102 int compositionSelLen_{0};
103 bool text_dirty{
true};
104 bool hasFocusCache{
false};
105 float cursorBlink{0.0f};
107 float lastWrapW{-1.0f};
108 float lastFontSize{-1.0f};
109 float lastLetterSpacing{-1.0f};
110 uint32_t lastFontId{0};
111 FontStack lastFontStack;
112 FontHandle defaultFont{0};
116 std::shared_ptr<const TextLayout> textLayout_;
118 double lastClickTime{0.0};
122 float holdTime{0.0f};
123 float nextFireTime{0.0f};
125 std::unordered_map<int, RepeatState> repeatStates;
Centralized standard library includes used throughout ZenitUI.
The node class: tree structure, layout pass, style resolution, input dispatch, render orchestration,...
TLayout(Args &&...args)
Definition Layout.hpp:1401
void onUpdate(float dt) override
Called every frame from update, after input dispatch.
void onEnabledChanged(bool nowEnabled) override
Called from setEnabled after the state change.
Vec2 computeIntrinsicSize(float availW, float availH) override
Compute the intrinsic size, excluding padding and border.
void renderContent(float op, const ComputedStyle &style) override
Draw the node's content (text, images, custom geometry).
TextDirection
Inline / layout writing direction for Bidi text and RTL layout mirroring (ยง6.2).
Definition UIEnums.hpp:83
@ Auto
Infer paragraph direction from first strong Bidi character (fallback LTR).
Definition UIEnums.hpp:84
Dense style: every property has a concrete value.
Definition Style.hpp:1036
Opaque handle to a font loaded by TextEngine.
Definition CoreTypes.hpp:135
Typographic parameters governing shaping and measurement.
Definition TextEngine.hpp:51
2D vector with component-wise arithmetic.
Definition CoreTypes.hpp:25