(svn r25092) -Codechange: Deduplicate keyboard handling between console and editboxes.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user