author | belugas |
Tue, 01 Jan 2008 14:20:48 +0000 | |
changeset 8667 | c916a5375166 |
parent 8620 | 5f1eacb0bc60 |
child 8710 | 52015340050c |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
3 |
/** @file textbuf_gui.h Stuff related to the text buffer GUI. */ |
0 | 4 |
|
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
5 |
#ifndef TEXTBUF_GUI_H |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
6 |
#define TEXTBUF_GUI_H |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1575
diff
changeset
|
7 |
|
8620
5f1eacb0bc60
(svn r11685) -Codechange: remove a few 'useless' includes.
rubidium
parents:
8603
diff
changeset
|
8 |
#include "string.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
9 |
#include "window_type.h" |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
10 |
|
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
11 |
struct Textbuf { |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
12 |
char *buf; ///< buffer in which text is saved |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
13 |
uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
14 |
uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
15 |
bool caret; ///< is the caret ("_") visible or not |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
16 |
uint16 caretpos; ///< the current position of the caret in the buffer, in bytes |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
17 |
uint16 caretxoffs; ///< the current position of the caret in pixels |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1575
diff
changeset
|
18 |
}; |
0 | 19 |
|
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
20 |
struct querystr_d { |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
21 |
StringID caption; |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
22 |
Textbuf text; |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
23 |
const char *orig; |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
24 |
CharSetFilter afilter; |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
25 |
bool handled; |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
26 |
}; |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
27 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d)); |
0 | 28 |
|
29 |
||
2887
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2817
diff
changeset
|
30 |
void DrawEditBox(Window *w, querystr_d *string, int wid); |
d5967e472eee
(svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents:
2817
diff
changeset
|
31 |
void HandleEditBox(Window *w, querystr_d *string, int wid); |
4909
ef77bf81545c
(svn r6879) -Codechange: Remove the superflouos argument CharsetFilter parameter from HandleEditBoxKey
Darkvater
parents:
4830
diff
changeset
|
32 |
int HandleEditBoxKey(Window *w, querystr_d *string, int wid, WindowEvent *we); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
33 |
bool HandleCaret(Textbuf *tb); |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
34 |
|
1879
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1705
diff
changeset
|
35 |
void DeleteTextBufferAll(Textbuf *tb); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
36 |
bool DeleteTextBufferChar(Textbuf *tb, int delmode); |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5044
diff
changeset
|
37 |
bool InsertTextBufferChar(Textbuf *tb, uint32 key); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
38 |
bool InsertTextBufferClipboard(Textbuf *tb); |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
39 |
bool MoveTextBufferPos(Textbuf *tb, int navmode); |
4948
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4909
diff
changeset
|
40 |
void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
41 |
void UpdateTextBufferSize(Textbuf *tb); |
0 | 42 |
|
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5669
diff
changeset
|
43 |
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5291
diff
changeset
|
44 |
void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool)); |
0 | 45 |
|
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
46 |
#endif /* TEXTBUF_GUI_H */ |