src/textbuf_gui.h
author terom@terom-desktop
Thu, 24 Jul 2008 16:18:29 +0300
changeset 11185 5036deb1fcaf
parent 10647 51ad0a0c6c17
permissions -rw-r--r--
fix check_available_write_cb buffer-growing logic
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     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
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
     8
#include "window_type.h"
8710
52015340050c (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents: 8620
diff changeset
     9
#include "string_type.h"
9233
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    10
#include "strings_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
    11
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
    12
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
    13
	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
    14
	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
    15
	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
    16
	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
    17
	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
    18
	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
    19
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
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
    21
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
    22
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
    23
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
    24
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
    25
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
    26
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
    27
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
    28
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
    29
void UpdateTextBufferSize(Textbuf *tb);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
10647
51ad0a0c6c17 (svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents: 10499
diff changeset
    31
typedef void QueryCallbackProc(Window*, bool);
51ad0a0c6c17 (svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents: 10499
diff changeset
    32
5682
eeddbbacd4ac (svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents: 5669
diff changeset
    33
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter);
10647
51ad0a0c6c17 (svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents: 10499
diff changeset
    34
void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
9233
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    36
/** The number of 'characters' on the on-screen keyboard. */
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    37
static const uint OSK_KEYBOARD_ENTRIES = 50;
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    38
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    39
/**
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    40
 * The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    41
 * have to be UTF-8 encoded, which means up to 4 bytes per character.
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    42
 * Furthermore the string needs to be '\0'-terminated.
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    43
 */
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    44
extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 8710
diff changeset
    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 */