author | truebrain |
Fri, 13 Jun 2008 19:57:25 +0000 | |
branch | noai |
changeset 10957 | 7a140b4cd91d |
parent 10715 | 6bdf79ffb022 |
permissions | -rw-r--r-- |
9723 | 1 |
/* $Id$ */ |
2 |
||
3 |
/** @file textbuf_gui.h Stuff related to the text buffer GUI. */ |
|
4 |
||
5 |
#ifndef TEXTBUF_GUI_H |
|
6 |
#define TEXTBUF_GUI_H |
|
7 |
||
8 |
#include "window_type.h" |
|
9 |
#include "string_type.h" |
|
9826
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
10 |
#include "strings_type.h" |
9723 | 11 |
|
12 |
struct Textbuf { |
|
13 |
char *buf; ///< buffer in which text is saved |
|
14 |
uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes |
|
15 |
uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes |
|
16 |
bool caret; ///< is the caret ("_") visible or not |
|
17 |
uint16 caretpos; ///< the current position of the caret in the buffer, in bytes |
|
18 |
uint16 caretxoffs; ///< the current position of the caret in pixels |
|
19 |
}; |
|
20 |
||
21 |
bool HandleCaret(Textbuf *tb); |
|
22 |
||
23 |
void DeleteTextBufferAll(Textbuf *tb); |
|
24 |
bool DeleteTextBufferChar(Textbuf *tb, int delmode); |
|
25 |
bool InsertTextBufferChar(Textbuf *tb, uint32 key); |
|
26 |
bool InsertTextBufferClipboard(Textbuf *tb); |
|
27 |
bool MoveTextBufferPos(Textbuf *tb, int navmode); |
|
28 |
void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth); |
|
29 |
void UpdateTextBufferSize(Textbuf *tb); |
|
30 |
||
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10513
diff
changeset
|
31 |
typedef void QueryCallbackProc(Window*, bool); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10513
diff
changeset
|
32 |
|
9723 | 33 |
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10513
diff
changeset
|
34 |
void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback); |
9723 | 35 |
|
9826
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
36 |
/** The number of 'characters' on the on-screen keyboard. */ |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
37 |
static const uint OSK_KEYBOARD_ENTRIES = 50; |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
38 |
|
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
39 |
/** |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
40 |
* The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
41 |
* have to be UTF-8 encoded, which means up to 4 bytes per character. |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
42 |
* Furthermore the string needs to be '\0'-terminated. |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
43 |
*/ |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
44 |
extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; |
9707ad4c9b60
(svn r12462) [NoAI] -Sync: with trunk r12304:12461.
rubidium
parents:
9723
diff
changeset
|
45 |
|
9723 | 46 |
#endif /* TEXTBUF_GUI_H */ |