summaryrefslogtreecommitdiff
path: root/src/signs_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/signs_gui.cpp
parentdcfb2af871b76a7b65fb959b2f4ebc2da2f9e4d3 (diff)
downloadopenttd-f5d8ba5d7f90abc72db6c0470da383ecf82da487.tar.xz
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r--src/signs_gui.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 0e2567dcb..c3b1d490e 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -144,11 +144,12 @@ enum SignListHotkeys {
SLHK_FOCUS_FILTER_BOX, ///< Focus the edit box for editing the filter string
};
-struct SignListWindow : QueryStringBaseWindow, SignList {
+struct SignListWindow : Window, SignList {
+ QueryString filter_editbox; ///< Filter editbox;
int text_offset; ///< Offset of the sign text relative to the left edge of the WID_SIL_LIST widget.
Scrollbar *vscroll;
- SignListWindow(const WindowDesc *desc, WindowNumber window_number) : QueryStringBaseWindow(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
+ SignListWindow(const WindowDesc *desc, WindowNumber window_number) : filter_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
{
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_SIL_SCROLLBAR);
@@ -156,9 +157,10 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
this->SetWidgetLoweredState(WID_SIL_FILTER_MATCH_CASE_BTN, SignList::match_case);
/* Initialize the text edit widget */
- this->ok_button = WID_SIL_FILTER_ENTER_BTN;
- this->cancel_button = WID_SIL_FILTER_CLEAR_BTN;
- this->afilter = CS_ALPHANUMERAL;
+ this->querystrings[WID_SIL_FILTER_TEXT] = &this->filter_editbox;
+ this->filter_editbox.ok_button = WID_SIL_FILTER_ENTER_BTN;
+ this->filter_editbox.cancel_button = WID_SIL_FILTER_CLEAR_BTN;
+ this->filter_editbox.afilter = CS_ALPHANUMERAL;
/* Initialize the filtering variables */
this->SetFilterString("");
@@ -175,7 +177,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
*/
void ClearFilterTextWidget()
{
- this->text.DeleteAll();
+ this->filter_editbox.text.DeleteAll();
this->SetWidgetDirty(WID_SIL_FILTER_TEXT);
}
@@ -314,7 +316,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
virtual void OnEditboxChanged(int widget)
{
- if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->text.buf);
+ if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->filter_editbox.text.buf);
}
void BuildSortSignList()
@@ -428,15 +430,17 @@ static bool RenameSign(SignID index, const char *text)
return remove;
}
-struct SignWindow : QueryStringBaseWindow, SignList {
+struct SignWindow : Window, SignList {
+ QueryString name_editbox;
SignID cur_sign;
- SignWindow(const WindowDesc *desc, const Sign *si) : QueryStringBaseWindow(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
+ SignWindow(const WindowDesc *desc, const Sign *si) : name_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
{
- this->caption = STR_EDIT_SIGN_CAPTION;
- this->cancel_button = WID_QES_CANCEL;
- this->ok_button = WID_QES_OK;
- this->afilter = CS_ALPHANUMERAL;
+ this->querystrings[WID_QES_TEXT] = &this->name_editbox;
+ this->name_editbox.caption = STR_EDIT_SIGN_CAPTION;
+ this->name_editbox.cancel_button = WID_QES_CANCEL;
+ this->name_editbox.ok_button = WID_QES_OK;
+ this->name_editbox.afilter = CS_ALPHANUMERAL;
this->InitNested(desc, WN_QUERY_STRING_SIGN);
@@ -450,9 +454,9 @@ struct SignWindow : QueryStringBaseWindow, SignList {
/* Display an empty string when the sign hasnt been edited yet */
if (si->name != NULL) {
SetDParam(0, si->index);
- this->text.Assign(STR_SIGN_NAME);
+ this->name_editbox.text.Assign(STR_SIGN_NAME);
} else {
- this->text.DeleteAll();
+ this->name_editbox.text.DeleteAll();
}
this->cur_sign = si->index;
@@ -492,7 +496,7 @@ struct SignWindow : QueryStringBaseWindow, SignList {
{
switch (widget) {
case WID_QES_CAPTION:
- SetDParam(0, this->caption);
+ SetDParam(0, this->name_editbox.caption);
break;
}
}
@@ -523,7 +527,7 @@ struct SignWindow : QueryStringBaseWindow, SignList {
break;
case WID_QES_OK:
- if (RenameSign(this->cur_sign, this->text.buf)) break;
+ if (RenameSign(this->cur_sign, this->name_editbox.text.buf)) break;
/* FALL THROUGH */
case WID_QES_CANCEL: