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

Function create_fancy_status

win/X11/winstat.c:2524–2576  ·  view source on GitHub ↗

* Create the layout for the fancy status. Return a form widget that * contains everything. */

Source from the content-addressed store, hash-verified

2522 * contains everything.
2523 */
2524static Widget
2525create_fancy_status(Widget parent, Widget top)
2526{
2527 Widget form; /* The form that surrounds everything. */
2528 Widget w;
2529 Arg args[8];
2530 Cardinal num_args;
2531 char buf[32];
2532 const struct f_overload *fo;
2533 int i, ff;
2534
2535 num_args = 0;
2536 if (top != (Widget) 0) {
2537 XtSetArg(args[num_args], nhStr(XtNfromVert), top); num_args++;
2538 }
2539 XtSetArg(args[num_args], nhStr(XtNdefaultDistance), 2); num_args++;
2540 XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
2541 XtSetArg(args[num_args], XtNorientation, XtorientHorizontal); num_args++;
2542 form = XtCreateManagedWidget("fancy_status", panedWidgetClass, parent,
2543 args, num_args);
2544
2545 w = init_info_form(form, (Widget) 0, (Widget) 0);
2546#if 0 /* moved to init_info_form() */
2547 w = init_column("status_characteristics", form, (Widget) 0, w,
2548 characteristics_indices, 15);
2549#endif
2550 for (i = 0; i < 3; i++) {
2551 Sprintf(buf, "status_condition%d", i + 1);
2552 w = init_column(buf, form, (Widget) 0, w, status_indices[i], 0);
2553 }
2554 fixup_cond_widths(); /* make all 3 status_conditionN columns same width
2555 * (actually, the slot for F_VERS is much wider) */
2556 /* TODO:
2557 * Calculate and set the width of the F_VERS widjet to be from the
2558 * start of the third condition column through the right edge and
2559 * get rid of the dummy column.
2560 */
2561
2562 /* extra dummy 'column' to allocate any remaining space below the map */
2563 (void) init_column("status_leftover", form, (Widget) 0, w,
2564 leftover_indices, 0);
2565
2566 /* handle overloading; extra conditions don't start out in any column
2567 so need to be initialized separately; the only initialization they
2568 need is to share the widget of the base condition which is present
2569 in one of the columns [could be deferred until first use] */
2570 for (fo = cond_ovl; fo < cond_ovl + SIZE(cond_ovl); ++fo)
2571 for (i = 1; i < NUM_OVLD && (ff = fo->conds[i].ff) > 0; ++i)
2572 if (!shown_stats[ff].w)
2573 shown_stats[ff].w = shown_stats[fo->conds[0].ff].w;
2574
2575 return form;
2576}
2577
2578static void
2579destroy_fancy_status(struct xwindow *wp)

Callers 1

Calls 3

init_info_formFunction · 0.85
init_columnFunction · 0.85
fixup_cond_widthsFunction · 0.85

Tested by

no test coverage detected