From 4f55beda64da5cbe1d2fd92df509c79fc5f174a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=A6=E5=87=8C=E6=B1=90?= Date: Thu, 19 Dec 2024 20:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86Menu=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Editor.h | 4 ---- components/Text.h | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/Editor.h b/components/Editor.h index 27dc205..8d68d62 100644 --- a/components/Editor.h +++ b/components/Editor.h @@ -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(); } }; diff --git a/components/Text.h b/components/Text.h index 37091f9..673483f 100644 --- a/components/Text.h +++ b/components/Text.h @@ -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_; }