aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-12-05 16:37:58 +0800
committercrupest <crupest@outlook.com>2018-12-05 16:37:58 +0800
commit8898aee6c70bde922ee5de2a6213a44798525a16 (patch)
tree90b6fc6eb526e2421458f942f390906d6a48a628 /src/ui/controls/text_control.cpp
parent01b0378ed32eb2011863393892717483004cc375 (diff)
downloadcru-8898aee6c70bde922ee5de2a6213a44798525a16.tar.gz
cru-8898aee6c70bde922ee5de2a6213a44798525a16.tar.bz2
cru-8898aee6c70bde922ee5de2a6213a44798525a16.zip
...
Diffstat (limited to 'src/ui/controls/text_control.cpp')
-rw-r--r--src/ui/controls/text_control.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp
index 9a799916..6412eec9 100644
--- a/src/ui/controls/text_control.cpp
+++ b/src/ui/controls/text_control.cpp
@@ -56,14 +56,6 @@ namespace cru::ui::controls
SetClipContent(true);
- size_changed_event.AddHandler([this](events::SizeChangedEventArgs& args)
- {
- const auto content = GetRect(RectRange::Content);
- ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
- ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
- InvalidateDraw();
- });
-
draw_content_event.AddHandler([this](events::DrawEventArgs& args)
{
const auto device_context = args.GetDeviceContext();
@@ -196,6 +188,13 @@ namespace cru::ui::controls
}
+ void TextControl::OnRectChange(const Rect& old_rect, const Rect& new_rect)
+ {
+ const auto content = GetRect(RectRange::Content);
+ ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
+ ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
+ }
+
void TextControl::OnTextChangedCore(const String& old_text, const String& new_text)
{
RecreateTextLayout();