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

Function create_tty_status_field

win/X11/winstat.c:955–993  ·  view source on GitHub ↗

create a widget for a particular status field or potential condition */

Source from the content-addressed store, hash-verified

953
954/* create a widget for a particular status field or potential condition */
955static Widget
956create_tty_status_field(int fld, int condindx, Widget above, Widget left)
957{
958 Arg args[16];
959 Cardinal num_args;
960 char labelname[40];
961 int gap = condindx ? 5 : 0;
962
963 if (!condindx)
964 Sprintf(labelname, "label_%s", bl_idx_to_fldname(fld));
965 else
966 Sprintf(labelname, "cond_%02d", condindx);
967
968 /* set up widget attributes which (mostly) aren't going to be changing */
969 (void) memset((genericptr_t) args, 0, sizeof args);
970 num_args = 0;
971 if (above) {
972 XtSetArg(args[num_args], nhStr(XtNfromVert), above); num_args++;
973 }
974 if (left) {
975 XtSetArg(args[num_args], nhStr(XtNfromHoriz), left); num_args++;
976 }
977
978 XtSetArg(args[num_args], nhStr(XtNhorizDistance), gap); num_args++;
979 XtSetArg(args[num_args], nhStr(XtNvertDistance), 0); num_args++;
980
981 XtSetArg(args[num_args], nhStr(XtNtopMargin), 0); num_args++;
982 XtSetArg(args[num_args], nhStr(XtNbottomMargin), 0); num_args++;
983 XtSetArg(args[num_args], nhStr(XtNleftMargin), 0); num_args++;
984 XtSetArg(args[num_args], nhStr(XtNrightMargin), 0); num_args++;
985 XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft); num_args++;
986 /* internalWidth: default is 4; cut that it half and adjust regular
987 width to have it on both left and right instead of just on the left */
988 XtSetArg(args[num_args], nhStr(XtNinternalWidth), 2); num_args++;
989 XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
990 XtSetArg(args[num_args], nhStr(XtNlabel), ""); num_args++;
991 return XtCreateManagedWidget(labelname, labelWidgetClass,
992 X11_status_widget, args, num_args);
993}
994
995/* create an overall status widget (X11_status_widget) and also
996 separate widgets for all status fields and potential conditions */

Callers 1

create_tty_statusFunction · 0.85

Calls 1

bl_idx_to_fldnameFunction · 0.85

Tested by

no test coverage detected