aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/controls/text_box.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-25 13:08:40 +0800
committercrupest <crupest@outlook.com>2018-09-25 13:08:40 +0800
commit4b86554a0354d78efeb40e551eaccaac0fecd1d1 (patch)
treec8a73d848401f523ff91fe8ed1b0887aa88bbfb8 /CruUI/ui/controls/text_box.h
parentcea138417c54d6cf8043b6334c22e3af957d26f8 (diff)
downloadcru-4b86554a0354d78efeb40e551eaccaac0fecd1d1.tar.gz
cru-4b86554a0354d78efeb40e551eaccaac0fecd1d1.tar.bz2
cru-4b86554a0354d78efeb40e551eaccaac0fecd1d1.zip
Change the structure of project.
Diffstat (limited to 'CruUI/ui/controls/text_box.h')
-rw-r--r--CruUI/ui/controls/text_box.h85
1 files changed, 0 insertions, 85 deletions
diff --git a/CruUI/ui/controls/text_box.h b/CruUI/ui/controls/text_box.h
deleted file mode 100644
index b815ed1f..00000000
--- a/CruUI/ui/controls/text_box.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma once
-
-#include "ui/control.h"
-#include "timer.h"
-
-namespace cru::ui::controls
-{
- class TextBox : public Control
- {
- public:
- static TextBox* Create(
- const Microsoft::WRL::ComPtr<IDWriteTextFormat>& init_text_format = nullptr,
- const Microsoft::WRL::ComPtr<ID2D1Brush>& init_brush = nullptr)
- {
- return new TextBox(init_text_format, init_brush);
- }
-
- protected:
- explicit TextBox(
- const Microsoft::WRL::ComPtr<IDWriteTextFormat>& init_text_format = nullptr,
- const Microsoft::WRL::ComPtr<ID2D1Brush>& init_brush = nullptr
- );
- public:
- TextBox(const TextBox& other) = delete;
- TextBox(TextBox&& other) = delete;
- TextBox& operator=(const TextBox& other) = delete;
- TextBox& operator=(TextBox&& other) = delete;
- ~TextBox() override;
-
- String GetText() const
- {
- return text_;
- }
-
- void SetText(const String& text);
-
- Microsoft::WRL::ComPtr<ID2D1Brush> GetBrush() const
- {
- return brush_;
- }
-
- void SetBrush(const Microsoft::WRL::ComPtr<ID2D1Brush>& brush);
-
- Microsoft::WRL::ComPtr<IDWriteTextFormat> GetTextFormat() const
- {
- return text_format_;
- }
-
- void SetTextFormat(const Microsoft::WRL::ComPtr<IDWriteTextFormat>& text_format);
-
- protected:
- void OnSizeChangedCore(events::SizeChangedEventArgs& args) override final;
- void OnDraw(ID2D1DeviceContext* device_context) override;
-
- void OnMouseDownCore(events::MouseButtonEventArgs& args) override final;
-
- void OnGetFocusCore(events::FocusChangeEventArgs& args) override final;
- void OnLoseFocusCore(events::FocusChangeEventArgs& args) override final;
-
- void OnKeyDownCore(events::KeyEventArgs& args) override final;
- void OnCharCore(events::CharEventArgs& args) override final;
-
- Size OnMeasure(const Size& available_size) override final;
-
- private:
- void OnTextChangedCore(const String& old_text, const String& new_text);
-
- void RecreateTextLayout();
-
- private:
- String text_;
-
- Microsoft::WRL::ComPtr<ID2D1Brush> brush_;
- Microsoft::WRL::ComPtr<ID2D1Brush> caret_brush_;
- //Microsoft::WRL::ComPtr<ID2D1Brush> selection_brush_;
- Microsoft::WRL::ComPtr<IDWriteTextFormat> text_format_;
- Microsoft::WRL::ComPtr<IDWriteTextLayout> text_layout_;
-
- unsigned position_ = 0;
-
- TimerTask caret_timer_;
- ActionPtr caret_action_;
- bool is_caret_show_;
- };
-}