diff options
author | frosch <frosch@openttd.org> | 2012-11-13 21:46:50 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-11-13 21:46:50 +0000 |
commit | 67f92f16eda1e9d251d665df7ceaa6127af4c593 (patch) | |
tree | 94a89a5e7fd36f6ce2b01338f694ff5c6b26bf1c /src | |
parent | 6d1fe626f5524dc05febe0a715fd9ba80108befd (diff) | |
download | openttd-67f92f16eda1e9d251d665df7ceaa6127af4c593.tar.xz |
(svn r24730) -Codechange: Allow OSK to simulate widget buttons with index 0.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc_gui.cpp | 2 | ||||
-rw-r--r-- | src/osk_gui.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
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) |