#pragma once #include #include #include #include #include #include "ArtifactCountChangedEvent.h" #include "BossWaveUpdatedEvent.h" #include "BuildingBlocksChangedEvent.h" #include "EventHandler.h" #include "GameConfig.h" #include "GameSpeedChangedEvent.h" #include "ItemTooltipContext.h" #include "Tick.h" #include "TickAdvancedEvent.h" class QLabel; class QPushButton; class ItemIconCache; class Simulation; class HeaderBar : public QWidget, public CombinedEventHandler { Q_OBJECT public: // The context carries the simulation the bar reads, the config, and the icon caches // -- the item cache draws the building_block icon in the stock display // (REQ-UI-BLOCKS-ICON), and the stock display explains that item with the cache's // help (REQ-UI-ITEM-VALUE-TOOLTIP). Nothing in it is owned; all of it must outlive // this widget. explicit HeaderBar(const ItemTooltipContext& context, QWidget* parent = nullptr); ~HeaderBar() override; private slots: void onSpeedButton(int index); private: void handleEvent(std::shared_ptr event) override; void handleEvent(std::shared_ptr event) override; void handleEvent(std::shared_ptr event) override; void handleEvent(std::shared_ptr event) override; void handleEvent(std::shared_ptr event) override; // Refreshes the building blocks stock display from the simulation: // `Stock: ` with the building_block icon after it, or the // `Stock: Blocks` text fallback when no icon file exists // (REQ-UI-BLOCKS-ICON). void updateBlocksLabel(); QLabel* m_timeLabel; QLabel* m_blocksLabel; QLabel* m_artifactsLabel; QLabel* m_bossWaveLabel; QLabel* m_nextBossLabel; std::vector m_speedButtons; // Not owned; all of it lives in MainWindow. The simulation it names is the single // source of truth for everything the header displays; the change events are only // refresh signals. ItemTooltipContext m_context; static const double kSpeeds[]; static const int kSpeedCount; };