rubidium@8737: /* $Id$ */ rubidium@8737: rubidium@8737: /** @file osk_gui.cpp The On Screen Keyboard GUI */ rubidium@8737: rubidium@8737: #include "stdafx.h" rubidium@8737: #include "openttd.h" rubidium@8737: rubidium@8737: #include "textbuf_gui.h" rubidium@8737: #include "window_gui.h" rubidium@8737: #include "string_func.h" rubidium@8737: #include "strings_func.h" rubidium@8737: #include "debug.h" rubidium@8737: #include "window_func.h" rubidium@8737: #include "gfx_func.h" rubidium@9179: #include "querystring_gui.h" rubidium@8737: rubidium@8737: #include "table/sprites.h" rubidium@8737: #include "table/strings.h" rubidium@8737: rubidium@8737: enum OskWidgets { rubidium@8737: OSK_WIDGET_TEXT = 3, rubidium@8737: OSK_WIDGET_CANCEL = 5, rubidium@8737: OSK_WIDGET_OK, rubidium@8737: OSK_WIDGET_BACKSPACE, rubidium@8737: OSK_WIDGET_SPECIAL, rubidium@8737: OSK_WIDGET_CAPS, rubidium@8737: OSK_WIDGET_SHIFT, rubidium@8737: OSK_WIDGET_SPACE, rubidium@8737: OSK_WIDGET_LEFT, rubidium@8737: OSK_WIDGET_RIGHT, rubidium@8737: OSK_WIDGET_LETTERS rubidium@8737: }; rubidium@8737: rubidium@8737: char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; rubidium@8737: static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES]; rubidium@8737: rubidium@8737: enum { rubidium@8737: KEYS_NONE, rubidium@8737: KEYS_SHIFT, rubidium@8737: KEYS_CAPS rubidium@8737: }; rubidium@8737: static byte _keystate = KEYS_NONE; rubidium@8737: rubidium@9179: struct OskWindow : public Window { rubidium@9239: StringID caption; ///< the caption for this window. rubidium@9179: QueryString *qs; ///< text-input rubidium@9179: int text_btn; ///< widget number of parent's text field rubidium@9179: int ok_btn; ///< widget number of parent's ok button (=0 when ok shouldn't be passed on) rubidium@9179: int cancel_btn; ///< widget number of parent's cancel button (=0 when cancel shouldn't be passed on; text will be reverted to original) rubidium@9179: Textbuf *text; ///< pointer to parent's textbuffer (to update caret position) rubidium@9897: char *orig_str_buf; ///< Original string. rubidium@9179: rubidium@9179: OskWindow(const WindowDesc *desc, QueryStringBaseWindow *parent, int button, int cancel, int ok) : Window(desc) rubidium@9179: { rubidium@9179: this->parent = parent; rubidium@9179: assert(parent != NULL); rubidium@9179: rubidium@9239: this->caption = (parent->widget[button].data != STR_NULL) ? parent->widget[button].data : parent->caption; rubidium@9179: rubidium@9179: this->qs = parent; rubidium@9179: this->text_btn = button; rubidium@9179: this->cancel_btn = cancel; rubidium@9179: this->ok_btn = ok; rubidium@9179: this->text = &parent->text; rubidium@9179: rubidium@9179: /* make a copy in case we need to reset later */ rubidium@9897: this->orig_str_buf = strdup(this->qs->text.buf); rubidium@9179: rubidium@9179: /* Not needed by default. */ rubidium@9179: this->DisableWidget(OSK_WIDGET_SPECIAL); rubidium@9179: rubidium@9179: this->FindWindowPlacementAndResize(desc); rubidium@8737: } rubidium@8737: rubidium@9897: ~OskWindow() rubidium@9897: { rubidium@9897: free(this->orig_str_buf); rubidium@9897: } rubidium@9897: rubidium@9179: /** rubidium@9179: * Only show valid characters; do not show characters that would rubidium@9179: * only insert a space when we have a spacebar to do that or rubidium@9179: * characters that are not allowed to be entered. rubidium@9179: */ rubidium@9179: void ChangeOskDiabledState(bool shift) rubidium@9179: { rubidium@9179: for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { rubidium@9179: this->SetWidgetDisabledState(OSK_WIDGET_LETTERS + i, rubidium@9179: !IsValidChar(_keyboard[shift][i], this->qs->afilter) || _keyboard[shift][i] == ' '); rubidium@9179: } rubidium@9179: this->SetWidgetDisabledState(OSK_WIDGET_SPACE, !IsValidChar(' ', this->qs->afilter)); rubidium@9179: } rubidium@8737: rubidium@9179: virtual void OnPaint() rubidium@9179: { rubidium@9179: bool shift = HasBit(_keystate, KEYS_CAPS) ^ HasBit(_keystate, KEYS_SHIFT); rubidium@9179: rubidium@9179: this->LowerWidget(OSK_WIDGET_TEXT); rubidium@9179: this->SetWidgetLoweredState(OSK_WIDGET_SHIFT, HasBit(_keystate, KEYS_SHIFT)); rubidium@9179: this->SetWidgetLoweredState(OSK_WIDGET_CAPS, HasBit(_keystate, KEYS_CAPS)); rubidium@9179: rubidium@9179: this->ChangeOskDiabledState(shift); rubidium@9179: rubidium@9239: SetDParam(0, this->caption); rubidium@9273: this->DrawWidgets(); rubidium@9179: rubidium@9179: for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { rubidium@9179: DrawCharCentered(_keyboard[shift][i], rubidium@9179: this->widget[OSK_WIDGET_LETTERS + i].left + 8, rubidium@9179: this->widget[OSK_WIDGET_LETTERS + i].top + 3, rubidium@9179: TC_BLACK); rubidium@9179: } rubidium@9179: rubidium@9179: this->qs->DrawEditBox(this, OSK_WIDGET_TEXT); rubidium@9179: } rubidium@9179: rubidium@9179: virtual void OnClick(Point pt, int widget) rubidium@9179: { rubidium@9179: /* clicked a letter */ rubidium@9179: if (widget >= OSK_WIDGET_LETTERS) { rubidium@8737: bool shift = HasBit(_keystate, KEYS_CAPS) ^ HasBit(_keystate, KEYS_SHIFT); rubidium@8737: rubidium@9179: WChar c = _keyboard[shift][widget - OSK_WIDGET_LETTERS]; rubidium@8737: rubidium@9179: if (!IsValidChar(c, this->qs->afilter)) return; rubidium@9179: rubidium@9179: if (InsertTextBufferChar(&this->qs->text, c)) this->InvalidateWidget(OSK_WIDGET_TEXT); rubidium@9179: rubidium@9179: if (HasBit(_keystate, KEYS_SHIFT)) { rubidium@9179: ToggleBit(_keystate, KEYS_SHIFT); belugas@9778: this->widget[OSK_WIDGET_SHIFT].color = HasBit(_keystate, KEYS_SHIFT) ? COLOUR_WHITE : COLOUR_GREY; rubidium@9179: this->SetDirty(); rubidium@8737: } rubidium@9179: return; rubidium@8737: } rubidium@8737: glx@9216: bool delete_this = false; glx@9216: rubidium@9179: switch (widget) { rubidium@9179: case OSK_WIDGET_BACKSPACE: rubidium@9179: if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateWidget(OSK_WIDGET_TEXT); rubidium@9179: break; rubidium@8737: rubidium@9179: case OSK_WIDGET_SPECIAL: rubidium@9179: /* rubidium@9179: * Anything device specific can go here. rubidium@9179: * The button itself is hidden by default, and when you need it you rubidium@9179: * can not hide it in the create event. rubidium@9179: */ rubidium@9179: break; rubidium@8737: rubidium@9179: case OSK_WIDGET_CAPS: rubidium@9179: ToggleBit(_keystate, KEYS_CAPS); rubidium@9179: this->SetDirty(); rubidium@9179: break; rubidium@9179: rubidium@9179: case OSK_WIDGET_SHIFT: rubidium@9179: ToggleBit(_keystate, KEYS_SHIFT); rubidium@9179: this->SetDirty(); rubidium@9179: break; rubidium@9179: rubidium@9179: case OSK_WIDGET_SPACE: rubidium@9179: if (InsertTextBufferChar(&this->qs->text, ' ')) this->InvalidateWidget(OSK_WIDGET_TEXT); rubidium@9179: break; rubidium@9179: rubidium@9179: case OSK_WIDGET_LEFT: rubidium@9179: if (MoveTextBufferPos(&this->qs->text, WKC_LEFT)) this->InvalidateWidget(OSK_WIDGET_TEXT); rubidium@9179: break; rubidium@9179: rubidium@9179: case OSK_WIDGET_RIGHT: rubidium@9179: if (MoveTextBufferPos(&this->qs->text, WKC_RIGHT)) this->InvalidateWidget(OSK_WIDGET_TEXT); rubidium@9179: break; rubidium@9179: rubidium@9179: case OSK_WIDGET_OK: rubidium@9179: if (this->qs->orig == NULL || strcmp(this->qs->text.buf, this->qs->orig) != 0) { rubidium@9179: /* pass information by simulating a button press on parent window */ rubidium@9179: if (this->ok_btn != 0) { rubidium@9179: this->parent->OnClick(pt, this->ok_btn); glx@9217: /* Window gets deleted when the parent window removes itself. */ glx@9217: return; rubidium@9179: } rubidium@9179: } glx@9216: delete_this = true; rubidium@9179: break; rubidium@9179: rubidium@9179: case OSK_WIDGET_CANCEL: rubidium@9179: if (this->cancel_btn != 0) { // pass a cancel event to the parent window rubidium@9179: this->parent->OnClick(pt, this->cancel_btn); rubidium@9179: /* Window gets deleted when the parent window removes itself. */ glx@9217: return; rubidium@9179: } else { // or reset to original string rubidium@9179: strcpy(qs->text.buf, this->orig_str_buf); rubidium@9179: UpdateTextBufferSize(&qs->text); rubidium@9179: MoveTextBufferPos(&qs->text, WKC_END); glx@9216: delete_this = true; rubidium@8737: } rubidium@8737: break; rubidium@9179: } rubidium@9179: /* make sure that the parent window's textbox also gets updated */ rubidium@9179: if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn); glx@9216: if (delete_this) delete this; rubidium@9179: } rubidium@8737: rubidium@9179: virtual void OnMouseLoop() rubidium@9179: { rubidium@9179: this->qs->HandleEditBox(this, OSK_WIDGET_TEXT); rubidium@9179: /* make the caret of the parent window also blink */ rubidium@9179: this->parent->InvalidateWidget(this->text_btn); rubidium@8737: } smatz@9399: smatz@9399: virtual void OnInvalidateData(int) smatz@9399: { smatz@9399: this->InvalidateWidget(OSK_WIDGET_TEXT); smatz@9399: } rubidium@9179: }; rubidium@8737: rubidium@8737: static const Widget _osk_widgets[] = { belugas@9760: { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, belugas@9760: { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 0, 255, 0, 13, STR_012D, STR_NULL}, belugas@9760: { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 255, 14, 29, 0x0, STR_NULL}, belugas@9760: { WWT_EDITBOX, RESIZE_NONE, COLOUR_GREY, 2, 253, 16, 27, 0x0, STR_NULL}, rubidium@8737: belugas@9760: { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 255, 30, 139, 0x0, STR_NULL}, rubidium@8737: belugas@9760: { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 3, 108, 35, 46, STR_012E_CANCEL, STR_NULL}, belugas@9760: { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 111, 216, 35, 46, STR_012F_OK, STR_NULL}, belugas@9760: { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 219, 252, 35, 46, SPR_OSK_BACKSPACE, STR_NULL}, rubidium@8737: belugas@9760: { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 27, 67, 82, SPR_OSK_SPECIAL, STR_NULL}, belugas@9760: { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 36, 85, 100, SPR_OSK_CAPS, STR_NULL}, belugas@9760: { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 27, 103, 118, SPR_OSK_SHIFT, STR_NULL}, belugas@9760: belugas@9760: { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 75, 189, 121, 136, STR_EMPTY, STR_NULL}, belugas@9760: belugas@9760: { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 219, 234, 121, 136, SPR_OSK_LEFT, STR_NULL}, belugas@9760: { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 237, 252, 121, 136, SPR_OSK_RIGHT, STR_NULL}, belugas@9760: belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 3, 18, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 21, 36, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 39, 54, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 57, 72, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 75, 90, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 93, 108, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 111, 126, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 129, 144, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 147, 162, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 165, 180, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 183, 198, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 201, 216, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 219, 234, 49, 64, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 237, 252, 49, 64, 0x0, STR_NULL}, belugas@9760: belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 30, 45, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 48, 63, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 66, 81, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 84, 99, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 102, 117, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 120, 135, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 138, 153, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 156, 171, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 174, 189, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 192, 207, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 210, 225, 67, 82, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 228, 243, 67, 82, 0x0, STR_NULL}, belugas@9760: belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 39, 54, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 57, 72, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 75, 90, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 93, 108, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 111, 126, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 129, 144, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 147, 162, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 165, 180, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 183, 198, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 201, 216, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 219, 234, 85, 100, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 237, 252, 85, 100, 0x0, STR_NULL}, belugas@9760: belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 30, 45, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 48, 63, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 66, 81, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 84, 99, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 102, 117, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 120, 135, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 138, 153, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 156, 171, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 174, 189, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 192, 207, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 210, 225, 103, 118, 0x0, STR_NULL}, belugas@9760: { WWT_PUSHBTN, RESIZE_NONE, COLOUR_GREY, 228, 243, 103, 118, 0x0, STR_NULL}, rubidium@8737: rubidium@8737: { WIDGETS_END}, rubidium@8737: }; rubidium@8737: rubidium@9317: static const WindowDesc _osk_desc = { rubidium@8737: WDP_CENTER, WDP_CENTER, 256, 140, 256, 140, rubidium@8737: WC_OSK, WC_NONE, rubidium@8737: WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, rubidium@8737: _osk_widgets, rubidium@8737: }; rubidium@8737: rubidium@8737: /** rubidium@8737: * Retrieve keyboard layout from language string or (if set) config file. rubidium@8737: * Also check for invalid characters. rubidium@8737: */ rubidium@8737: void GetKeyboardLayout() rubidium@8737: { rubidium@8737: char keyboard[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; rubidium@8737: char errormark[2][OSK_KEYBOARD_ENTRIES + 1]; // used for marking invalid chars rubidium@8737: bool has_error = false; // true when an invalid char is detected rubidium@8737: rubidium@8737: if (StrEmpty(_keyboard_opt[0])) { rubidium@8737: GetString(keyboard[0], STR_OSK_KEYBOARD_LAYOUT, lastof(keyboard[0])); rubidium@8737: } else { rubidium@10201: strecpy(keyboard[0], _keyboard_opt[0], lastof(keyboard[0])); rubidium@8737: } rubidium@8737: rubidium@8737: if (StrEmpty(_keyboard_opt[1])) { rubidium@8737: GetString(keyboard[1], STR_OSK_KEYBOARD_LAYOUT_CAPS, lastof(keyboard[1])); rubidium@8737: } else { rubidium@10201: strecpy(keyboard[1], _keyboard_opt[1], lastof(keyboard[1])); rubidium@8737: } rubidium@8737: rubidium@8737: for (uint j = 0; j < 2; j++) { rubidium@8737: const char *kbd = keyboard[j]; rubidium@8739: bool ended = false; rubidium@8737: for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { rubidium@8737: _keyboard[j][i] = Utf8Consume(&kbd); rubidium@8737: rubidium@8739: /* Be lenient when the last characters are missing (is quite normal) */ rubidium@8739: if (_keyboard[j][i] == '\0' || ended) { rubidium@8739: ended = true; rubidium@8739: _keyboard[j][i] = ' '; rubidium@8739: continue; rubidium@8739: } rubidium@8739: rubidium@8737: if (IsPrintable(_keyboard[j][i])) { rubidium@8737: errormark[j][i] = ' '; rubidium@8737: } else { rubidium@8737: has_error = true; rubidium@8737: errormark[j][i] = '^'; rubidium@8737: _keyboard[j][i] = ' '; rubidium@8737: } rubidium@8737: } rubidium@8737: } rubidium@8737: rubidium@8737: if (has_error) { rubidium@8737: ShowInfoF("The keyboard layout you selected contains invalid chars. Please check those chars marked with ^."); rubidium@8737: ShowInfoF("Normal keyboard: %s", keyboard[0]); rubidium@8737: ShowInfoF(" %s", errormark[0]); rubidium@8737: ShowInfoF("Caps Lock: %s", keyboard[1]); rubidium@8737: ShowInfoF(" %s", errormark[1]); rubidium@8737: } rubidium@8737: } rubidium@8737: rubidium@8737: /** rubidium@9314: * Show the on-screen keyboard (osk) associated with a given textbox rubidium@8737: * @param parent pointer to the Window where this keyboard originated from rubidium@8737: * @param q querystr_d pointer to the query string of the parent, which is rubidium@8737: * shared for both windows rubidium@8737: * @param button widget number of parent's textbox rubidium@8737: * @param cancel widget number of parent's cancel button (0 if cancel events rubidium@8737: * should not be passed) rubidium@8737: * @param ok widget number of parent's ok button (0 if ok events should not rubidium@8737: * be passed) rubidium@8737: */ rubidium@9179: void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok) rubidium@8737: { rubidium@8737: DeleteWindowById(WC_OSK, 0); rubidium@8737: rubidium@8737: GetKeyboardLayout(); rubidium@9179: new OskWindow(&_osk_desc, parent, button, cancel, ok); rubidium@8737: }