新增了Menu类

This commit is contained in:
梦凌汐 2024-12-19 20:47:21 +08:00
parent e87f6ce103
commit 4f55beda64
2 changed files with 14 additions and 14 deletions

View File

@ -123,8 +123,6 @@ public:
void setFocus(bool focusStatus) {
BaseComponent::setFocus(focusStatus);
cursor_.setVisibility(focusStatus);
draw();
}
void onKeyPress(int key) override {
@ -242,8 +240,6 @@ public:
moveRight();
}
}
draw();
}
};

View File

@ -16,16 +16,6 @@ private:
int maxLineWidth_ = 0;
public:
Text(int left, int top, int width, int height) : BaseComponent(top, left, width, height) {
text_ = RichText();
}
Text(int left, int top, int width, int height, const RichText& text) : BaseComponent(top, left, width, height) {
text_ = text;
}
~Text() override {
lines_.clear();
}
void setText(const RichText& text) {
this->text_ = text;
@ -70,6 +60,20 @@ public:
// }
}
Text() : BaseComponent(0, 0, 0, 0) {
setText(RichText());
}
Text(int left, int top, int width, int height) : BaseComponent(left, top, width, height) {
setText(RichText());
}
Text(int left, int top, int width, int height, const RichText& text) : BaseComponent(left, top, width, height) {
setText(text);
}
~Text() override {
lines_.clear();
}
RichText getText() {
return text_;
}