diff options
author | crupest <crupest@outlook.com> | 2018-11-05 23:29:27 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-11-05 23:29:27 +0800 |
commit | a0e035b18ca81d23d5744a38ff4a9c8b111ecebb (patch) | |
tree | b564f42b633052dc11de78c06656e052d39d1a3b /src/ui/controls/text_control.cpp | |
parent | fb1b16cd0ab189d61efe6237b2c2b1f7f72f90de (diff) | |
download | cru-a0e035b18ca81d23d5744a38ff4a9c8b111ecebb.tar.gz cru-a0e035b18ca81d23d5744a38ff4a9c8b111ecebb.tar.bz2 cru-a0e035b18ca81d23d5744a38ff4a9c8b111ecebb.zip |
Add cursor for text control.
Diffstat (limited to 'src/ui/controls/text_control.cpp')
-rw-r--r-- | src/ui/controls/text_control.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp index 09bc29e1..785e7577 100644 --- a/src/ui/controls/text_control.cpp +++ b/src/ui/controls/text_control.cpp @@ -52,17 +52,24 @@ namespace cru::ui::controls void TextControl::SetSelectable(const bool is_selectable) { - if (!is_selectable) + if (is_selectable_ != is_selectable) { - if (is_selecting_) + if (!is_selectable) { - is_selecting_ = false; - GetWindow()->ReleaseCurrentMouseCapture(); + if (is_selecting_) + { + is_selecting_ = false; + GetWindow()->ReleaseCurrentMouseCapture(); + } + selected_range_ = std::nullopt; + Repaint(); } - selected_range_ = std::nullopt; - Repaint(); + is_selectable_ = is_selectable; + if (is_selectable) //TODO!!! + SetCursor(cursors::i_beam); + else + SetCursor(cursors::arrow); } - is_selectable_ = is_selectable; } void TextControl::SetSelectedRange(std::optional<TextRange> text_range) |