From 85bb4d466efeb2540363065d7c0987a9d60f70e9 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 19 Sep 2018 01:15:01 +0800 Subject: finish animation!!! --- CruUI/ui/controls/text_block.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'CruUI/ui/controls/text_block.cpp') diff --git a/CruUI/ui/controls/text_block.cpp b/CruUI/ui/controls/text_block.cpp index beb799d3..294c456b 100644 --- a/CruUI/ui/controls/text_block.cpp +++ b/CruUI/ui/controls/text_block.cpp @@ -53,6 +53,19 @@ namespace cru Repaint(); } + void TextBlock::AddTextLayoutHandler(TextLayoutHandlerPtr handler) + { + text_layout_handlers_.push_back(std::move(handler)); + } + + void TextBlock::RemoveTextLayoutHandler(const TextLayoutHandlerPtr& handler) + { + const auto find_result = std::find(text_layout_handlers_.cbegin(), text_layout_handlers_.cend(), + handler); + if (find_result != text_layout_handlers_.cend()) + text_layout_handlers_.erase(find_result); + } + void TextBlock::OnSizeChangedCore(events::SizeChangedEventArgs& args) { Control::OnSizeChangedCore(args); @@ -263,7 +276,7 @@ namespace cru &text_layout_ )); - std::for_each(text_layout_handlers_.cbegin(), text_layout_handlers_.cend(), [this](const std::shared_ptr& handler) + std::for_each(text_layout_handlers_.cbegin(), text_layout_handlers_.cend(), [this](const TextLayoutHandlerPtr& handler) { (*handler)(text_layout_); }); -- cgit v1.2.3