Files
dota_factory/src/ui/selection/SelectionNames.h
Malte Langkabel a6152b9998 hold the header's width against a changing status caption
The panel is sized to its card, so anything that changes the card's width drags
the panel with it. The status caption changes as a building works -- "producing"
is shorter than "missing input", which is shorter than "output full" -- and the
panel twitched every time it did. On a Smelter it also changed height, because a
narrower card wraps its item chips differently.

The pill now reserves room for the widest caption it can ever show, so the
header keeps one width whatever the state is. The captions were spelled out in
the switch that chose them, which left no way to ask for the set; they come from
one function now, and the set is what the reservation is built from.

Ship cards do the same with the behaviour names (REQ-UI-SHIP-BEHAVIOR), which
change just as often while a ship fights.

Miner card, sampled every tick for 900 ticks across two different-length
captions: one distinct width, one distinct height. The reservation is what does
it -- the same run without it sits at 138px, with it at 155px, the width of the
longest caption.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcReq7hVk4KUPhTDKWAG7K
2026-08-07 22:07:49 +02:00

22 lines
858 B
C

#pragma once
#include <QString>
#include <QStringList>
#include "BehaviorKind.h"
#include "BuildingType.h"
// Display name of a building type for the selection panel's header and count rows
// (REQ-UI-SELECTION-CARD, REQ-UI-MULTI-SELECTION). The name is derived from the type's
// config id, so a new building type needs no entry here.
QString getBuildingTypeName(BuildingType type);
// Name of the behavior currently governing a ship, for the ship card's header slot
// (REQ-UI-SHIP-BEHAVIOR). Empty when no behavior has won yet, which shows no slot.
QString getBehaviorLabel(BehaviorKind kind);
// Every name getBehaviorLabel can return. A ship's behavior changes as it fights, so the
// header reserves room for the widest of these rather than letting the panel change
// width each time (REQ-UI-SELECTION-PANEL).
QStringList getAllBehaviorLabels();