aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/controls
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-02 16:25:47 +0800
committercrupest <crupest@outlook.com>2018-09-02 16:25:47 +0800
commit09e480f0c956a16751a535558b84431ea47cd38f (patch)
treef98aa86d2b23970c7d03ea2463ea120d06838e17 /CruUI/ui/controls
parentf3d62dec00748a306af658b87bffc54e4949a4f4 (diff)
downloadcru-09e480f0c956a16751a535558b84431ea47cd38f.tar.gz
cru-09e480f0c956a16751a535558b84431ea47cd38f.tar.bz2
cru-09e480f0c956a16751a535558b84431ea47cd38f.zip
...
Diffstat (limited to 'CruUI/ui/controls')
-rw-r--r--CruUI/ui/controls/text_block.cpp27
-rw-r--r--CruUI/ui/controls/text_block.h40
2 files changed, 67 insertions, 0 deletions
diff --git a/CruUI/ui/controls/text_block.cpp b/CruUI/ui/controls/text_block.cpp
new file mode 100644
index 00000000..b8fe742d
--- /dev/null
+++ b/CruUI/ui/controls/text_block.cpp
@@ -0,0 +1,27 @@
+#include "text_block.h"
+
+namespace cru
+{
+ namespace ui
+ {
+ namespace controls
+ {
+ void TextBlock::SetText(const String& text)
+ {
+ const auto old_text = text_;
+ text_ = text;
+ OnTextChangedCore(old_text, text);
+ }
+
+ void TextBlock::OnSizeChangedCore(events::SizeChangedEventArgs& args)
+ {
+
+ }
+
+ void TextBlock::OnTextChangedCore(const String& old_text, const String& new_text)
+ {
+
+ }
+ }
+ }
+}
diff --git a/CruUI/ui/controls/text_block.h b/CruUI/ui/controls/text_block.h
new file mode 100644
index 00000000..aea4629f
--- /dev/null
+++ b/CruUI/ui/controls/text_block.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "ui/ui_base.h"
+#include "ui/control.h"
+
+namespace cru
+{
+ namespace ui
+ {
+ namespace controls
+ {
+ class TextBlock : public Control
+ {
+ public:
+ TextBlock();
+ TextBlock(const TextBlock& other) = delete;
+ TextBlock(TextBlock&& other) = delete;
+ TextBlock& operator=(const TextBlock& other) = delete;
+ TextBlock& operator=(TextBlock&& other) = delete;
+ ~TextBlock() override;
+
+ String GetText() const
+ {
+ return text_;
+ }
+
+ void SetText(const String& text);
+
+ protected:
+ void OnSizeChangedCore(events::SizeChangedEventArgs& args) override final;
+
+ private:
+ void OnTextChangedCore(const String& old_text, const String& new_text);
+
+ private:
+ String text_;
+ };
+ }
+ }
+}