diff options
author | frosch <frosch@openttd.org> | 2013-03-17 13:05:45 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-03-17 13:05:45 +0000 |
commit | c2c50b0c507d427caa32f71eda009bba95fac684 (patch) | |
tree | f21279587550f7711729c87c56ab67369e6c3799 /src/textbuf_type.h | |
parent | 1ddf5a0786a59431c3092673fd65a7a8aca755a3 (diff) | |
download | openttd-c2c50b0c507d427caa32f71eda009bba95fac684.tar.xz |
(svn r25092) -Codechange: Deduplicate keyboard handling between console and editboxes.
Diffstat (limited to 'src/textbuf_type.h')
-rw-r--r-- | src/textbuf_type.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/textbuf_type.h b/src/textbuf_type.h index e467a70da..d0b75f818 100644 --- a/src/textbuf_type.h +++ b/src/textbuf_type.h @@ -15,6 +15,18 @@ #include "string_type.h" #include "strings_type.h" +/** + * Return values for Textbuf::HandleKeypress + */ +enum HandleKeyPressResult +{ + HKPR_EDITING, ///< Textbuf content changed. + HKPR_CURSOR, ///< Non-text change, e.g. cursor position. + HKPR_CONFIRM, ///< Return or enter key pressed. + HKPR_CANCEL, ///< Escape key pressed. + HKPR_NOT_HANDLED, ///< Key does not affect editboxes. +}; + /** Helper/buffer for input fields. */ struct Textbuf { CharSetFilter afilter; ///< Allowed characters @@ -43,6 +55,8 @@ struct Textbuf { bool DeleteChar(uint16 keycode); bool MovePos(uint16 keycode); + HandleKeyPressResult HandleKeyPress(uint16 key, uint16 keycode); + bool HandleCaret(); void UpdateSize(); |