#include "window_type.h"
#include "string_type.h"
Go to the source code of this file.
Data Structures | |
struct | Textbuf |
struct | querystr_d |
Functions | |
assert_compile (WINDOW_CUSTOM_SIZE >=sizeof(querystr_d)) | |
void | DrawEditBox (Window *w, querystr_d *string, int wid) |
void | HandleEditBox (Window *w, querystr_d *string, int wid) |
int | HandleEditBoxKey (Window *w, querystr_d *string, int wid, WindowEvent *we) |
bool | HandleCaret (Textbuf *tb) |
void | DeleteTextBufferAll (Textbuf *tb) |
Delete every character in the textbuffer. | |
bool | DeleteTextBufferChar (Textbuf *tb, int delmode) |
Delete a character from a textbuffer, either with 'Delete' or 'Backspace' The character is delete from the position the caret is at. | |
bool | InsertTextBufferChar (Textbuf *tb, uint32 key) |
bool | InsertTextBufferClipboard (Textbuf *tb) |
Insert a chunk of text from the clipboard onto the textbuffer. | |
bool | MoveTextBufferPos (Textbuf *tb, int navmode) |
Handle text navigation with arrow keys left/right. | |
void | InitializeTextBuffer (Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth) |
Initialize the textbuffer by supplying it the buffer to write into and the maximum length of this buffer. | |
void | UpdateTextBufferSize (Textbuf *tb) |
Update Textbuf type with its actual physical character and screenlength Get the count of characters in the string as well as the width in pixels. | |
void | ShowQueryString (StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter) |
Show a query popup window with a textbox in it. | |
void | ShowQuery (StringID caption, StringID message, Window *w, void(*callback)(Window *, bool)) |
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre of its parent. |
Definition in file textbuf_gui.h.
void DeleteTextBufferAll | ( | Textbuf * | tb | ) |
Delete every character in the textbuffer.
tb | Textbuf buffer to be emptied |
Definition at line 913 of file misc_gui.cpp.
bool DeleteTextBufferChar | ( | Textbuf * | tb, | |
int | delmode | |||
) |
Delete a character from a textbuffer, either with 'Delete' or 'Backspace' The character is delete from the position the caret is at.
tb | Textbuf type to be changed | |
delmode | Type of deletion, either WKC_BACKSPACE or WKC_DELETE |
Definition at line 896 of file misc_gui.cpp.
void InitializeTextBuffer | ( | Textbuf * | tb, | |
const char * | buf, | |||
uint16 | maxlength, | |||
uint16 | maxwidth | |||
) |
Initialize the textbuffer by supplying it the buffer to write into and the maximum length of this buffer.
tb | Textbuf type which is getting initialized | |
buf | the buffer that will be holding the data for input | |
maxlength | maximum length in characters of this buffer | |
maxwidth | maximum length in pixels of this buffer. If reached, buffer cannot grow, even if maxlength would allow because there is space. A length of zero '0' means the buffer is only restricted by maxlength |
Definition at line 998 of file misc_gui.cpp.
References UpdateTextBufferSize().
Referenced by ShowQueryString().
bool InsertTextBufferClipboard | ( | Textbuf * | tb | ) |
Insert a chunk of text from the clipboard onto the textbuffer.
Get TEXT clipboard and append this up to the maximum length (either absolute or screenlength). If maxlength is zero, we don't care about the screenlength but only about the physical length of the string
tb | Textbuf type to be changed |
tb | Textbuf type to be changed |
Definition at line 179 of file os2.cpp.
References convert_from_fs(), FS2OTTD(), and Utf8CharLen().
bool MoveTextBufferPos | ( | Textbuf * | tb, | |
int | navmode | |||
) |
Handle text navigation with arrow keys left/right.
This defines where the caret will blink and the next characer interaction will occur
tb | Textbuf type where navigation occurs | |
navmode | Direction in which navigation occurs WKC_LEFT, WKC_RIGHT, WKC_END, WKC_HOME |
Definition at line 952 of file misc_gui.cpp.
References Utf8PrevChar().
void ShowQuery | ( | StringID | caption, | |
StringID | message, | |||
Window * | parent, | |||
void(*)(Window *, bool) | callback | |||
) |
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre of its parent.
NOTE: You cannot use BindCString as parameter for this window!
caption | string shown as window caption | |
message | string that will be shown for the window | |
parent | pointer to parent window, if this pointer is NULL the parent becomes the main window WC_MAIN_WINDOW | |
callback | callback function pointer to set in the window descriptor |
Definition at line 1340 of file misc_gui.cpp.
References AllocateWindowDesc().
Referenced by CmdPause().
void ShowQueryString | ( | StringID | str, | |
StringID | caption, | |||
uint | maxlen, | |||
uint | maxwidth, | |||
Window * | parent, | |||
CharSetFilter | afilter | |||
) |
Show a query popup window with a textbox in it.
str | StringID for the text shown in the textbox | |
caption | StringID of text shown in caption of querywindow | |
maxlen | maximum length in characters allowed. If bit 12 is set we will not check the resulting string against to original string to return success | |
maxwidth | maximum width in pixels allowed | |
parent | pointer to a Window that will handle the events (ok/cancel) of this window. If NULL, results are handled by global function HandleOnEditText | |
afilter | filters out unwanted character input |
Definition at line 1219 of file misc_gui.cpp.
References AllocateWindowDesc(), and InitializeTextBuffer().
Referenced by GroupWndProc(), PatchesSelectionWndProc(), PlayerCompanyWndProc(), SelectPlayerFaceWndProc(), StationViewWndProc(), and VehicleDetailsWndProc().
void UpdateTextBufferSize | ( | Textbuf * | tb | ) |
Update Textbuf type with its actual physical character and screenlength Get the count of characters in the string as well as the width in pixels.
Useful when copying in a larger amount of text at once
tb | Textbuf type which length is calculated |
Definition at line 1013 of file misc_gui.cpp.
References buf, and Utf8CharLen().
Referenced by IConsoleHistoryNavigate(), and InitializeTextBuffer().