tron@2186: /* $Id$ */ tron@2186: rubidium@8107: /** @file textbuf_gui.h Stuff related to the text buffer GUI. */ truelight@0: rubidium@8107: #ifndef TEXTBUF_GUI_H rubidium@8107: #define TEXTBUF_GUI_H Darkvater@1632: rubidium@8107: #include "window_type.h" rubidium@8214: #include "string_type.h" rubidium@8737: #include "strings_type.h" maedhros@6670: rubidium@8107: struct Textbuf { rubidium@8107: char *buf; ///< buffer in which text is saved rubidium@8107: uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes rubidium@8107: uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes rubidium@8107: bool caret; ///< is the caret ("_") visible or not rubidium@8107: uint16 caretpos; ///< the current position of the caret in the buffer, in bytes rubidium@8107: uint16 caretxoffs; ///< the current position of the caret in pixels Darkvater@1632: }; truelight@0: Darkvater@1390: bool HandleCaret(Textbuf *tb); Darkvater@1390: Darkvater@1879: void DeleteTextBufferAll(Textbuf *tb); Darkvater@1390: bool DeleteTextBufferChar(Textbuf *tb, int delmode); peter1138@5108: bool InsertTextBufferChar(Textbuf *tb, uint32 key); Darkvater@1390: bool InsertTextBufferClipboard(Textbuf *tb); Darkvater@1390: bool MoveTextBufferPos(Textbuf *tb, int navmode); Darkvater@4948: void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth); Darkvater@1390: void UpdateTextBufferSize(Textbuf *tb); truelight@0: smatz@9319: typedef void QueryCallbackProc(Window*, bool); smatz@9319: Darkvater@5431: void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); smatz@9319: void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback); truelight@0: rubidium@8737: /** The number of 'characters' on the on-screen keyboard. */ rubidium@8737: static const uint OSK_KEYBOARD_ENTRIES = 50; rubidium@8737: rubidium@8737: /** rubidium@8737: * The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these rubidium@8737: * have to be UTF-8 encoded, which means up to 4 bytes per character. rubidium@8737: * Furthermore the string needs to be '\0'-terminated. rubidium@8737: */ rubidium@8737: extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; rubidium@8737: rubidium@8107: #endif /* TEXTBUF_GUI_H */