# OskWindow Struct Reference

Inheritance diagram for OskWindow:

## Public Member Functions
| OskWindow (const WindowDesc *desc, QueryStringBaseWindow *parent, int button, int cancel, int ok)
void | UpdateOskState ()
| Only show valid characters; do not show characters that would only insert a space when we have a spacebar to do that or characters that are not allowed to be entered.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnPaint ()
| The window must be repainted.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
void | InvalidateParent ()
virtual void | OnMouseLoop ()
| Called for every mouse loop run, which is at least once per (game) tick.
virtual void | OnInvalidateData (int)
| Some data on this window has become invalid.
## Data Fields
StringID | caption
| the caption for this window.
QueryString * | qs
| text-input
int | text_btn
| widget number of parent's text field
int | ok_btn
| widget number of parent's ok button (=0 when ok shouldn't be passed on)
int | cancel_btn
| widget number of parent's cancel button (=0 when cancel shouldn't be passed on; text will be reverted to original)
Textbuf * | text
| pointer to parent's textbuffer (to update caret position)
char * | orig_str_buf
| Original string.
bool | shift
| Is the shift effectively pressed?

## Detailed Description

Definition at line 61 of file osk_gui.cpp.

## Member Function Documentation

virtual void OskWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 127 of file osk_gui.cpp.

References DrawCharCentered(), OSK_WIDGET_LETTERS, and shift.

virtual void OskWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 145 of file osk_gui.cpp.

References Textbuf::buf, cancel_btn, DeleteTextBufferChar(), HasBit(), InsertTextBufferChar(), IsValidChar(), MoveTextBufferPos(), ok_btn, Window::OnClick(), OSK_WIDGET_BACKSPACE, OSK_WIDGET_CANCEL, OSK_WIDGET_CAPS, OSK_WIDGET_LEFT, OSK_WIDGET_LETTERS, OSK_WIDGET_OK, OSK_WIDGET_RIGHT, OSK_WIDGET_SHIFT, OSK_WIDGET_SPACE, OSK_WIDGET_SPECIAL, OSK_WIDGET_TEXT, Window::parent, qs, Window::SetDirty(), Window::SetFocusedWidget(), SetFocusedWindow(), shift, text_btn, ToggleBit(), UpdateOskState(), and UpdateTextBufferSize().

virtual void OskWindow::OnInvalidateData | ( | int | data | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 250 of file osk_gui.cpp.

References OSK_WIDGET_TEXT, and Window::SetWidgetDirty().

virtual void OskWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 138 of file osk_gui.cpp.

References Window::DrawWidgets(), OSK_WIDGET_TEXT, and qs.

virtual void OskWindow::SetStringParameters | ( | int | widget | ) | const`[inline, virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 122 of file osk_gui.cpp.

References caption, OSK_WIDGET_CAPTION, and SetDParam().

The documentation for this struct was generated from the following file:

- src/osk_gui.cpp