MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Realize

Method Realize

Descent3/newui_core.cpp:1280–1574  ·  view source on GitHub ↗

call this to initialize gadgets specified above in parent window

Source from the content-addressed store, hash-verified

1278
1279// call this to initialize gadgets specified above in parent window
1280void newuiSheet::Realize() {
1281 int i, first_radio_index = -1, last_toggle_index = -1, gx = m_sx, gy = m_sy;
1282 newuiRadioButton *prev_radio = NULL;
1283 bool horizontal_align = false, hotspot_group = false, toggles_group = false;
1284 newuiEditBox *focus_edit = NULL;
1285 UIGadget *focus_gadget = NULL;
1286
1287 if (m_realized)
1288 return;
1289
1290 for (i = 0; i < m_ngadgets; i++) {
1291 newuiSheet::t_gadget_desc *desc = &m_gadgetlist[i];
1292 newuiButton *btn;
1293 newuiCheckBox *cbox;
1294 newuiRadioButton *radio;
1295 newuiSlider *slider;
1296 newuiListBox *lb;
1297 newuiEditBox *edit;
1298 newuiComboBox *cb;
1299 newuiHotspot *hot;
1300 UIText *text;
1301 UIStatic *bmp;
1302 int16_t flags;
1303 bool bval;
1304
1305 switch (desc->type) {
1306 case GADGET_HGROUP:
1307 case GADGET_GROUP:
1308 horizontal_align = (desc->type == GADGET_GROUP) ? false : true;
1309 gx = desc->parm.s[0] + m_sx;
1310 gy = desc->parm.s[1] + m_sy;
1311 if (desc->title) {
1312 text = new UIText;
1313 UITextItem item{MONITOR9_NEWUI_FONT, desc->title, NEWUI_MONITORFONT_COLOR};
1314 text->Create(m_parent, &item, gx, gy);
1315 desc->obj.gadget = text;
1316
1317 // determine pixel offset to first control if we stuffed the offset into desc->id (-1 = default)
1318 if (desc->id != -1) {
1319 gy += text->H() + desc->id;
1320 } else {
1321 gy += text->H();
1322 }
1323 } else {
1324 desc->obj.gadget = NULL;
1325 }
1326
1327 if (toggles_group && last_toggle_index != -1) {
1328 newuiSheet::t_gadget_desc *desc = &m_gadgetlist[last_toggle_index];
1329 desc->obj.chbox->SetFlag(UIF_GROUP_END);
1330 }
1331
1332 prev_radio = NULL;
1333 hotspot_group = false;
1334 toggles_group = false;
1335 first_radio_index = -1;
1336 last_toggle_index = -1;
1337 break;

Callers 4

DoUIMethod · 0.80
FDlg_EnableWaitMessageFunction · 0.80
DoUIMethod · 0.80

Calls 15

HMethod · 0.80
SetFlagMethod · 0.80
WMethod · 0.80
SetCheckMethod · 0.80
SetUnitsMethod · 0.80
SetBufferLenMethod · 0.80
MoveMethod · 0.80
GetIDMethod · 0.80
SetFocusOnGadgetMethod · 0.80
CreateMethod · 0.45
ActivateMethod · 0.45

Tested by

no test coverage detected