Every display naming an item now shows that item's production tooltip, not only the selection panel's chips: the header block stock, the total cost of a building multi-selection, the remaining scrap of a debris selection, the icons of every recipe summary, and a blueprint card's cost. ItemTooltip moves out of the selection panel and takes an ItemTooltipContext of its own -- an item is named all over the UI, and the panel's context carries visuals and a debug flag no tooltip reads. A recipe line wraps each icon with its amount so the pair can be pointed at as one statement, and attaches tooltips only where asked: a module button and the item tooltip itself draw the same line and stay silent. Hover only wherever the display sits on something the player clicks, whose click is not free to explain. Note that a recipe line on an option button can no longer be transparent to the mouse -- Qt never looks inside a transparent widget for the cursor -- so it relies on press propagation to keep picking the option. The header block stock loses world.building_blocks_tooltip, showing what every other block icon shows instead. The Expand button keeps no tooltip: its cost is painted into its face with nowhere to hang one, and the button is due to be removed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
28 lines
1.1 KiB
C++
28 lines
1.1 KiB
C++
#pragma once
|
|
|
|
struct GameConfig;
|
|
class BuildingIconCache;
|
|
class ItemIconCache;
|
|
class Simulation;
|
|
|
|
// Everything an item production tooltip reads (REQ-UI-ITEM-TOOLTIP): the simulation it
|
|
// asks which recipes the player has unlocked, the immutable config holding the recipes
|
|
// themselves, and the two icon caches its recipe lines are drawn from.
|
|
//
|
|
// Its own bundle rather than the selection panel's (SelectionContext), because an item is
|
|
// named all over the UI -- the header bar, the dialogs, the panel -- and every one of
|
|
// those places has to be able to explain it (REQ-UI-ITEM-VALUE-TOOLTIP). The panel's
|
|
// context carries visuals and the debug flag besides, which no tooltip reads.
|
|
//
|
|
// Nothing here is owned: a view onto objects living in MainWindow, which it must not
|
|
// outlive.
|
|
struct ItemTooltipContext
|
|
{
|
|
// Const because a tooltip only ever reads: what produces an item is a question, not
|
|
// a command.
|
|
const Simulation* sim = nullptr;
|
|
const GameConfig* config = nullptr;
|
|
ItemIconCache* itemIcons = nullptr;
|
|
BuildingIconCache* buildingIcons = nullptr;
|
|
};
|