# osk_gui.cpp File Reference

The On Screen Keyboard GUI. More...

`#include "stdafx.h"`
`#include "string_func.h"`
`#include "strings_func.h"`
`#include "debug.h"`
`#include "window_func.h"`
`#include "gfx_func.h"`
`#include "querystring_gui.h"`
`#include "table/sprites.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures

struct | OskWindow

## Enumerations

enum | OskWidgets { OSK_WIDGET_TEXT = 3, OSK_WIDGET_CANCEL = 5, OSK_WIDGET_OK, OSK_WIDGET_BACKSPACE, OSK_WIDGET_SPECIAL, OSK_WIDGET_CAPS, OSK_WIDGET_SHIFT, OSK_WIDGET_SPACE, OSK_WIDGET_LEFT, OSK_WIDGET_RIGHT, OSK_WIDGET_LETTERS }
enum | { KEYS_NONE, KEYS_SHIFT, KEYS_CAPS }

## Functions

void | GetKeyboardLayout ()
| Retrieve keyboard layout from language string or (if set) config file.
void | ShowOnScreenKeyboard (QueryStringBaseWindow *parent, int button, int cancel, int ok)
| Show the on-screen keyboard (osk) associated with a given textbox.

## Variables

char | _keyboard_opt [2][OSK_KEYBOARD_ENTRIES *4+1]
| The number of characters has to be OSK_KEYBOARD_ENTRIES.
static WChar | _keyboard [2][OSK_KEYBOARD_ENTRIES]
static byte | _keystate = KEYS_NONE
static const Widget | _osk_widgets []
static const WindowDesc | _osk_desc (WDP_CENTER, WDP_CENTER, 256, 140, 256, 140, WC_OSK, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS, _osk_widgets)

## Detailed Description

The On Screen Keyboard GUI.

Definition in file osk_gui.cpp.

## Function Documentation

void GetKeyboardLayout | ( |  | ) |

Retrieve keyboard layout from language string or (if set) config file.

Also check for invalid characters.

Definition at line 322 of file osk_gui.cpp.

References _keyboard_opt, lastof, ShowInfoF(), strecpy(), and StrEmpty().

Referenced by ShowOnScreenKeyboard().

void ShowOnScreenKeyboard | ( | QueryStringBaseWindow * | parent,
|  | int | button,
|  | int | cancel,
|  | int | ok |
| ) |  |  |

Show the on-screen keyboard (osk) associated with a given textbox.

Parameters:

  | parent | pointer to the Window where this keyboard originated from
  | q | querystr_d pointer to the query string of the parent, which is shared for both windows
  | button | widget number of parent's textbox
  | cancel | widget number of parent's cancel button (0 if cancel events should not be passed)
  | ok | widget number of parent's ok button (0 if ok events should not be passed)

Definition at line 383 of file osk_gui.cpp.

References DeleteWindowById(), and GetKeyboardLayout().

## Variable Documentation

char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES *4+1]

The number of characters has to be OSK_KEYBOARD_ENTRIES.

However, these have to be UTF-8 encoded, which means up to 4 bytes per character. Furthermore the string needs to be ''-terminated.

Definition at line 30 of file osk_gui.cpp.

Referenced by GetKeyboardLayout().