Lines Matching +full:1 +full:- +full:d

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2021-2025 Alfonso Sabato Siciliano
9 * 1. Redistributions of source code must retain the above copyright
40 * -1- Error and diagnostic
46 * ----------------------------------------------------
47 * -2- (Unicode) Multicolumn character strings
54 * ----------------------------------------------------
55 * -3- Buttons
60 * set_buttons(); (to call 1 time after prepare_dialog()).
63 * ----------------------------------------------------
64 * -4- (Auto) Sizing and (Auto) Position
80 * ----------------------------------------------------
81 * -5- (Dialog) Widget components and utils
89 * ----------------------------------------------------
90 * -6- Dialog init/build, update/draw, destroy
101 * -1- Error and diagnostic
114 strncpy(errorbuffer, str, ERRBUFLEN-1); in set_error_string()
122 vsnprintf(errorbuffer, ERRBUFLEN-1, fmt, arg_ptr); in set_fmt_error_string()
127 * -2- (Unicode) Multicolumn character strings
136 nchar = 1; in alloc_mbstows()
140 charlen != (size_t)-1 && charlen != (size_t)-2) { in alloc_mbstows()
157 ws[1] = L'\0'; in mvwaddwch()
175 charlen != (size_t)-1 && charlen != (size_t)-2) { in str_props()
177 return (-1); in str_props()
180 if (w > 1 && wch != L'\t') in str_props()
205 charlen != (size_t)-1 && charlen != (size_t)-2) { in strcols()
217 * -3- Buttons
223 width = bs->nbuttons * bs->sizebutton; in buttons_min_width()
224 if (bs->nbuttons > 0) in buttons_min_width()
225 width += (bs->nbuttons - 1) * t.button.minmargin; in buttons_min_width()
250 for (i = 1; i < size - 1; i++) in draw_button()
257 x = x + 1 + ((size - 2 - strcols(text))/2); in draw_button()
269 void draw_buttons(struct dialog *d) in draw_buttons() argument
274 y = d->h - 2; in draw_buttons()
276 newmargin = d->w - BORDERS - (d->bs.nbuttons * d->bs.sizebutton); in draw_buttons()
277 newmargin /= (d->bs.nbuttons + 1); in draw_buttons()
281 wbuttons = buttons_min_width(&d->bs); in draw_buttons()
284 wbuttons = d->bs.nbuttons * d->bs.sizebutton; in draw_buttons()
285 wbuttons += (d->bs.nbuttons + 1) * margin; in draw_buttons()
288 startx = d->w/2 - wbuttons/2 + newmargin; in draw_buttons()
289 for (i = 0; i < (int)d->bs.nbuttons; i++) { in draw_buttons()
290 x = i * (d->bs.sizebutton + margin); in draw_buttons()
291 draw_button(d->widget, y, startx + x, d->bs.sizebutton, in draw_buttons()
292 d->bs.label[i], d->bs.first[i], i == d->bs.curr, in draw_buttons()
293 d->bs.shortcut); in draw_buttons()
298 set_buttons(struct dialog *d, bool shortcut, const char *oklabel, in set_buttons() argument
307 d->bs.nbuttons = 0; in set_buttons()
308 d->bs.curr = 0; in set_buttons()
309 d->bs.sizebutton = 0; in set_buttons()
310 d->bs.shortcut = shortcut; in set_buttons()
312 if (d->conf->button.left1_label != NULL) { in set_buttons()
313 d->bs.label[d->bs.nbuttons] = d->conf->button.left1_label; in set_buttons()
314 d->bs.value[d->bs.nbuttons] = BSDDIALOG_LEFT1; in set_buttons()
315 d->bs.nbuttons += 1; in set_buttons()
318 if (d->conf->button.left2_label != NULL) { in set_buttons()
319 d->bs.label[d->bs.nbuttons] = d->conf->button.left2_label; in set_buttons()
320 d->bs.value[d->bs.nbuttons] = BSDDIALOG_LEFT2; in set_buttons()
321 d->bs.nbuttons += 1; in set_buttons()
324 if (d->conf->button.left3_label != NULL) { in set_buttons()
325 d->bs.label[d->bs.nbuttons] = d->conf->button.left3_label; in set_buttons()
326 d->bs.value[d->bs.nbuttons] = BSDDIALOG_LEFT3; in set_buttons()
327 d->bs.nbuttons += 1; in set_buttons()
330 if (oklabel != NULL && d->conf->button.without_ok == false) { in set_buttons()
331 d->bs.label[d->bs.nbuttons] = d->conf->button.ok_label != NULL ? in set_buttons()
332 d->conf->button.ok_label : oklabel; in set_buttons()
333 d->bs.value[d->bs.nbuttons] = BSDDIALOG_OK; in set_buttons()
334 d->bs.nbuttons += 1; in set_buttons()
337 if (d->conf->button.with_extra) { in set_buttons()
338 d->bs.label[d->bs.nbuttons] = d->conf->button.extra_label != NULL ? in set_buttons()
339 d->conf->button.extra_label : "Extra"; in set_buttons()
340 d->bs.value[d->bs.nbuttons] = BSDDIALOG_EXTRA; in set_buttons()
341 d->bs.nbuttons += 1; in set_buttons()
344 if (cancellabel != NULL && d->conf->button.without_cancel == false) { in set_buttons()
345 d->bs.label[d->bs.nbuttons] = d->conf->button.cancel_label ? in set_buttons()
346 d->conf->button.cancel_label : cancellabel; in set_buttons()
347 d->bs.value[d->bs.nbuttons] = BSDDIALOG_CANCEL; in set_buttons()
348 if (d->conf->button.default_cancel) in set_buttons()
349 d->bs.curr = d->bs.nbuttons; in set_buttons()
350 d->bs.nbuttons += 1; in set_buttons()
353 if (d->conf->button.with_help) { in set_buttons()
354 d->bs.label[d->bs.nbuttons] = d->conf->button.help_label != NULL ? in set_buttons()
355 d->conf->button.help_label : "Help"; in set_buttons()
356 d->bs.value[d->bs.nbuttons] = BSDDIALOG_HELP; in set_buttons()
357 d->bs.nbuttons += 1; in set_buttons()
360 if (d->conf->button.right1_label != NULL) { in set_buttons()
361 d->bs.label[d->bs.nbuttons] = d->conf->button.right1_label; in set_buttons()
362 d->bs.value[d->bs.nbuttons] = BSDDIALOG_RIGHT1; in set_buttons()
363 d->bs.nbuttons += 1; in set_buttons()
366 if (d->conf->button.right2_label != NULL) { in set_buttons()
367 d->bs.label[d->bs.nbuttons] = d->conf->button.right2_label; in set_buttons()
368 d->bs.value[d->bs.nbuttons] = BSDDIALOG_RIGHT2; in set_buttons()
369 d->bs.nbuttons += 1; in set_buttons()
372 if (d->conf->button.right3_label != NULL) { in set_buttons()
373 d->bs.label[d->bs.nbuttons] = d->conf->button.right3_label; in set_buttons()
374 d->bs.value[d->bs.nbuttons] = BSDDIALOG_RIGHT3; in set_buttons()
375 d->bs.nbuttons += 1; in set_buttons()
378 if (d->bs.nbuttons == 0) { in set_buttons()
379 d->bs.label[0] = DEFAULT_BUTTON_LABEL; in set_buttons()
380 d->bs.value[0] = DEFAULT_BUTTON_VALUE; in set_buttons()
381 d->bs.nbuttons = 1; in set_buttons()
384 for (i = 0; i < (int)d->bs.nbuttons; i++) { in set_buttons()
385 mbtowc(&first, d->bs.label[i], MB_CUR_MAX); in set_buttons()
386 d->bs.first[i] = first; in set_buttons()
389 if (d->conf->button.default_label != NULL) { in set_buttons()
390 for (i = 0; i < (int)d->bs.nbuttons; i++) { in set_buttons()
391 if (strcmp(d->conf->button.default_label, in set_buttons()
392 d->bs.label[i]) == 0) in set_buttons()
393 d->bs.curr = i; in set_buttons()
397 d->bs.sizebutton = MAX(SIZEBUTTON - 2, strcols(d->bs.label[0])); in set_buttons()
398 for (i = 1; i < (int)d->bs.nbuttons; i++) in set_buttons()
399 d->bs.sizebutton = MAX(d->bs.sizebutton, strcols(d->bs.label[i])); in set_buttons()
400 d->bs.sizebutton += 2; in set_buttons()
409 for (i = 0; i < bs->nbuttons; i++) { in shortcut_buttons()
410 if (towlower(key) == towlower(bs->first[i])) { in shortcut_buttons()
411 bs->curr = i; in shortcut_buttons()
421 * -4- (Auto) Sizing and (Auto) Position
427 maxheight = conf->shadow ? SCREENLINES - (int)t.shadow.y : SCREENLINES; in widget_max_height()
429 RETURN_ERROR("Terminal too small, screen lines - shadow <= 0"); in widget_max_height()
431 if (conf->y != BSDDIALOG_CENTER && conf->auto_topmargin > 0) in widget_max_height()
432 RETURN_ERROR("conf.y > 0 and conf->auto_topmargin > 0"); in widget_max_height()
433 else if (conf->y == BSDDIALOG_CENTER) { in widget_max_height()
434 maxheight -= conf->auto_topmargin; in widget_max_height()
436 RETURN_ERROR("Terminal too small, screen lines - top " in widget_max_height()
438 } else if (conf->y > 0) { in widget_max_height()
439 maxheight -= conf->y; in widget_max_height()
441 RETURN_ERROR("Terminal too small, screen lines - " in widget_max_height()
442 "shadow - y <= 0"); in widget_max_height()
445 maxheight -= conf->auto_downmargin; in widget_max_height()
447 RETURN_ERROR("Terminal too small, screen lines - Down margins " in widget_max_height()
457 maxwidth = conf->shadow ? SCREENCOLS - (int)t.shadow.x : SCREENCOLS; in widget_max_width()
459 RETURN_ERROR("Terminal too small, screen cols - shadow <= 0"); in widget_max_width()
461 if (conf->x > 0) { in widget_max_width()
462 maxwidth -= conf->x; in widget_max_width()
464 RETURN_ERROR("Terminal too small, screen cols - shadow " in widget_max_width()
465 "- x <= 0"); in widget_max_width()
477 if (wtext[0] != L'\\' || wtext[1] != L'Z') in is_wtext_attr()
485 #define NL -1
486 #define WS -2
487 #define TB -3
505 tablen = (conf->text.tablen == 0) ? TABSIZE : (int)conf->text.tablen; in text_properties()
508 if ((tp->words = calloc(maxwords, sizeof(int))) == NULL) in text_properties()
514 if ((tp->wletters = calloc(wtextlen, sizeof(uint8_t))) == NULL) in text_properties()
517 tp->nword = 0; in text_properties()
518 tp->maxline = 0; in text_properties()
519 tp->maxwordcols = 0; in text_properties()
520 tp->hasnewline = false; in text_properties()
525 if (conf->text.escape && is_wtext_attr(wtext + i)) { in text_properties()
526 i += 2; /* +1 for update statement */ in text_properties()
530 if (tp->nword + 1 >= maxwords) { in text_properties()
532 tp->words = realloc(tp->words, maxwords * sizeof(int)); in text_properties()
533 if (tp->words == NULL) in text_properties()
539 tp->maxwordcols = MAX(wordcols, tp->maxwordcols); in text_properties()
545 tp->words[tp->nword] = wordcols; in text_properties()
546 tp->nword += 1; in text_properties()
555 tp->words[tp->nword] = TB; in text_properties()
559 tp->hasnewline = true; in text_properties()
560 tp->maxline = MAX(tp->maxline, currlinecols); in text_properties()
563 tp->words[tp->nword] = NL; in text_properties()
567 currlinecols += 1; in text_properties()
569 tp->words[tp->nword] = WS; in text_properties()
572 tp->nword += 1; in text_properties()
574 tp->wletters[l] = wcwidth(wtext[i]); in text_properties()
575 wordcols += tp->wletters[l]; in text_properties()
581 tp->words[tp->nword] = wordcols; in text_properties()
582 tp->nword += 1; in text_properties()
583 tp->maxwordcols = MAX(wordcols, tp->maxwordcols); in text_properties()
586 tp->maxline = MAX(tp->maxline, currlinecols); in text_properties()
599 maxwidth = widget_max_width(conf) - BORDERS - TEXTHMARGINS; in text_autosize()
600 tablen = (conf->text.tablen == 0) ? TABSIZE : (int)conf->text.tablen; in text_autosize()
603 mincols = MAX(mincols, tp->maxwordcols); in text_autosize()
605 (int)conf->auto_minwidth - BORDERS - TEXTHMARGINS); in text_autosize()
611 y = 1; in text_autosize()
614 for (i = 0; i < tp->nword; i++) { in text_autosize()
615 switch (tp->words[i]) { in text_autosize()
637 if (tp->words[i] + x <= mincols) { in text_autosize()
638 x += tp->words[i]; in text_autosize()
639 for (z = 0 ; z != tp->words[i]; l++ ) in text_autosize()
640 z += tp->wletters[l]; in text_autosize()
641 } else if (tp->words[i] <= mincols) { in text_autosize()
643 x = tp->words[i]; in text_autosize()
644 for (z = 0 ; z != tp->words[i]; l++ ) in text_autosize()
645 z += tp->wletters[l]; in text_autosize()
647 for (j = tp->words[i]; j > 0; ) { in text_autosize()
648 y = (x == 0) ? y : y + 1; in text_autosize()
651 z += tp->wletters[l]; in text_autosize()
656 j -= z; in text_autosize()
667 if (line >= y * (int)conf->text.cols_per_row && y <= maxrows) in text_autosize()
672 *h = (tp->nword == 0) ? 0 : y; in text_autosize()
687 if (bs->nbuttons > 0) in text_size()
692 maxhtext = widget_max_height(conf) - BORDERS - rowsnotext; in text_size()
694 maxhtext = rows - BORDERS - rowsnotext; in text_size()
696 if (bs->nbuttons > 0) in text_size()
697 maxhtext -= 2; in text_size()
699 maxhtext = 1; /* text_autosize() computes always htext */ in text_size()
703 startwtext = MAX(startwtext, wbuttons - TEXTHMARGINS); in text_size()
706 startwtext = widget_max_width(conf) - BORDERS - TEXTHMARGINS; in text_size()
709 startwtext = cols - BORDERS - TEXTHMARGINS; in text_size()
714 startwtext = 1; in text_size()
721 "needed at least %d cols to draw text", in text_size()
722 BORDERS + TEXTHMARGINS + 1); in text_size()
750 min += HBUTTONS; /* buttons and their up-border */ in widget_min_height()
753 min = MAX(min, (int)conf->auto_minheight); in widget_min_height()
768 if (bs->nbuttons > 0) in widget_min_width()
779 if (conf->title != NULL) { in widget_min_width()
781 wtitle = strcols(conf->title); in widget_min_width()
786 if (conf->bottomtitle != NULL) { in widget_min_width()
787 wbottomtitle = strcols(conf->bottomtitle); in widget_min_width()
794 min = MAX(min, (int)conf->auto_minwidth); in widget_min_width()
810 RETURN_ERROR("Negative (less than -1) height"); in set_widget_size()
821 RETURN_ERROR("Negative (less than -1) width"); in set_widget_size()
846 *h = widget_min_height(conf, htext, hnotext, bs->nbuttons > 0); in set_widget_autosize()
863 if (bs->nbuttons > 0) in widget_checksize()
866 RETURN_FMTERROR("Current rows: %d, needed at least: %d", in widget_checksize()
870 if (bs->nbuttons > 0) in widget_checksize()
875 RETURN_FMTERROR("Current cols: %d, nedeed at least %d", in widget_checksize()
884 int hshadow = conf->shadow ? (int)t.shadow.y : 0; in set_widget_position()
885 int wshadow = conf->shadow ? (int)t.shadow.x : 0; in set_widget_position()
887 if (conf->y == BSDDIALOG_CENTER) { in set_widget_position()
888 *y = SCREENLINES/2 - (h + hshadow)/2; in set_widget_position()
889 if (*y < (int)conf->auto_topmargin) in set_widget_position()
890 *y = conf->auto_topmargin; in set_widget_position()
891 if (*y + h + hshadow > SCREENLINES - (int)conf->auto_downmargin) in set_widget_position()
892 *y = SCREENLINES - h - hshadow - conf->auto_downmargin; in set_widget_position()
894 else if (conf->y < BSDDIALOG_CENTER) in set_widget_position()
895 RETURN_ERROR("Negative begin y (less than -1)"); in set_widget_position()
896 else if (conf->y >= SCREENLINES) in set_widget_position()
899 *y = conf->y; in set_widget_position()
906 if (conf->x == BSDDIALOG_CENTER) in set_widget_position()
907 *x = SCREENCOLS/2 - (w + wshadow)/2; in set_widget_position()
908 else if (conf->x < BSDDIALOG_CENTER) in set_widget_position()
909 RETURN_ERROR("Negative begin x (less than -1)"); in set_widget_position()
910 else if (conf->x >= SCREENCOLS) in set_widget_position()
913 *x = conf->x; in set_widget_position()
922 int dialog_size_position(struct dialog *d, int hnotext, int minw, int *htext) in dialog_size_position() argument
924 if (set_widget_size(d->conf, d->rows, d->cols, &d->h, &d->w) != 0) in dialog_size_position()
926 if (set_widget_autosize(d->conf, d->rows, d->cols, &d->h, &d->w, in dialog_size_position()
927 d->text, htext, &d->bs, hnotext, minw) != 0) in dialog_size_position()
929 if (widget_checksize(d->h, d->w, &d->bs, hnotext, minw) != 0) in dialog_size_position()
931 if (set_widget_position(d->conf, &d->y, &d->x, d->h, d->w) != 0) in dialog_size_position()
938 * -5- Widget components and utilities
940 int hide_dialog(struct dialog *d) in hide_dialog() argument
944 if ((clear = newwin(d->h, d->w, d->y, d->x)) == NULL) in hide_dialog()
949 if (d->conf->shadow) { in hide_dialog()
950 mvwin(clear, d->y + t.shadow.y, d->x + t.shadow.x); in hide_dialog()
968 hconf.ascii_lines = conf->ascii_lines; in f1help_dialog()
969 hconf.no_lines = conf->no_lines; in f1help_dialog()
970 hconf.shadow = conf->shadow; in f1help_dialog()
971 hconf.text.escape = conf->text.escape; in f1help_dialog()
974 if (conf->key.f1_message != NULL) in f1help_dialog()
975 output = bsddialog_msgbox(&hconf, conf->key.f1_message, 0, 0); in f1help_dialog()
977 if (output != BSDDIALOG_ERROR && conf->key.f1_file != NULL) in f1help_dialog()
978 output = bsddialog_textbox(&hconf, conf->key.f1_file, 0, 0); in f1help_dialog()
990 if (conf->no_lines) in draw_borders()
993 if (conf->ascii_lines) { in draw_borders()
996 setcchar(&vline, L"-", 0, 0, NULL); in draw_borders()
1020 mvwadd_wch(win, 0, w-1, tr); in draw_borders()
1021 mvwvline_set(win, 1, w-1, rs, h-2); in draw_borders()
1022 mvwadd_wch(win, h-1, w-1, br); in draw_borders()
1023 mvwhline_set(win, h-1, 1, bs, w-2); in draw_borders()
1038 rtextpad(struct dialog *d, int ytext, int xtext, int upnotext, int downnotext) in rtextpad() argument
1040 pnoutrefresh(d->textpad, ytext, xtext, in rtextpad()
1041 d->y + BORDER + upnotext, in rtextpad()
1042 d->x + BORDER + TEXTHMARGIN, in rtextpad()
1043 d->y + d->h - 1 - downnotext - BORDER, in rtextpad()
1044 d->x + d->w - TEXTHMARGIN - BORDER); in rtextpad()
1048 * -6- Dialog init/build, update/draw, destroy
1050 void end_dialog(struct dialog *d) in end_dialog() argument
1052 if (d->conf->sleep > 0) in end_dialog()
1053 sleep(d->conf->sleep); in end_dialog()
1055 delwin(d->textpad); in end_dialog()
1056 delwin(d->widget); in end_dialog()
1057 if (d->conf->shadow) in end_dialog()
1058 delwin(d->shadow); in end_dialog()
1060 if (d->conf->clear) in end_dialog()
1061 hide_dialog(d); in end_dialog()
1063 if (d->conf->get_height != NULL) in end_dialog()
1064 *d->conf->get_height = d->h; in end_dialog()
1065 if (d->conf->get_width != NULL) in end_dialog()
1066 *d->conf->get_width = d->w; in end_dialog()
1078 wattron(win, bsddialog_color(wtext[2] - L'0', bg, 0)); in check_set_wtext_attr()
1093 case L'd': in check_set_wtext_attr()
1096 case L'D': in check_set_wtext_attr()
1135 ws[1] = L'\0'; in print_string()
1156 *y = *y + 1; in print_string()
1158 *rows = *y + 1; in print_string()
1176 strwidth -= charwidth; in print_string()
1194 if ((string = calloc(wcslen(wtext) + 1, sizeof(wchar_t))) == NULL) in print_textpad()
1198 tablen = (conf->text.tablen == 0) ? TABSIZE : (int)conf->text.tablen; in print_textpad()
1208 conf->text.escape); in print_textpad()
1218 j = -1; in print_textpad()
1228 j = -1; in print_textpad()
1236 j = -1; in print_textpad()
1240 rows = y + 1; in print_textpad()
1254 int draw_dialog(struct dialog *d) in draw_dialog() argument
1259 if (d->conf->ascii_lines) { in draw_dialog()
1260 setcchar(&ts, L"-", 0, 0, NULL); in draw_dialog()
1269 if (d->conf->shadow) { in draw_dialog()
1270 wclear(d->shadow); in draw_dialog()
1271 wresize(d->shadow, d->h, d->w); in draw_dialog()
1272 mvwin(d->shadow, d->y + t.shadow.y, d->x + t.shadow.x); in draw_dialog()
1273 wnoutrefresh(d->shadow); in draw_dialog()
1276 wclear(d->widget); in draw_dialog()
1277 wresize(d->widget, d->h, d->w); in draw_dialog()
1278 mvwin(d->widget, d->y, d->x); in draw_dialog()
1279 draw_borders(d->conf, d->widget, RAISED); in draw_dialog()
1281 if (d->conf->title != NULL) { in draw_dialog()
1282 if ((wtitle = strcols(d->conf->title)) < 0) in draw_dialog()
1284 if (t.dialog.delimtitle && d->conf->no_lines == false) { in draw_dialog()
1285 wattron(d->widget, t.dialog.lineraisecolor); in draw_dialog()
1286 mvwadd_wch(d->widget, 0, d->w/2 - wtitle/2 -1, &rtee); in draw_dialog()
1287 wattroff(d->widget, t.dialog.lineraisecolor); in draw_dialog()
1289 wattron(d->widget, t.dialog.titlecolor); in draw_dialog()
1290 mvwaddstr(d->widget, 0, d->w/2 - wtitle/2, d->conf->title); in draw_dialog()
1291 wattroff(d->widget, t.dialog.titlecolor); in draw_dialog()
1292 if (t.dialog.delimtitle && d->conf->no_lines == false) { in draw_dialog()
1293 wattron(d->widget, t.dialog.lineraisecolor); in draw_dialog()
1294 wadd_wch(d->widget, &ltee); in draw_dialog()
1295 wattroff(d->widget, t.dialog.lineraisecolor); in draw_dialog()
1299 if (d->bs.nbuttons > 0) { in draw_dialog()
1300 if (d->conf->no_lines == false) { in draw_dialog()
1301 wattron(d->widget, t.dialog.lineraisecolor); in draw_dialog()
1302 mvwadd_wch(d->widget, d->h-3, 0, &ltee); in draw_dialog()
1303 mvwhline_set(d->widget, d->h-3, 1, &ts, d->w-2); in draw_dialog()
1304 wattroff(d->widget, t.dialog.lineraisecolor); in draw_dialog()
1306 wattron(d->widget, t.dialog.linelowercolor); in draw_dialog()
1307 mvwadd_wch(d->widget, d->h-3, d->w-1, &rtee); in draw_dialog()
1308 wattroff(d->widget, t.dialog.linelowercolor); in draw_dialog()
1310 draw_buttons(d); in draw_dialog()
1313 if (d->conf->bottomtitle != NULL) { in draw_dialog()
1314 if ((wbottomtitle = strcols(d->conf->bottomtitle)) < 0) in draw_dialog()
1316 wattron(d->widget, t.dialog.bottomtitlecolor); in draw_dialog()
1317 wmove(d->widget, d->h - 1, d->w/2 - wbottomtitle/2 - 1); in draw_dialog()
1318 waddch(d->widget, ' '); in draw_dialog()
1319 waddstr(d->widget, d->conf->bottomtitle); in draw_dialog()
1320 waddch(d->widget, ' '); in draw_dialog()
1321 wattroff(d->widget, t.dialog.bottomtitlecolor); in draw_dialog()
1324 wnoutrefresh(d->widget); in draw_dialog()
1326 wclear(d->textpad); in draw_dialog()
1327 /* `infobox "" 0 2` fails but text is empty and textpad remains 1 1 */ in draw_dialog()
1328 wresize(d->textpad, 1, d->w - BORDERS - TEXTHMARGINS); in draw_dialog()
1330 if (print_textpad(d->conf, d->textpad, d->text) != 0) in draw_dialog()
1333 d->built = true; in draw_dialog()
1340 int cols, struct dialog *d) in prepare_dialog() argument
1344 d->built = false; in prepare_dialog()
1345 d->conf = conf; in prepare_dialog()
1346 d->rows = rows; in prepare_dialog()
1347 d->cols = cols; in prepare_dialog()
1348 d->text = CHECK_STR(text); in prepare_dialog()
1349 d->bs.nbuttons = 0; in prepare_dialog()
1351 if (d->conf->shadow) { in prepare_dialog()
1352 if ((d->shadow = newwin(1, 1, 1, 1)) == NULL) in prepare_dialog()
1354 wbkgd(d->shadow, t.shadow.color); in prepare_dialog()
1357 if ((d->widget = newwin(1, 1, 1, 1)) == NULL) in prepare_dialog()
1359 wbkgd(d->widget, t.dialog.color); in prepare_dialog()
1362 if ((d->textpad = newpad(1, 1)) == NULL) in prepare_dialog()
1364 wbkgd(d->textpad, t.dialog.color); in prepare_dialog()