MCPcopy Create free account
hub / github.com/NetHack/NetHack / menu_create_entries

Function menu_create_entries

win/X11/winmenu.c:1288–1383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286}
1287
1288static void
1289menu_create_entries(struct xwindow *wp, struct menu *curr_menu)
1290{
1291 x11_menu_item *curr;
1292 int menulineidx = 0;
1293 Widget prevlinewidget;
1294 int how = wp->menu_information->how;
1295 Arg args[15];
1296 Cardinal num_args;
1297 Dimension cwidth, maxwidth = 0;
1298
1299 for (curr = curr_menu->base; curr; curr = curr->next) {
1300 char tmpbuf[BUFSZ];
1301 Widget linewidget;
1302 String str = (String) curr->str;
1303 int attr = ATR_NONE;
1304 int color = NO_COLOR;
1305 boolean canpick = (how != PICK_NONE && curr->identifier.a_void);
1306
1307 num_args = 0;
1308 XtSetArg(args[num_args], nhStr(XtNlabel), str); num_args++;
1309 XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft); num_args++;
1310 XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
1311 XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
1312 XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
1313 XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
1314 XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
1315 XtSetArg(args[num_args], nhStr(XtNvertDistance), 0); num_args++;
1316
1317 attr = curr->attr;
1318 if (!wp->menu_information->disable_mcolors)
1319 color = curr->color;
1320
1321 if (color != NO_COLOR) {
1322 if (attr != ATR_INVERSE)
1323 XtSetArg(args[num_args], nhStr(XtNforeground),
1324 get_nhcolor(wp, color).pixel); num_args++;
1325 }
1326
1327 /* TODO: ATR_DIM, ATR_ULINE, ATR_BLINK */
1328
1329 if (attr == ATR_INVERSE) {
1330 XtSetArg(args[num_args], nhStr(XtNforeground),
1331 get_nhcolor(wp, CLR_BLACK).pixel); num_args++;
1332 XtSetArg(args[num_args], nhStr(XtNbackground),
1333 get_nhcolor(wp, color).pixel); num_args++;
1334 }
1335
1336 if (menulineidx) {
1337 XtSetArg(args[num_args], nhStr(XtNfromVert), prevlinewidget);
1338 num_args++;
1339 } else {
1340 XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
1341 }
1342
1343 XtSetArg(args[num_args], XtNtranslations,
1344 menu_entry_translation_table); num_args++;
1345

Callers 1

X11_select_menuFunction · 0.85

Calls 2

get_nhcolorFunction · 0.85
load_boldfontFunction · 0.85

Tested by

no test coverage detected