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

Method createMapRowBase

game/ui/skirmish/mapselector.cpp:112–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112sp<Control> MapSelector::createMapRowBase(StateRef<Base> base, sp<GameState> state)
113{
114 auto control = mksp<Control>();
115
116 const int HEIGHT = 21;
117
118 auto text =
119 control->createChild<Label>(format("[Base] %s", base->name), ui().getFont("smalfont"));
120 text->Location = {0, 0};
121 text->Size = {488, HEIGHT};
122 text->TextVAlign = VerticalAlignment::Centre;
123
124 {
125 auto btnImage = fw().data->loadImage(
126 "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:57:ui/menuopt.pal");
127 auto btnLocation = control->createChild<GraphicButton>(btnImage, btnImage);
128 btnLocation->Location = text->Location + Vec2<int>{text->Size.x, 0};
129 btnLocation->Size = {22, HEIGHT};
130 btnLocation->addCallback(FormEventType::ButtonClick, [base, state, this](Event *) {
131 skirmish.setLocation(base);
132 fw().stageQueueCommand({StageCmd::Command::POP});
133 });
134 }
135
136 return control;
137}
138
139void MapSelector::begin() {}
140

Callers

nothing calls this directly

Calls 6

formatFunction · 0.85
addCallbackMethod · 0.80
stageQueueCommandMethod · 0.80
getFontMethod · 0.45
loadImageMethod · 0.45
setLocationMethod · 0.45

Tested by

no test coverage detected