mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Move to GetWidgetString for group window.
parent
855175c9c8
commit
1ad5e9b81b
|
@ -84,7 +84,7 @@ static constexpr NWidgetPart _nested_group_widgets[] = {
|
|||
NWidget(NWID_VERTICAL, NWidContainerFlag::EqualSize),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical()), SetFill(0, 1), SetResize(1, 0), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_FILTER_BY_CARGO), SetMinimalSize(0, 12), SetFill(0, 1), SetStringTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_FILTER_BY_CARGO), SetMinimalSize(0, 12), SetFill(0, 1), SetToolTip(STR_TOOLTIP_FILTER_CRITERIA),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(0, 1), SetResize(1, 0), EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
|
@ -96,7 +96,7 @@ static constexpr NWidgetPart _nested_group_widgets[] = {
|
|||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(1, 0), SetFill(1, 1), SetResize(1, 0), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_AVAILABLE_VEHICLES), SetMinimalSize(106, 12),
|
||||
SetStringTip(STR_JUST_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
||||
SetToolTip(STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetResize(1, 0), EndContainer(),
|
||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12),
|
||||
SetStringTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
|
||||
|
@ -502,34 +502,28 @@ public:
|
|||
this->SetDirty();
|
||||
}
|
||||
|
||||
void SetStringParameters(WidgetID widget) const override
|
||||
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GL_FILTER_BY_CARGO:
|
||||
SetDParam(0, this->GetCargoFilterLabel(this->cargo_filter_criteria));
|
||||
break;
|
||||
return GetString(this->GetCargoFilterLabel(this->cargo_filter_criteria));
|
||||
|
||||
case WID_GL_AVAILABLE_VEHICLES:
|
||||
SetDParam(0, STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vli.vtype);
|
||||
break;
|
||||
return GetString(STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vli.vtype);
|
||||
|
||||
case WID_GL_CAPTION:
|
||||
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
|
||||
* We list all vehicles or ungrouped vehicles */
|
||||
if (IsDefaultGroupID(this->vli.ToGroupID()) || IsAllGroupID(this->vli.ToGroupID())) {
|
||||
SetDParam(0, STR_COMPANY_NAME);
|
||||
SetDParam(1, this->vli.company);
|
||||
SetDParam(2, this->vehicles.size());
|
||||
SetDParam(3, this->vehicles.size());
|
||||
return GetString(stringid, STR_COMPANY_NAME, this->vli.company, this->vehicles.size(), this->vehicles.size());
|
||||
} else {
|
||||
uint num_vehicle = GetGroupNumVehicle(this->vli.company, this->vli.ToGroupID(), this->vli.vtype);
|
||||
|
||||
SetDParam(0, STR_GROUP_NAME);
|
||||
SetDParam(1, this->vli.ToGroupID());
|
||||
SetDParam(2, num_vehicle);
|
||||
SetDParam(3, num_vehicle);
|
||||
return GetString(stringid, STR_GROUP_NAME, this->vli.ToGroupID(), num_vehicle, num_vehicle);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return this->Window::GetWidgetString(widget, stringid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue