12 #ifndef QUERYSTRING_GUI_H 13 #define QUERYSTRING_GUI_H 40 QueryString(uint16 size, uint16 chars = UINT16_MAX) : ok_button(ACTION_NOTHING), cancel_button(ACTION_DESELECT), text(size, chars), orig(NULL)
53 void DrawEditBox(
const Window *w,
int wid)
const;
54 void ClickEditBox(
Window *w,
Point pt,
int wid,
int click_count,
bool focus_changed);
55 void HandleEditBox(
Window *w,
int wid);
67 return this->text.
buf;
86 if (this->text.
markend == 0)
return NULL;
bool IsOSKOpenedFor(const Window *w, int button)
Check whether the OSK is opened for a specific editbox.
static const int ACTION_DESELECT
Deselect editbox.
uint16 markend
the end position of the marked area in the buffer, in bytes
const char * GetText() const
Get the current text.
Stuff related to text buffers.
static const int ACTION_CLEAR
Clear editbox.
Point GetCaretPosition(const Window *w, int wid) const
Get the current caret position.
Helper/buffer for input fields.
Stuff related to the text buffer GUI.
Functions, definitions and such used only by the GUI.
Data structure for an opened window.
static const int ACTION_NOTHING
Nothing.
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.
QueryString(uint16 size, uint16 chars=UINT16_MAX)
Initialize string.
int ok_button
Widget button of parent window to simulate when pressing OK in OSK.
Data stored about a string that can be modified in the GUI.
uint16 caretpos
the current position of the caret in the buffer, in bytes
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
const char * GetCaret() const
Get the position of the caret in the text buffer.
const char * GetMarkedText(size_t *length) const
Get the currently marked text.
char *const buf
buffer in which text is saved
~QueryString()
Make sure everything gets freed.
void ShowOnScreenKeyboard(Window *parent, int button)
Show the on-screen keyboard (osk) associated with a given textbox.
void UpdateOSKOriginalText(const Window *parent, int button)
Updates the original text of the OSK so when the 'parent' changes the original and you press on cance...
Coordinates of a point in 2D.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
Specification of a rectangle with absolute coordinates of all edges.
const char * GetCharAtPosition(const Window *w, int wid, const Point &pt) const
Get the character that is rendered at a position.
uint16 markpos
the start position of the marked area in the buffer, in bytes