#pragma once #include #include #include #include #include #include "BuildingType.h" struct GameConfig; class Simulation; class QPushButton; class ItemIconCache; // One selectable entry in the recipe/schematic selection dialog // (REQ-UI-SELECT-BUTTON). The "(None)" entry uses an empty id. struct RecipeSelectionOption { std::string id; QString caption; QString tooltip; // Id of the item whose icon is shown on the option button (REQ-UI-RECIPE-ICON); // empty for the "(None)" option and for Shipyard schematics, which keep their // caption. When set but no icon file exists, the button falls back to the caption. std::string iconItemId; }; // Builds the lock-aware list of selectable options for a production building // of the given type, with display captions and info tooltips // (REQ-UI-SELECT-BUTTON, REQ-UI-SELECT-TOOLTIP). The first entry is always a // "(None)" option with an empty id. Shared by the selection dialog and the // panel selection button so both render identical captions and tooltips, and // usable for construction sites which have no Building yet (REQ-BLD-SITE-CONFIG). std::vector buildRecipeSelectionOptions( BuildingType type, Simulation& sim, const GameConfig& config); // Modal dialog showing a grid of option buttons (REQ-UI-SELECT-BUTTON). The // game is paused by the caller while it is open. Clicking an option selects it // and closes the dialog; dismissing it (close/Esc) leaves no choice. class RecipeSelectionDialog : public QDialog { Q_OBJECT public: // itemIcons is the window-wide per-item icon cache (REQ-UI-ITEM-ICON); used to // render recipe options icon-only (REQ-UI-RECIPE-ICON). Options whose item has // no icon file fall back to their caption text. Not owned. RecipeSelectionDialog(const std::vector& options, const QString& title, ItemIconCache* itemIcons, QWidget* parent = nullptr); std::optional getChosenId() const; private: void onOptionClicked(int index); std::vector m_optionIds; std::optional m_chosenId; };