Use textbox to draw textparagraph element
This commit is contained in:
parent
a181a4d51d
commit
caaad67c42
6 changed files with 64 additions and 37 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue