OpenTTD
|
Data stored about a string that can be modified in the GUI. More...
#include <querystring_gui.h>
Public Member Functions | |
QueryString (uint16 size, uint16 chars=UINT16_MAX) | |
Initialize string. More... | |
~QueryString () | |
Make sure everything gets freed. | |
void | DrawEditBox (const Window *w, int wid) const |
void | ClickEditBox (Window *w, Point pt, int wid, int click_count, bool focus_changed) |
void | HandleEditBox (Window *w, int wid) |
Point | GetCaretPosition (const Window *w, int wid) const |
Get the current caret position. More... | |
Rect | GetBoundingRect (const Window *w, int wid, const char *from, const char *to) const |
Get the bounding rectangle for a range of the query string. More... | |
const char * | GetCharAtPosition (const Window *w, int wid, const Point &pt) const |
Get the character that is rendered at a position. More... | |
const char * | GetText () const |
Get the current text. More... | |
const char * | GetCaret () const |
Get the position of the caret in the text buffer. More... | |
const char * | GetMarkedText (size_t *length) const |
Get the currently marked text. More... | |
Data Fields | |
StringID | caption |
int | ok_button |
Widget button of parent window to simulate when pressing OK in OSK. | |
int | cancel_button |
Widget button of parent window to simulate when pressing CANCEL in OSK. | |
Textbuf | text |
const char * | orig |
bool | handled |
Static Public Attributes | |
static const int | ACTION_NOTHING = -1 |
Nothing. | |
static const int | ACTION_DESELECT = -2 |
Deselect editbox. | |
static const int | ACTION_CLEAR = -3 |
Clear editbox. | |
Data stored about a string that can be modified in the GUI.
Definition at line 22 of file querystring_gui.h.
|
inline |
Initialize string.
size | Maximum size in bytes. |
chars | Maximum size in chars. |
Definition at line 40 of file querystring_gui.h.
Rect QueryString::GetBoundingRect | ( | const Window * | w, |
int | wid, | ||
const char * | from, | ||
const char * | to | ||
) | const |
Get the bounding rectangle for a range of the query string.
w | Window the edit box is in. |
wid | Widget index. |
from | Start of the string range. |
to | End of the string range. |
Definition at line 850 of file misc_gui.cpp.
References Window::GetWidget().
Referenced by ~QueryString().
|
inline |
Get the position of the caret in the text buffer.
Definition at line 74 of file querystring_gui.h.
References Textbuf::buf, and Textbuf::caretpos.
Get the current caret position.
w | Window the edit box is in. |
wid | Widget index. |
Definition at line 820 of file misc_gui.cpp.
References Window::GetWidget().
Referenced by ~QueryString().
Get the character that is rendered at a position.
w | Window the edit box is in. |
wid | Widget index. |
pt | Position to test. |
Definition at line 887 of file misc_gui.cpp.
References Window::GetWidget().
Referenced by ~QueryString().
|
inline |
Get the currently marked text.
[out] | length | Length of the marked text. |
Definition at line 84 of file querystring_gui.h.
References Textbuf::buf, IsOSKOpenedFor(), Textbuf::markend, Textbuf::markpos, ShowOnScreenKeyboard(), and UpdateOSKOriginalText().
|
inline |
Get the current text.
Definition at line 65 of file querystring_gui.h.
References Textbuf::buf.