From 67f92f16eda1e9d251d665df7ceaa6127af4c593 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 13 Nov 2012 21:46:50 +0000 Subject: (svn r24730) -Codechange: Allow OSK to simulate widget buttons with index 0. --- src/misc_gui.cpp | 2 +- src/osk_gui.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 18ec4d8ee..97d218d71 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -826,7 +826,7 @@ HandleEditBoxResult QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, void QueryStringBaseWindow::OnOpenOSKWindow(int wid) { - ShowOnScreenKeyboard(this, wid, 0, 0); + ShowOnScreenKeyboard(this, wid, -1, -1); } /** Class for the string query window. */ diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 19214af1f..2b1ebf75d 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -36,8 +36,8 @@ struct OskWindow : public Window { 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) + int ok_btn; ///< widget number of parent's ok button (-1 when ok shouldn't be passed on) + int cancel_btn; ///< widget number of parent's cancel button (-1 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? @@ -177,7 +177,7 @@ struct OskWindow : public Window { case WID_OSK_OK: if (this->qs->orig == NULL || strcmp(this->qs->text.buf, this->qs->orig) != 0) { /* pass information by simulating a button press on parent window */ - if (this->ok_btn != 0) { + if (this->ok_btn >= 0) { this->parent->OnClick(pt, this->ok_btn, 1); /* Window gets deleted when the parent window removes itself. */ return; @@ -187,7 +187,7 @@ struct OskWindow : public Window { break; case WID_OSK_CANCEL: - if (this->cancel_btn != 0) { // pass a cancel event to the parent window + if (this->cancel_btn >= 0) { // pass a cancel event to the parent window this->parent->OnClick(pt, this->cancel_btn, 1); /* Window gets deleted when the parent window removes itself. */ return; @@ -428,9 +428,9 @@ void GetKeyboardLayout() * Show the on-screen keyboard (osk) associated with a given textbox * @param parent pointer to the Window where this keyboard originated from * @param button widget number of parent's textbox - * @param cancel widget number of parent's cancel button (0 if cancel events + * @param cancel widget number of parent's cancel button (-1 if cancel events * should not be passed) - * @param ok widget number of parent's ok button (0 if ok events should not + * @param ok widget number of parent's ok button (-1 if ok events should not * be passed) */ void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok) -- cgit v1.2.3-70-g09d2