mirror of https://github.com/OpenTTD/OpenTTD
Codechange: add and use SetString over directly accessing widget_data
parent
fb06ddafba
commit
b60101853c
|
@ -126,7 +126,7 @@ private:
|
|||
this->bridges.Sort();
|
||||
|
||||
/* Display the current sort variant */
|
||||
this->GetWidget<NWidgetCore>(WID_BBS_DROPDOWN_CRITERIA)->widget_data = BuildBridgeWindow::sorter_names[this->bridges.SortType()];
|
||||
this->GetWidget<NWidgetCore>(WID_BBS_DROPDOWN_CRITERIA)->SetString(BuildBridgeWindow::sorter_names[this->bridges.SortType()]);
|
||||
|
||||
/* Set the modified widgets dirty */
|
||||
this->SetWidgetDirty(WID_BBS_DROPDOWN_CRITERIA);
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_BBS_SCROLLBAR);
|
||||
/* Change the data, or the caption of the gui. Set it to road or rail, accordingly. */
|
||||
this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->widget_data = (transport_type == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION;
|
||||
this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->SetString((transport_type == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION);
|
||||
this->FinishInitNested(transport_type); // Initializes 'this->icon_width'.
|
||||
|
||||
this->parent = FindWindowById(WC_BUILD_TOOLBAR, transport_type);
|
||||
|
|
|
@ -1365,9 +1365,9 @@ class SelectCompanyManagerFaceWindow : public Window
|
|||
this->is_female = HasBit(this->ge, GENDER_FEMALE); // get the gender: 0 == male and 1 == female
|
||||
this->is_moust_male = !is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge) != 0; // is a male face with moustache
|
||||
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT)->widget_data = this->is_female ? STR_FACE_EARRING : STR_FACE_MOUSTACHE;
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_TIE_EARRING_TEXT)->widget_data = this->is_female ? STR_FACE_EARRING : STR_FACE_TIE;
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_LIPS_MOUSTACHE_TEXT)->widget_data = this->is_moust_male ? STR_FACE_MOUSTACHE : STR_FACE_LIPS;
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT)->SetString(this->is_female ? STR_FACE_EARRING : STR_FACE_MOUSTACHE);
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_TIE_EARRING_TEXT)->SetString(this->is_female ? STR_FACE_EARRING : STR_FACE_TIE);
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_LIPS_MOUSTACHE_TEXT)->SetString(this->is_moust_male ? STR_FACE_MOUSTACHE : STR_FACE_LIPS);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -1393,7 +1393,7 @@ public:
|
|||
this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_LOADSAVE)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE);
|
||||
this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_PARTS)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE);
|
||||
this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_MALEFEMALE)->SetDisplayedPlane(advanced ? SZSP_NONE : 0);
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_RANDOM_NEW_FACE)->widget_data = advanced ? STR_FACE_RANDOM : STR_FACE_NEW_FACE_BUTTON;
|
||||
this->GetWidget<NWidgetCore>(WID_SCMF_RANDOM_NEW_FACE)->SetString(advanced ? STR_FACE_RANDOM : STR_FACE_NEW_FACE_BUTTON);
|
||||
|
||||
NWidgetCore *wi = this->GetWidget<NWidgetCore>(WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON);
|
||||
if (advanced) {
|
||||
|
|
|
@ -609,7 +609,7 @@ struct DepotWindow : Window {
|
|||
default: NOT_REACHED();
|
||||
|
||||
case VEH_TRAIN:
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_TRAIN;
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->SetString(STR_TRAIN);
|
||||
|
||||
/* Sprites */
|
||||
this->GetWidget<NWidgetCore>(WID_D_SELL)->SetSprite(SPR_SELL_TRAIN);
|
||||
|
@ -618,7 +618,7 @@ struct DepotWindow : Window {
|
|||
break;
|
||||
|
||||
case VEH_ROAD:
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_LORRY;
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->SetString(STR_LORRY);
|
||||
|
||||
/* Sprites */
|
||||
this->GetWidget<NWidgetCore>(WID_D_SELL)->SetSprite(SPR_SELL_ROADVEH);
|
||||
|
@ -627,7 +627,7 @@ struct DepotWindow : Window {
|
|||
break;
|
||||
|
||||
case VEH_SHIP:
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_SHIP;
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->SetString(STR_SHIP);
|
||||
|
||||
/* Sprites */
|
||||
this->GetWidget<NWidgetCore>(WID_D_SELL)->SetSprite(SPR_SELL_SHIP);
|
||||
|
@ -636,7 +636,7 @@ struct DepotWindow : Window {
|
|||
break;
|
||||
|
||||
case VEH_AIRCRAFT:
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_PLANE;
|
||||
this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->SetString(STR_PLANE);
|
||||
|
||||
/* Sprites */
|
||||
this->GetWidget<NWidgetCore>(WID_D_SELL)->SetSprite(SPR_SELL_AIRCRAFT);
|
||||
|
|
|
@ -408,7 +408,7 @@ public:
|
|||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
this->GetWidget<NWidgetCore>(WID_SL_CAPTION)->widget_data = caption_string;
|
||||
this->GetWidget<NWidgetCore>(WID_SL_CAPTION)->SetString(caption_string);
|
||||
|
||||
this->vscroll = this->GetScrollbar(WID_SL_SCROLLBAR);
|
||||
this->FinishInitNested(0);
|
||||
|
|
|
@ -405,7 +405,7 @@ public:
|
|||
this->BuildGroupList(vli.company);
|
||||
this->group_sb->SetCount(this->groups.size());
|
||||
|
||||
this->GetWidget<NWidgetCore>(WID_GL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vli.vtype;
|
||||
this->GetWidget<NWidgetCore>(WID_GL_CAPTION)->SetString(STR_VEHICLE_LIST_TRAIN_CAPTION + this->vli.vtype);
|
||||
this->GetWidget<NWidgetCore>(WID_GL_LIST_VEHICLE)->SetToolTip(STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vli.vtype);
|
||||
|
||||
this->GetWidget<NWidgetCore>(WID_GL_CREATE_GROUP)->widget_data += this->vli.vtype;
|
||||
|
@ -588,10 +588,10 @@ public:
|
|||
this->GetWidget<NWidgetCore>(WID_GL_REPLACE_PROTECTION)->SetSprite(protect_sprite + this->vli.vtype);
|
||||
|
||||
/* Set text of "group by" dropdown widget. */
|
||||
this->GetWidget<NWidgetCore>(WID_GL_GROUP_BY_DROPDOWN)->widget_data = std::data(this->vehicle_group_by_names)[this->grouping];
|
||||
this->GetWidget<NWidgetCore>(WID_GL_GROUP_BY_DROPDOWN)->SetString(std::data(this->vehicle_group_by_names)[this->grouping]);
|
||||
|
||||
/* Set text of "sort by" dropdown widget. */
|
||||
this->GetWidget<NWidgetCore>(WID_GL_SORT_BY_DROPDOWN)->widget_data = this->GetVehicleSorterNames()[this->vehgroups.SortType()];
|
||||
this->GetWidget<NWidgetCore>(WID_GL_SORT_BY_DROPDOWN)->SetString(this->GetVehicleSorterNames()[this->vehgroups.SortType()]);
|
||||
|
||||
this->DrawWidgets();
|
||||
}
|
||||
|
|
|
@ -2827,7 +2827,7 @@ struct IndustryCargoesWindow : public Window {
|
|||
*/
|
||||
void ComputeIndustryDisplay(IndustryType displayed_it)
|
||||
{
|
||||
this->GetWidget<NWidgetCore>(WID_IC_CAPTION)->widget_data = STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION;
|
||||
this->GetWidget<NWidgetCore>(WID_IC_CAPTION)->SetString(STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION);
|
||||
this->ind_cargo = displayed_it;
|
||||
_displayed_industries.reset();
|
||||
_displayed_industries.set(displayed_it);
|
||||
|
@ -2905,7 +2905,7 @@ struct IndustryCargoesWindow : public Window {
|
|||
*/
|
||||
void ComputeCargoDisplay(CargoID cid)
|
||||
{
|
||||
this->GetWidget<NWidgetCore>(WID_IC_CAPTION)->widget_data = STR_INDUSTRY_CARGOES_CARGO_CAPTION;
|
||||
this->GetWidget<NWidgetCore>(WID_IC_CAPTION)->SetString(STR_INDUSTRY_CARGOES_CARGO_CAPTION);
|
||||
this->ind_cargo = cid + NUM_INDUSTRYTYPES;
|
||||
_displayed_industries.reset();
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ struct NetworkChatWindow : public Window {
|
|||
assert((uint)this->dtype < lengthof(chat_captions));
|
||||
|
||||
this->CreateNestedTree();
|
||||
this->GetWidget<NWidgetCore>(WID_NC_DESTINATION)->widget_data = chat_captions[this->dtype];
|
||||
this->GetWidget<NWidgetCore>(WID_NC_DESTINATION)->SetString(chat_captions[this->dtype]);
|
||||
this->FinishInitNested(type);
|
||||
|
||||
this->SetFocusedWidget(WID_NC_TEXTBOX);
|
||||
|
|
|
@ -308,7 +308,7 @@ public:
|
|||
|
||||
/* When downloading is finished change cancel in ok */
|
||||
if (this->downloaded_bytes == this->total_bytes) {
|
||||
this->GetWidget<NWidgetCore>(WID_NCDS_CANCELOK)->widget_data = STR_BUTTON_OK;
|
||||
this->GetWidget<NWidgetCore>(WID_NCDS_CANCELOK)->SetString(STR_BUTTON_OK);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1003,7 +1003,7 @@ public:
|
|||
this->SetWidgetDisabledState(WID_NCL_TEXTFILE + tft, this->selected == nullptr || this->selected->state != ContentInfo::ALREADY_HERE || !this->selected->GetTextfile(tft).has_value());
|
||||
}
|
||||
|
||||
this->GetWidget<NWidgetCore>(WID_NCL_CANCEL)->widget_data = this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL;
|
||||
this->GetWidget<NWidgetCore>(WID_NCL_CANCEL)->SetString(this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -363,23 +363,23 @@ struct NewsWindow : Window {
|
|||
this->CreateNestedTree();
|
||||
|
||||
/* For company news with a face we have a separate headline in param[0] */
|
||||
if (&desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = std::get<uint64_t>(this->ni->params[0]);
|
||||
if (&desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->SetString(static_cast<StringID>(std::get<uint64_t>(this->ni->params[0])));
|
||||
|
||||
NWidgetCore *nwid = this->GetWidget<NWidgetCore>(WID_N_SHOW_GROUP);
|
||||
if (ni->reftype1 == NR_VEHICLE && nwid != nullptr) {
|
||||
const Vehicle *v = Vehicle::Get(ni->ref1);
|
||||
switch (v->type) {
|
||||
case VEH_TRAIN:
|
||||
nwid->widget_data = STR_TRAIN;
|
||||
nwid->SetString(STR_TRAIN);
|
||||
break;
|
||||
case VEH_ROAD:
|
||||
nwid->widget_data = RoadVehicle::From(v)->IsBus() ? STR_BUS : STR_LORRY;
|
||||
nwid->SetString(RoadVehicle::From(v)->IsBus() ? STR_BUS : STR_LORRY);
|
||||
break;
|
||||
case VEH_SHIP:
|
||||
nwid->widget_data = STR_SHIP;
|
||||
nwid->SetString(STR_SHIP);
|
||||
break;
|
||||
case VEH_AIRCRAFT:
|
||||
nwid->widget_data = STR_PLANE;
|
||||
nwid->SetString(STR_PLANE);
|
||||
break;
|
||||
default:
|
||||
break; // Do nothing
|
||||
|
|
|
@ -1070,8 +1070,8 @@ public:
|
|||
}
|
||||
OrderConditionVariable ocv = order->GetConditionVariable();
|
||||
/* Set the strings for the dropdown boxes. */
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_COMPARATOR)->widget_data = _order_conditional_condition[order->GetConditionComparator()];
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_VARIABLE)->SetString(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv);
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_COMPARATOR)->SetString(_order_conditional_condition[order->GetConditionComparator()]);
|
||||
this->SetWidgetDisabledState(WID_O_COND_COMPARATOR, ocv == OCV_UNCONDITIONALLY);
|
||||
this->SetWidgetDisabledState(WID_O_COND_VALUE, ocv == OCV_REQUIRES_SERVICE || ocv == OCV_UNCONDITIONALLY);
|
||||
break;
|
||||
|
|
|
@ -1093,7 +1093,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
|
|||
|
||||
this->LowerWidget(WID_BROD_DEPOT_NE + _road_depot_orientation);
|
||||
if (RoadTypeIsTram(_cur_roadtype)) {
|
||||
this->GetWidget<NWidgetCore>(WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION;
|
||||
this->GetWidget<NWidgetCore>(WID_BROD_CAPTION)->SetString(STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION);
|
||||
for (WidgetID i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_NW; i++) {
|
||||
this->GetWidget<NWidgetCore>(i)->SetToolTip(STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP);
|
||||
}
|
||||
|
@ -1314,7 +1314,7 @@ public:
|
|||
this->ConstructWindow();
|
||||
|
||||
const RoadTypeInfo *rti = GetRoadTypeInfo(_cur_roadtype);
|
||||
this->GetWidget<NWidgetCore>(WID_BROS_CAPTION)->widget_data = rti->strings.picker_title[rs];
|
||||
this->GetWidget<NWidgetCore>(WID_BROS_CAPTION)->SetString(rti->strings.picker_title[rs]);
|
||||
|
||||
for (WidgetID i = RoadTypeIsTram(_cur_roadtype) ? WID_BROS_STATION_X : WID_BROS_STATION_NE; i < WID_BROS_LT_OFF; i++) {
|
||||
this->GetWidget<NWidgetCore>(i)->SetToolTip(rti->strings.picker_tooltip[rs]);
|
||||
|
|
|
@ -441,7 +441,7 @@ public:
|
|||
if (HasBit(this->filter.facilities, i)) this->LowerWidget(i + WID_STL_TRAIN);
|
||||
}
|
||||
|
||||
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = CompanyStationsWindow::sorter_names[this->stations.SortType()];
|
||||
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->SetString(CompanyStationsWindow::sorter_names[this->stations.SortType()]);
|
||||
}
|
||||
|
||||
~CompanyStationsWindow()
|
||||
|
@ -682,7 +682,7 @@ public:
|
|||
this->stations.SetSortType(index);
|
||||
|
||||
/* Display the current sort variant */
|
||||
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = CompanyStationsWindow::sorter_names[this->stations.SortType()];
|
||||
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->SetString(CompanyStationsWindow::sorter_names[this->stations.SortType()]);
|
||||
|
||||
this->SetDirty();
|
||||
}
|
||||
|
@ -2086,7 +2086,7 @@ struct StationViewWindow : public Window {
|
|||
NOT_REACHED();
|
||||
}
|
||||
/* Display the current sort variant */
|
||||
this->GetWidget<NWidgetCore>(WID_SV_SORT_BY)->widget_data = StationViewWindow::sort_names[index];
|
||||
this->GetWidget<NWidgetCore>(WID_SV_SORT_BY)->SetString(StationViewWindow::sort_names[index]);
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
|
@ -2098,7 +2098,7 @@ struct StationViewWindow : public Window {
|
|||
{
|
||||
this->grouping_index = index;
|
||||
_settings_client.gui.station_gui_group_order = index;
|
||||
this->GetWidget<NWidgetCore>(WID_SV_GROUP_BY)->widget_data = StationViewWindow::group_names[index];
|
||||
this->GetWidget<NWidgetCore>(WID_SV_GROUP_BY)->SetString(StationViewWindow::group_names[index]);
|
||||
switch (StationViewWindow::group_names[index]) {
|
||||
case STR_STATION_VIEW_GROUP_S_V_D:
|
||||
this->groupings[1] = GR_SOURCE;
|
||||
|
@ -2321,7 +2321,7 @@ struct SelectStationWindow : Window {
|
|||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_JS_SCROLLBAR);
|
||||
this->GetWidget<NWidgetCore>(WID_JS_CAPTION)->widget_data = T::IsWaypoint() ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION;
|
||||
this->GetWidget<NWidgetCore>(WID_JS_CAPTION)->SetString(T::IsWaypoint() ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION);
|
||||
this->FinishInitNested(0);
|
||||
this->OnInvalidateData(0);
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ public:
|
|||
this->CreateNestedTree();
|
||||
|
||||
this->town = Town::Get(window_number);
|
||||
if (this->town->larger_town) this->GetWidget<NWidgetCore>(WID_TV_CAPTION)->widget_data = STR_TOWN_VIEW_CITY_CAPTION;
|
||||
if (this->town->larger_town) this->GetWidget<NWidgetCore>(WID_TV_CAPTION)->SetString(STR_TOWN_VIEW_CITY_CAPTION);
|
||||
|
||||
this->FinishInitNested(window_number);
|
||||
|
||||
|
|
|
@ -1959,14 +1959,14 @@ public:
|
|||
|
||||
NWidgetStacked *nwi = this->GetWidget<NWidgetStacked>(WID_VL_CAPTION_SELECTION);
|
||||
if (this->vli.type == VL_SHARED_ORDERS) {
|
||||
this->GetWidget<NWidgetCore>(WID_VL_CAPTION_SHARED_ORDERS)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
|
||||
this->GetWidget<NWidgetCore>(WID_VL_CAPTION_SHARED_ORDERS)->SetString(STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION);
|
||||
/* If we are in the shared orders window, then disable the group-by dropdown menu.
|
||||
* Remove this when the group-by dropdown menu has another option apart from grouping by shared orders. */
|
||||
this->SetWidgetDisabledState(WID_VL_GROUP_ORDER, true);
|
||||
this->SetWidgetDisabledState(WID_VL_GROUP_BY_PULLDOWN, true);
|
||||
nwi->SetDisplayedPlane(BP_SHARED_ORDERS);
|
||||
} else {
|
||||
this->GetWidget<NWidgetCore>(WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vli.vtype;
|
||||
this->GetWidget<NWidgetCore>(WID_VL_CAPTION)->SetString(STR_VEHICLE_LIST_TRAIN_CAPTION + this->vli.vtype);
|
||||
nwi->SetDisplayedPlane(BP_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -2118,12 +2118,12 @@ public:
|
|||
}
|
||||
|
||||
/* Set text of group by dropdown widget. */
|
||||
this->GetWidget<NWidgetCore>(WID_VL_GROUP_BY_PULLDOWN)->widget_data = std::data(this->vehicle_group_by_names)[this->grouping];
|
||||
this->GetWidget<NWidgetCore>(WID_VL_GROUP_BY_PULLDOWN)->SetString(std::data(this->vehicle_group_by_names)[this->grouping]);
|
||||
|
||||
/* Set text of sort by dropdown widget. */
|
||||
this->GetWidget<NWidgetCore>(WID_VL_SORT_BY_PULLDOWN)->widget_data = this->GetVehicleSorterNames()[this->vehgroups.SortType()];
|
||||
this->GetWidget<NWidgetCore>(WID_VL_SORT_BY_PULLDOWN)->SetString(this->GetVehicleSorterNames()[this->vehgroups.SortType()]);
|
||||
|
||||
this->GetWidget<NWidgetCore>(WID_VL_FILTER_BY_CARGO)->widget_data = this->GetCargoFilterLabel(this->cargo_filter_criteria);
|
||||
this->GetWidget<NWidgetCore>(WID_VL_FILTER_BY_CARGO)->SetString(this->GetCargoFilterLabel(this->cargo_filter_criteria));
|
||||
|
||||
this->DrawWidgets();
|
||||
}
|
||||
|
@ -2766,7 +2766,7 @@ struct VehicleDetailsWindow : Window {
|
|||
!v->ServiceIntervalIsCustom() ? STR_VEHICLE_DETAILS_DEFAULT :
|
||||
v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_PERCENT :
|
||||
TimerGameEconomy::UsingWallclockUnits() ? STR_VEHICLE_DETAILS_MINUTES : STR_VEHICLE_DETAILS_DAYS;
|
||||
this->GetWidget<NWidgetCore>(WID_VD_SERVICE_INTERVAL_DROPDOWN)->widget_data = str;
|
||||
this->GetWidget<NWidgetCore>(WID_VD_SERVICE_INTERVAL_DROPDOWN)->SetString(str);
|
||||
|
||||
this->DrawWidgets();
|
||||
}
|
||||
|
|
|
@ -1134,6 +1134,26 @@ void NWidgetCore::SetDataTip(uint32_t widget_data, StringID tool_tip)
|
|||
this->tool_tip = tool_tip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set string of the nested widget.
|
||||
* @param string The new string.
|
||||
*/
|
||||
void NWidgetCore::SetString(StringID string)
|
||||
{
|
||||
this->widget_data = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set string and tool tip of the nested widget.
|
||||
* @param stringThe new string.
|
||||
* @param tool_tip The new tool_tip.
|
||||
*/
|
||||
void NWidgetCore::SetStringTip(StringID string, StringID tool_tip)
|
||||
{
|
||||
this->SetString(string);
|
||||
this->SetToolTip(tool_tip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sprite of the nested widget.
|
||||
* @param sprite The new sprite.
|
||||
|
@ -1143,6 +1163,17 @@ void NWidgetCore::SetSprite(SpriteID sprite)
|
|||
this->widget_data = sprite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sprite and tool tip of the nested widget.
|
||||
* @param sprite The new sprite.
|
||||
* @param tool_tip The new tool_tip.
|
||||
*/
|
||||
void NWidgetCore::SetSpriteTip(SpriteID sprite, StringID tool_tip)
|
||||
{
|
||||
this->SetSprite(sprite);
|
||||
this->SetToolTip(tool_tip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text style of the nested widget.
|
||||
* @param colour TextColour to use.
|
||||
|
|
|
@ -373,9 +373,10 @@ public:
|
|||
NWidgetCore(WidgetType tp, Colours colour, WidgetID index, uint fill_x, uint fill_y, uint32_t widget_data, StringID tool_tip);
|
||||
|
||||
void SetDataTip(uint32_t widget_data, StringID tool_tip);
|
||||
void SetStringTip(StringID string, StringID tool_tip) { this->SetDataTip(string, tool_tip); }
|
||||
void SetString(StringID string);
|
||||
void SetStringTip(StringID string, StringID tool_tip);
|
||||
void SetSprite(SpriteID sprite);
|
||||
void SetSpriteTip(SpriteID sprite, StringID tool_tip) { this->SetSprite(sprite); this->SetToolTip(tool_tip); }
|
||||
void SetSpriteTip(SpriteID sprite, StringID tool_tip);
|
||||
void SetMatrixDataTip(uint8_t cols, uint8_t rows, StringID tip) { this->SetDataTip(static_cast<uint32_t>((rows << MAT_ROW_START) | (cols << MAT_COL_START)), tip); }
|
||||
void SetToolTip(StringID tool_tip);
|
||||
StringID GetToolTip() const;
|
||||
|
|
Loading…
Reference in New Issue