summaryrefslogtreecommitdiff
path: root/src/osk_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-11-14 22:50:35 +0000
committerfrosch <frosch@openttd.org>2012-11-14 22:50:35 +0000
commitf5d8ba5d7f90abc72db6c0470da383ecf82da487 (patch)
tree3dbbbbe18733005c5851251dac62314d871b2b30 /src/osk_gui.cpp
parentdcfb2af871b76a7b65fb959b2f4ebc2da2f9e4d3 (diff)
downloadopenttd-f5d8ba5d7f90abc72db6c0470da383ecf82da487.tar.xz
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
Diffstat (limited to 'src/osk_gui.cpp')
-rw-r--r--src/osk_gui.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index 2200db05d..69cdabb4f 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -40,18 +40,19 @@ struct OskWindow : public Window {
char *orig_str_buf; ///< Original string.
bool shift; ///< Is the shift effectively pressed?
- OskWindow(const WindowDesc *desc, QueryStringBaseWindow *parent, int button) : Window()
+ OskWindow(const WindowDesc *desc, Window *parent, int button) : Window()
{
this->parent = parent;
assert(parent != NULL);
NWidgetCore *par_wid = parent->GetWidget<NWidgetCore>(button);
assert(par_wid != NULL);
- this->caption = (par_wid->widget_data != STR_NULL) ? par_wid->widget_data : parent->caption;
- this->qs = parent;
+ assert(parent->querystrings.Contains(button));
+ this->qs = parent->querystrings.Find(button)->second;
+ this->caption = (par_wid->widget_data != STR_NULL) ? par_wid->widget_data : this->qs->caption;
this->text_btn = button;
- this->text = &parent->text;
+ this->text = &this->qs->text;
/* make a copy in case we need to reset later */
this->orig_str_buf = strdup(this->qs->text.buf);
@@ -423,7 +424,7 @@ void GetKeyboardLayout()
* @param parent pointer to the Window where this keyboard originated from
* @param button widget number of parent's textbox
*/
-void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button)
+void ShowOnScreenKeyboard(Window *parent, int button)
{
DeleteWindowById(WC_OSK, 0);
@@ -438,10 +439,10 @@ void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button)
* @param parent window that just updated its orignal text
* @param button widget number of parent's textbox to update
*/
-void UpdateOSKOriginalText(const QueryStringBaseWindow *parent, int button)
+void UpdateOSKOriginalText(const Window *parent, int button)
{
OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WC_OSK, 0));
- if (osk == NULL || osk->qs != parent || osk->text_btn != button) return;
+ if (osk == NULL || osk->parent != parent || osk->text_btn != button) return;
free(osk->orig_str_buf);
osk->orig_str_buf = strdup(osk->qs->text.buf);