diff options
author | crupest <crupest@outlook.com> | 2018-10-07 00:49:38 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-10-07 00:49:38 +0800 |
commit | 36820c22929f4fb11892c4fbd52f321cc63a55ad (patch) | |
tree | 0c87a377fac3d9359995cb1fa62ec541fe83f579 /src/ui/controls/text_box.h | |
parent | b0057dc911f96258c7280b89c8f4da828ecc283c (diff) | |
download | cru-36820c22929f4fb11892c4fbd52f321cc63a55ad.tar.gz cru-36820c22929f4fb11892c4fbd52f321cc63a55ad.tar.bz2 cru-36820c22929f4fb11892c4fbd52f321cc63a55ad.zip |
Add shift selection, and fix the bug that caret is at wrong position when move with selection.
Diffstat (limited to 'src/ui/controls/text_box.h')
-rw-r--r-- | src/ui/controls/text_box.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/controls/text_box.h b/src/ui/controls/text_box.h index 540ac758..37e04835 100644 --- a/src/ui/controls/text_box.h +++ b/src/ui/controls/text_box.h @@ -36,7 +36,13 @@ namespace cru::ui::controls void OnKeyDownCore(events::KeyEventArgs& args) override final; void OnCharCore(events::CharEventArgs& args) override final; - void RequestChangeCaretPosition(unsigned position) override; + void RequestChangeCaretPosition(unsigned position) override final; + + private: + // return true if left + bool GetCaretSelectionSide() const; + void ShiftLeftSelectionRange(int count); + void ShiftRightSelectionRange(int count); private: unsigned caret_position_ = 0; |