summaryrefslogtreecommitdiff
path: root/src/osk_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-10-10 12:47:04 +0000
committerrubidium <rubidium@openttd.org>2009-10-10 12:47:04 +0000
commit4ab569544b34cda1feb23528bc07aa6e5ae4776e (patch)
tree6015755a069679cee0136e58ee5834475ec3dbb4 /src/osk_gui.cpp
parent66721ffd3657c4daa09693b71e8205bd24c1200a (diff)
downloadopenttd-4ab569544b34cda1feb23528bc07aa6e5ae4776e.tar.xz
(svn r17752) -Fix [FS#3231]: OSK could reset town name to an already used town name for the 'Generate Town' window
Diffstat (limited to 'src/osk_gui.cpp')
-rw-r--r--src/osk_gui.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index fdf89ab21..cb4386ee6 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -547,3 +547,21 @@ void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel,
GetKeyboardLayout();
new OskWindow(&_osk_desc, parent, button, cancel, ok);
}
+
+/**
+ * Updates the original text of the OSK so when the 'parent' changes the
+ * original and you press on cancel you won't get the 'old' original text
+ * but the updated one.
+ * @param parent window that just updated it's orignal text
+ * @param button widget number of parent's textbox to update
+ */
+void UpdateOSKOriginalText(const QueryStringBaseWindow *parent, int button)
+{
+ OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WC_OSK, 0));
+ if (osk == NULL || osk->qs != parent || osk->text_btn != button) return;
+
+ free(osk->orig_str_buf);
+ osk->orig_str_buf = strdup(osk->qs->text.buf);
+
+ osk->SetDirty();
+}