1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-16 02:59:10 +00:00

Change: Show full station/roadstop/object class name as tooltip in class list.

This commit is contained in:
2023-12-31 17:15:39 +00:00
parent 5f591d28ae
commit 7dec3d452c
3 changed files with 39 additions and 0 deletions

View File

@@ -510,6 +510,19 @@ public:
if (wid->UpdateVerticalSize(this->name.height)) this->ReInit(0, 0); if (wid->UpdateVerticalSize(this->name.height)) this->ReInit(0, 0);
} }
bool OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_BO_CLASS_LIST) return false;
auto it = this->vscroll->GetScrolledItemFromWidget(this->object_classes, pt.y, this, WID_BO_CLASS_LIST);
if (it == this->object_classes.end()) return false;
StringID str = ObjectClass::Get(*it)->name;
GuiShowTooltips(this, str, close_cond, 0);
return true;
}
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{ {
switch (widget) { switch (widget) {

View File

@@ -1336,6 +1336,19 @@ public:
} }
} }
bool OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_BRAS_NEWST_LIST) return false;
auto it = this->vscroll->GetScrolledItemFromWidget(this->station_classes, pt.y, this, WID_BRAS_NEWST_LIST);
if (it == this->station_classes.end()) return false;
StringID str = StationClass::Get(*it)->name;
GuiShowTooltips(this, str, close_cond, 0);
return true;
}
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{ {
switch (widget) { switch (widget) {

View File

@@ -1512,6 +1512,19 @@ public:
} }
} }
bool OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_BROS_NEWST_LIST) return false;
auto it = this->vscrollList->GetScrolledItemFromWidget(this->roadstop_classes, pt.y, this, WID_BROS_NEWST_LIST);
if (it == this->roadstop_classes.end()) return false;
StringID str = RoadStopClass::Get(*it)->name;
GuiShowTooltips(this, str, close_cond, 0);
return true;
}
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{ {
switch (widget) { switch (widget) {