MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / createVehicleAssignmentControl

Method createVehicleAssignmentControl

game/ui/components/controlgenerator.cpp:295–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295sp<Control> ControlGenerator::createVehicleAssignmentControl(GameState &state, sp<Vehicle> vehicle)
296{
297 const int controlLength = 200, controlHeight = 24, iconLenght = 36;
298
299 auto control = mksp<Control>();
300 control->Size = control->SelectionSize = {controlLength, controlHeight};
301 control->setData(vehicle);
302
303 auto icon = createVehicleIcon(state, vehicle);
304 icon->Size = {iconLenght, controlHeight};
305 icon->setParent(control);
306
307 auto nameLabel = control->createChild<Label>(vehicle->name, singleton.labelFont);
308 nameLabel->Size = {controlLength - iconLenght, singleton.labelFont->getFontHeight()};
309 nameLabel->Location = {iconLenght, (control->Size.y - nameLabel->Size.y) / 2};
310
311 return control;
312}
313
314sp<Control> ControlGenerator::createBuildingAssignmentControl(GameState &state,
315 sp<Building> building)

Callers

nothing calls this directly

Calls 3

setDataMethod · 0.80
setParentMethod · 0.80
getFontHeightMethod · 0.45

Tested by

no test coverage detected