mirror of
https://github.com/OpenTTD/OpenTTD
synced 2025-12-10 06:52:05 +01:00
This commit is contained in:
@@ -921,6 +921,7 @@ struct QueryStringWindow : public Window
|
||||
this->flags = flags;
|
||||
|
||||
this->CreateNestedTree();
|
||||
this->GetWidget<NWidgetStacked>(WID_QS_DEFAULT_SEL)->SetDisplayedPlane((this->flags.Test(QueryStringFlag::EnableDefault)) ? 0 : SZSP_NONE);
|
||||
this->GetWidget<NWidgetStacked>(WID_QS_MOVE_SEL)->SetDisplayedPlane((this->flags.Test(QueryStringFlag::EnableMove)) ? 0 : SZSP_NONE);
|
||||
this->FinishInitNested(WN_QUERY_STRING);
|
||||
|
||||
@@ -929,16 +930,6 @@ struct QueryStringWindow : public Window
|
||||
this->SetFocusedWidget(WID_QS_TEXT);
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
if (widget == WID_QS_DEFAULT && !this->flags.Test(QueryStringFlag::EnableDefault)) {
|
||||
/* We don't want this widget to show! */
|
||||
fill.width = 0;
|
||||
resize.width = 0;
|
||||
size.width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
|
||||
{
|
||||
if (widget == WID_QS_CAPTION) return GetString(this->editbox.caption);
|
||||
@@ -1041,7 +1032,9 @@ static constexpr std::initializer_list<NWidgetPart> _nested_query_string_widgets
|
||||
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 0), SetFill(1, 0), SetPadding(2, 2, 2, 2),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_DEFAULT),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_QS_DEFAULT_SEL),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_DEFAULT),
|
||||
EndContainer(),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_CANCEL),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_OK), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_OK),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_QS_MOVE_SEL),
|
||||
|
||||
@@ -33,6 +33,7 @@ enum QueryStringWidgets : WidgetID {
|
||||
WID_QS_CAPTION, ///< Caption of the window.
|
||||
WID_QS_TEXT, ///< Text of the query.
|
||||
WID_QS_DEFAULT, ///< Default button.
|
||||
WID_QS_DEFAULT_SEL, ///< Container for default button, which can be hidden.
|
||||
WID_QS_CANCEL, ///< Cancel button.
|
||||
WID_QS_OK, ///< OK button.
|
||||
WID_QS_MOVE, ///< Move button.
|
||||
|
||||
Reference in New Issue
Block a user