newtFormAddComponent(form, tb);
- if (type == MSGBOX_MSG) {
+ switch ( type ) {
+ case MSGBOX_INFO:
+ break;
+ case MSGBOX_MSG:
yes = makeButton((width - 8) / 2, height - 1 - buttonHeight, "Ok");
newtFormAddComponent(form, yes);
- } else {
+ break;
+ default:
yes = makeButton((width - 16) / 3, height - 1 - buttonHeight, "Yes");
no = makeButton(((width - 16) / 3) * 2 + 9, height - 1 - buttonHeight,
"No");
newtFormSetCurrent(form, no);
}
- newtRunForm(form);
- answer = newtFormGetCurrent(form);
+ if ( type != MSGBOX_INFO ) {
+ newtRunForm(form);
+
+ answer = newtFormGetCurrent(form);
+
+ if (answer == no)
+ return DLG_CANCEL;
+ }
+ else {
+ newtDrawForm(form);
+ newtRefresh();
+ }
+
- if (answer == no)
- return DLG_CANCEL;
return DLG_OKAY;
}
#include "dialogboxes.h"
#include "newt.h"
-enum mode { MODE_NONE, MODE_MSGBOX, MODE_YESNO, MODE_CHECKLIST, MODE_INPUTBOX,
- MODE_RADIOLIST, MODE_MENU, MODE_GAUGE };
+enum mode { MODE_NONE, MODE_INFOBOX, MODE_MSGBOX, MODE_YESNO, MODE_CHECKLIST,
+ MODE_INPUTBOX, MODE_RADIOLIST, MODE_MENU, MODE_GAUGE };
#define OPT_MSGBOX 1000
#define OPT_CHECKLIST 1001
#define OPT_MENU 1005
#define OPT_RADIOLIST 1006
#define OPT_GAUGE 1007
+#define OPT_INFOBOX 1008
static void usage(void) {
fprintf(stderr, "whiptail: bad parametrs (see man dialog(1) for details)\n");
{ "fb", '\0', 0, 0, OPT_FULLBUTTONS },
{ "fullbuttons", '\0', 0, 0, OPT_FULLBUTTONS },
{ "gauge", '\0', 0, 0, OPT_GAUGE },
+ { "infobox", '\0', 0, 0, OPT_INFOBOX },
{ "menu", '\0', 0, 0, OPT_MENU },
{ "msgbox", '\0', 0, 0, OPT_MSGBOX },
{ "nocancel", '\0', 0, &noCancel, 0 },
optArg = poptGetOptArg(optCon);
switch (arg) {
+ case OPT_INFOBOX:
+ if (mode != MODE_NONE) usage();
+ mode = MODE_INFOBOX;
+ break;
+
case OPT_MENU:
if (mode != MODE_NONE) usage();
mode = MODE_MENU;
rc = messageBox(text, height, width, MSGBOX_MSG, flags);
break;
+ case MODE_INFOBOX:
+ rc = messageBox(text, height, width, MSGBOX_INFO, flags);
+ break;
+
case MODE_YESNO:
rc = messageBox(text, height, width, MSGBOX_YESNO, flags);
break;