Use textbox to draw textparagraph element

This commit is contained in:
Yousef Khadadeh 2026-04-07 22:21:06 +03:00
parent a181a4d51d
commit caaad67c42
6 changed files with 64 additions and 37 deletions

View file

@ -1,16 +1,24 @@
#pragma once
#include "Element.hpp"
#include <modules/skparagraph/include/Paragraph.h>
#include "../../RichText/TextBox.hpp"
namespace GUIStuff {
class TextParagraph : public Element {
public:
struct Data {
RichText::TextData text;
float width;
bool operator==(const Data& d) const = default;
bool operator!=(const Data& d) const = default;
};
TextParagraph(GUIManager& gui);
void layout(const Clay_ElementId& id, const std::shared_ptr<skia::textlayout::Paragraph>& paragraph, float width);
void layout(const Clay_ElementId& id, const Data& newData);
virtual void clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) override;
private:
std::shared_ptr<skia::textlayout::Paragraph> data;
Data d;
std::unique_ptr<RichText::TextBox> textbox;
};
}