aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/TextBox.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-03-04 21:21:15 +0800
committercrupest <crupest@outlook.com>2022-03-04 21:21:15 +0800
commita0732c3aa32d200bf154d486df3c9f506161954f (patch)
tree4019d719d8672030db7602c19798e911ef57e3b3 /include/cru/ui/controls/TextBox.h
parent14e1b0f188d302b69816ddf12f5ac591fd76b91d (diff)
downloadcru-a0732c3aa32d200bf154d486df3c9f506161954f.tar.gz
cru-a0732c3aa32d200bf154d486df3c9f506161954f.tar.bz2
cru-a0732c3aa32d200bf154d486df3c9f506161954f.zip
...
Diffstat (limited to 'include/cru/ui/controls/TextBox.h')
-rw-r--r--include/cru/ui/controls/TextBox.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/include/cru/ui/controls/TextBox.h b/include/cru/ui/controls/TextBox.h
index 3e041880..c3d8fc4d 100644
--- a/include/cru/ui/controls/TextBox.h
+++ b/include/cru/ui/controls/TextBox.h
@@ -4,14 +4,19 @@
#include "../render/BorderRenderObject.h"
#include "../render/TextRenderObject.h"
#include "IBorderControl.h"
+#include "IContentBrushControl.h"
+#include "IFontControl.h"
#include "TextHostControlService.h"
+#include "cru/platform/graphics/Brush.h"
#include <memory>
namespace cru::ui::controls {
class CRU_UI_API TextBox : public NoChildControl,
public virtual IBorderControl,
- public virtual ITextHostControl {
+ public virtual ITextHostControl,
+ public virtual IContentBrushControl,
+ public virtual IFontControl {
public:
static constexpr StringView control_type = u"TextBox";
@@ -40,6 +45,29 @@ class CRU_UI_API TextBox : public NoChildControl,
return service_->TextChangeEvent();
}
+ std::shared_ptr<platform::graphics::IFont> GetFont() const override {
+ return text_render_object_->GetFont();
+ }
+ void SetFont(std::shared_ptr<platform::graphics::IFont> font) override {
+ text_render_object_->SetFont(std::move(font));
+ }
+
+ std::shared_ptr<platform::graphics::IBrush> GetTextBrush() const {
+ return text_render_object_->GetBrush();
+ }
+ void SetTextBrush(std::shared_ptr<platform::graphics::IBrush> brush) {
+ text_render_object_->SetBrush(std::move(brush));
+ }
+
+ std::shared_ptr<platform::graphics::IBrush> GetContentBrush() const override {
+ return GetTextBrush();
+ }
+
+ void SetContentBrush(
+ std::shared_ptr<platform::graphics::IBrush> brush) override {
+ SetTextBrush(std::move(brush));
+ }
+
private:
std::unique_ptr<render::BorderRenderObject> border_render_object_;
std::unique_ptr<render::ScrollRenderObject> scroll_render_object_;