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

Function PrepStatusField

win/X11/winstat.c:370–397  ·  view source on GitHub ↗

set up a specific field other than 'condition'; its general location was specified during widget creation but it might need adjusting */

Source from the content-addressed store, hash-verified

368/* set up a specific field other than 'condition'; its general location
369 was specified during widget creation but it might need adjusting */
370static void
371PrepStatusField(int fld, Widget label, const char *text)
372{
373 Arg args[6];
374 Cardinal num_args;
375 Dimension lbl_wid;
376 XFontStruct *font = X11_status_font;
377 int colrattr = X11_status_colors[fld];
378 struct status_info_t *si = xw_status_win->Win_info.Status_info;
379
380 /* highlight if color and/or attribute(s) are different from last time */
381 if (colrattr != old_field_colors[fld])
382 HiliteField(label, fld, 0, colrattr, &font);
383
384 num_args = 0;
385 (void) memset((genericptr_t) args, 0, sizeof args);
386 /* set up the current text to be displayed */
387 if (text && *text) {
388 lbl_wid = 2 * si->in_wd + XTextWidth(font, text, (int) strlen(text));
389 } else {
390 text = "";
391 lbl_wid = 1;
392 }
393 XtSetArg(args[num_args], nhStr(XtNlabel), text); num_args++;
394 /*XtSetArg(args[num_args], nhStr(XtNwidth), lbl_wid); num_args++;*/
395 XtSetValues(label, args, num_args);
396 XtResizeWidget(label, lbl_wid, si->ht, si->brd);
397}
398
399/* set up one status condition for tty-style status display */
400static void

Callers 1

X11_status_update_ttyFunction · 0.85

Calls 1

HiliteFieldFunction · 0.85

Tested by

no test coverage detected