From f5d8ba5d7f90abc72db6c0470da383ecf82da487 Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 14 Nov 2012 22:50:35 +0000 Subject: (svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead. --- src/newgrf_gui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/newgrf_gui.cpp') diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 1fa6d47e3..bf6487d10 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -585,7 +585,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed); /** * Window for showing NewGRF files */ -struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { +struct NewGRFWindow : public Window, NewGRFScanCallback { typedef GUIList GUIGRFConfigList; static const uint EDITBOX_MAX_SIZE = 50; @@ -599,6 +599,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { const GRFConfig *avail_sel; ///< Currently selected available grf. \c NULL is none is selected. int avail_pos; ///< Index of #avail_sel if existing, else \c -1. StringFilter string_filter; ///< Filter for available grf. + QueryString filter_editbox; ///< Filter editbox; GRFConfig *actives; ///< Temporary active grf list to which changes are made. GRFConfig *active_sel; ///< Selected active grf item. @@ -613,7 +614,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { Scrollbar *vscroll; Scrollbar *vscroll2; - NewGRFWindow(const WindowDesc *desc, bool editable, bool show_params, bool execute, GRFConfig **orig_list) : QueryStringBaseWindow(EDITBOX_MAX_SIZE) + NewGRFWindow(const WindowDesc *desc, bool editable, bool show_params, bool execute, GRFConfig **orig_list) : filter_editbox(EDITBOX_MAX_SIZE) { this->avail_sel = NULL; this->avail_pos = -1; @@ -637,6 +638,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { this->GetWidget(WID_NS_SHOW_APPLY)->SetDisplayedPlane(this->editable ? 0 : this->show_params ? 1 : SZSP_HORIZONTAL); this->FinishInitNested(desc, WN_GAME_OPTIONS_NEWGRF_STATE); + this->querystrings[WID_NS_FILTER] = &this->filter_editbox; this->SetFocusedWidget(WID_NS_FILTER); this->avails.SetListing(this->last_sorting); @@ -1279,7 +1281,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { { if (!this->editable) return; - string_filter.SetFilterTerm(this->text.buf); + string_filter.SetFilterTerm(this->filter_editbox.text.buf); this->avails.SetFilterState(!string_filter.IsEmpty()); this->avails.ForceRebuild(); this->InvalidateData(0); -- cgit v1.2.3-70-g09d2