diff options
author | crupest <crupest@outlook.com> | 2020-03-19 19:11:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-03-19 19:11:33 +0800 |
commit | 5da4f511e85de9e79bee40e3c5e04f899a48723c (patch) | |
tree | 8c07925417fc1f062bb6f4ec64dc9226199e6099 /src/ui/controls/text_box.cpp | |
parent | ad29543fe081d2a0a5e6737f9073399e4e91383f (diff) | |
download | cru-5da4f511e85de9e79bee40e3c5e04f899a48723c.tar.gz cru-5da4f511e85de9e79bee40e3c5e04f899a48723c.tar.bz2 cru-5da4f511e85de9e79bee40e3c5e04f899a48723c.zip |
...
Diffstat (limited to 'src/ui/controls/text_box.cpp')
-rw-r--r-- | src/ui/controls/text_box.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ui/controls/text_box.cpp b/src/ui/controls/text_box.cpp index 9c6fcbe5..1e0890b8 100644 --- a/src/ui/controls/text_box.cpp +++ b/src/ui/controls/text_box.cpp @@ -5,6 +5,7 @@ #include "cru/ui/render/stack_layout_render_object.hpp" #include "cru/ui/render/text_render_object.hpp" #include "cru/ui/ui_manager.hpp" +#include "text_control_service.hpp" namespace cru::ui::controls { using render::BorderRenderObject; @@ -16,9 +17,13 @@ TextBox::TextBox() : border_render_object_(new BorderRenderObject()), stack_layout_render_object_(new StackLayoutRenderObject()), text_render_object_(), - caret_render_object_(new CanvasRenderObject()) { + caret_render_object_(new CanvasRenderObject()), + service_(new TextControlService<TextBox>(this)) { const auto theme_resources = UiManager::GetInstance()->GetThemeResources(); + caret_brush_ = theme_resources->caret_brush; + border_style_ = theme_resources->text_box_border_style; + text_render_object_ = std::make_unique<TextRenderObject>( theme_resources->text_brush, theme_resources->default_font, theme_resources->text_selection_brush); @@ -34,4 +39,22 @@ TextBox::TextBox() } TextBox::~TextBox() {} + +render::TextRenderObject* TextBox::GetTextRenderObject() { + return text_render_object_.get(); +} + +render::CanvasRenderObject* TextBox::GetCaretRenderObject() { + return caret_render_object_.get(); +} + +std::shared_ptr<platform::graph::IBrush> TextBox::GetCaretBrush() { + return caret_brush_; +} + +const TextBoxBorderStyle& TextBox::GetBorderStyle() { return border_style_; } + +void TextBox::SetBorderStyle(TextBoxBorderStyle border_style) { + border_style_ = std::move(border_style_); +} } // namespace cru::ui::controls |