#pragma once #include #include #include "BuildingId.h" #include "BuildingType.h" #include "SelectionContext.h" class QPushButton; // The recipe/schematic selection control of the card's configuration group: one button // captioned with the current selection that opens the modal selection dialog // (REQ-UI-SELECT-BUTTON, REQ-UI-CONFIG-INLINE). Used by the Miner and Assembler for // their recipe and by the Shipyard for its schematic; the placeholder caption is the // only difference between the two. // // The control does not apply the choice itself: it asks for the dialog and the choice // arrives back as a command, so the caption follows from the next refresh rather than // from the click. class RecipeSelectionControl : public QWidget { Q_OBJECT public: RecipeSelectionControl(const SelectionContext& context, BuildingId id, BuildingType type, QWidget* parent = nullptr); // Re-reads the caption and tooltip for the currently configured recipe id. void setRecipeId(const std::string& recipeId); private: SelectionContext m_context; BuildingId m_id; BuildingType m_type; QPushButton* m_button; };