tron@2186: /* $Id$ */ tron@2186: rubidium@8603: /** @file textbuf_gui.h Stuff related to the text buffer GUI. */ truelight@0: rubidium@8603: #ifndef TEXTBUF_GUI_H rubidium@8603: #define TEXTBUF_GUI_H Darkvater@1632: rubidium@8603: #include "window_type.h" rubidium@8710: #include "string_type.h" rubidium@9233: #include "strings_type.h" maedhros@7166: rubidium@8603: struct Textbuf { rubidium@8603: char *buf; ///< buffer in which text is saved rubidium@8603: uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes rubidium@8603: uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes rubidium@8603: bool caret; ///< is the caret ("_") visible or not rubidium@8603: uint16 caretpos; ///< the current position of the caret in the buffer, in bytes rubidium@8603: 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@10647: typedef void QueryCallbackProc(Window*, bool); smatz@10647: Darkvater@5682: void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); smatz@10647: void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback); truelight@0: rubidium@9233: /** The number of 'characters' on the on-screen keyboard. */ rubidium@9233: static const uint OSK_KEYBOARD_ENTRIES = 50; rubidium@9233: rubidium@9233: /** rubidium@9233: * The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these rubidium@9233: * have to be UTF-8 encoded, which means up to 4 bytes per character. rubidium@9233: * Furthermore the string needs to be '\0'-terminated. rubidium@9233: */ rubidium@9233: extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; rubidium@9233: rubidium@8603: #endif /* TEXTBUF_GUI_H */