diff options
Diffstat (limited to 'contrib/dialog/dialog.h')
-rw-r--r-- | contrib/dialog/dialog.h | 108 |
1 files changed, 85 insertions, 23 deletions
diff --git a/contrib/dialog/dialog.h b/contrib/dialog/dialog.h index 4e1b01c..a255f03 100644 --- a/contrib/dialog/dialog.h +++ b/contrib/dialog/dialog.h @@ -1,9 +1,9 @@ /* - * $Id: dialog.h,v 1.231 2011/06/29 09:51:00 tom Exp $ + * $Id: dialog.h,v 1.260 2013/03/17 15:03:41 tom Exp $ * * dialog.h -- common declarations for all dialog modules * - * Copyright 2000-2010,2011 Thomas E. Dickey + * Copyright 2000-2012,2013 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License, version 2.1 @@ -59,11 +59,9 @@ #include <ncurses.h> #else #include <curses.h> -#endif - -/* most curses.h headers include this, some do not */ #if defined(HAVE_UNCTRL_H) -#include <unctrl.h> +#include <unctrl.h> /* most curses.h headers include this, some do not */ +#endif #endif /* Solaris xpg4 renames these */ @@ -97,6 +95,10 @@ #define _(s) s #endif +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif + #ifndef GCC_NORETURN #define GCC_NORETURN /*nothing*/ #endif @@ -233,6 +235,21 @@ #define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) #endif +#if !defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT) +#undef wgetparent +#define wgetparent(win) ((win) ? (win)->_parent : 0) +#endif + +#if !defined(HAVE_WSYNCUP) +#undef wsyncup +#define wsyncup(win) /* nothing */ +#endif + +#if !defined(HAVE_WCURSYNCUP) +#undef wcursyncup +#define wcursyncup(win) /* nothing */ +#endif + #ifdef __cplusplus extern "C" { #endif @@ -274,6 +291,12 @@ extern int dlg_getparx(WINDOW * /*win*/); extern int dlg_getpary(WINDOW * /*win*/); #endif +#if !(defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT)) +#undef wgetparent +#define wgetparent(win) dlg_wgetparent(win) +extern WINDOW * dlg_wgetparent(WINDOW * /*win*/); +#endif + /* * This is a list of "old" names, which should be helpful in updating * applications that use libdialog. Starting with 2003/11/26, all exported @@ -307,6 +330,7 @@ extern int dlg_getpary(WINDOW * /*win*/); #define mouse_mkregion(y,x,h,w,n) dlg_mouse_mkregion(y,x,h,w,n) #define mouse_region(y,x) dlg_mouse_region(y,x) #define mouse_setbase(x,y) dlg_mouse_setbase(x,y) +#define mouse_setcode(c) dlg_mouse_setcode(c) #define mouse_wgetch(w,c) dlg_mouse_wgetch(w,c) #define new_window(h,w,y,x) dlg_new_window(h,w,y,x) #define parse_rc() dlg_parse_rc() @@ -357,6 +381,10 @@ extern int dlg_getpary(WINDOW * /*win*/); #define form_text_attr DIALOG_ATR(31) #define form_item_readonly_attr DIALOG_ATR(32) #define gauge_attr DIALOG_ATR(33) +#define border2_attr DIALOG_ATR(34) +#define inputbox_border2_attr DIALOG_ATR(35) +#define searchbox_border2_attr DIALOG_ATR(36) +#define menubox_border2_attr DIALOG_ATR(37) #define DLGK_max (KEY_MAX + 256) @@ -396,6 +424,7 @@ typedef struct { DIALOG_CALLBACK *getc_callbacks; DIALOG_CALLBACK *getc_redirect; DIALOG_WINDOWS *all_windows; + DIALOG_WINDOWS *all_subwindows; FILE *output; /* option "--output-fd fd" */ FILE *pipe_input; /* used for gauge widget */ FILE *screen_output; /* newterm(), etc. */ @@ -415,6 +444,7 @@ typedef struct { #endif /* 1.1-20110106 */ bool no_mouse; /* option "--no-mouse" */ + int visit_cols; /* option "--visit-items" */ } DIALOG_STATE; extern DIALOG_STATE dialog_state; @@ -485,14 +515,33 @@ typedef struct { char *help_file; /* option "--hfile" */ bool in_helpfile; /* flag to prevent recursion in --hfile */ bool no_nl_expand; /* option "--no-nl-expand" */ + /* 1.1-20120701 */ + int default_button; /* option "--default-button" (exit code) */ + /* 1.1-20121218 */ + bool no_tags; /* option "--no-tags" */ + bool no_items; /* option "--no-items" */ + /* 1.2-20130315 */ + bool last_key; /* option "--last-key" */ } DIALOG_VARS; #define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0) -#define CHECKBOX_TAGS (dialog_vars.item_help ? 4 : 3) -#define MENUBOX_TAGS (dialog_vars.item_help ? 3 : 2) -#define FORMBOX_TAGS (dialog_vars.item_help ? 9 : 8) -#define MIXEDFORM_TAGS (FORMBOX_TAGS + 1) + +/* + * Some settings change the number of data items per row which dialog reads + * from a script. + */ +#define DLG__NO_ITEMS (dialog_vars.no_items ? 0 : 1) +#define DLG__ITEM_HELP (dialog_vars.item_help ? 1 : 0) + +/* + * These are the total number of data items per row used for each widget type. + */ +#define CHECKBOX_TAGS (2 + DLG__ITEM_HELP + DLG__NO_ITEMS) +#define MENUBOX_TAGS (1 + DLG__ITEM_HELP + DLG__NO_ITEMS) +#define FORMBOX_TAGS (8 + DLG__ITEM_HELP) +#define MIXEDFORM_TAGS (1 + FORMBOX_TAGS) #define MIXEDGAUGE_TAGS 2 +#define TREEVIEW_TAGS (3 + DLG__ITEM_HELP + DLG__NO_ITEMS) extern DIALOG_VARS dialog_vars; @@ -532,6 +581,7 @@ extern DIALOG_COLORS dlg_color_table[]; extern const char *dialog_version(void); /* widgets, each in separate files */ +extern int dialog_buildlist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*order_mode*/); extern int dialog_calendar(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*day*/, int /*month*/, int /*year*/); extern int dialog_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/); extern int dialog_dselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/); @@ -548,9 +598,11 @@ extern int dialog_msgbox(const char * /*title*/, const char * /*cprompt*/, int / extern int dialog_pause(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*seconds*/); extern int dialog_prgbox(const char * /*title*/, const char * /*cprompt*/, const char * /*command*/, int /*height*/, int /*width*/, int /*pauseopt*/); extern int dialog_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/); +extern int dialog_rangebox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*min_value*/, int /*max_value*/, int /*default_value*/); extern int dialog_tailbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*bg_task*/); extern int dialog_textbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/); extern int dialog_timebox(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*hour*/, int /*minute*/, int /*second*/); +extern int dialog_treeview(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/); extern int dialog_yesno(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/); /* some widgets have alternate entrypoints, to allow list manipulation */ @@ -597,6 +649,9 @@ extern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*botto extern void dlg_draw_helpline(WINDOW * /*dialog*/, bool /*decorations*/); extern void dlg_draw_scrollbar(WINDOW * /*dialog*/, long /* first_data */, long /* this_data */, long /* next_data */, long /* total_data */, int /* left */, int /* right */, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/); +/* buildlist.c */ +extern int dlg_buildlist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*order_mode*/, int * /*current_item*/); + /* buttons.c */ extern const char ** dlg_exit_label(void); extern const char ** dlg_ok_label(void); @@ -623,7 +678,7 @@ extern void dlg_align_columns(char ** /* target */, int /* per_row */, int /* n extern void dlg_free_columns(char ** /* target */, int /* per_row */, int /* num_rows */); /* editbox.c */ -extern int dlg_editbox(const char */*title*/, char ***/*list*/, int */*rows*/, int /*height*/, int /*width*/); +extern int dlg_editbox(const char * /*title*/, char *** /*list*/, int * /*rows*/, int /*height*/, int /*width*/); /* formbox.c */ extern int dlg_default_formitem(DIALOG_FORMITEM * /*items*/); @@ -646,16 +701,24 @@ extern int dlg_find_index(const int * /*list*/, int /*limit*/, int /*to_find*/) extern int dlg_limit_columns(const char * /*string*/, int /*limit*/, int /*offset*/); extern void dlg_show_string(WINDOW * /*win*/, const char * /*string*/, int /*offset*/, chtype /*attr*/, int /*y_base*/, int /*x_base*/, int /*x_last*/, bool /*hidden*/, bool /*force*/); +/* menubox.c */ +extern int dlg_dummy_menutext(DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/); +extern int dlg_renamed_menutext(DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/); + /* rc.c */ #ifdef HAVE_RC_FILE extern int dlg_parse_rc(void); extern void dlg_create_rc(const char * /*filename*/); #endif +/* treeview.c */ +extern int dlg_treeview(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int * /*depths*/, int /*flag*/, int * /*current_item*/); + /* ui_getc.c */ extern int dlg_getc(WINDOW * /*win*/, int * /*fkey*/); extern int dlg_getc_callbacks(int /*ch*/, int /*fkey*/, int * /*result*/); extern int dlg_last_getc(void); +extern void dlg_add_last_key(int /*mode*/); extern void dlg_add_callback(DIALOG_CALLBACK * /*p*/); extern void dlg_add_callback_ref(DIALOG_CALLBACK ** /*p*/, DIALOG_FREEBACK /* cleanup */); extern void dlg_flush_getc(void); @@ -673,15 +736,17 @@ extern char * dlg_strempty(void); extern chtype dlg_asciibox(chtype /*ch*/); extern chtype dlg_boxchar(chtype /*ch*/); extern chtype dlg_get_attrs(WINDOW * /*win*/); -extern const char * dlg_print_line(WINDOW */*win*/, chtype */*attr*/, const char */*prompt*/, int /*lm*/, int /*rm*/, int */*x*/); +extern const char * dlg_print_line(WINDOW * /*win*/, chtype * /*attr*/, const char * /*prompt*/, int /*lm*/, int /*rm*/, int * /*x*/); extern int dlg_box_x_ordinate(int /*width*/); extern int dlg_box_y_ordinate(int /*height*/); extern int dlg_calc_list_width(int /*item_no*/, DIALOG_LISTITEM * /*items*/); extern int dlg_calc_listw(int /*item_no*/, char ** /*items*/, int /*group*/); -extern int dlg_check_scrolled(int /* key */, int /* last */, int /* page */, bool */* show */, int */* offset */); +extern int dlg_check_scrolled(int /* key */, int /* last */, int /* page */, bool * /* show */, int * /* offset */); +extern int dlg_count_real_columns(const char * /*text*/); extern int dlg_default_item(char ** /*items*/, int /*llen*/); extern int dlg_default_listitem(DIALOG_LISTITEM * /*items*/); extern int dlg_defaultno_button(void); +extern int dlg_default_button(void); extern int dlg_max_input(int /*max_len*/); extern int dlg_print_scrolled(WINDOW * /* win */, const char * /* prompt */, int /* offset */, int /* height */, int /* width */, int /* pauseopt */); extern void dlg_add_quoted(char * /*string*/); @@ -699,11 +764,14 @@ extern void dlg_ctl_size(int /*height*/, int /*width*/); extern void dlg_del_window(WINDOW * /*win*/); extern void dlg_does_output(void); extern void dlg_draw_bottom_box(WINDOW * /*win*/); +extern void dlg_draw_bottom_box2(WINDOW * /*win*/, chtype /*on_left*/, chtype /*on_right*/, chtype /*on_inside*/); extern void dlg_draw_box(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/); +extern void dlg_draw_box2(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/, chtype /*borderchar2*/); extern void dlg_draw_title(WINDOW *win, const char *title); extern void dlg_exit(int /*code*/) GCC_NORETURN; extern void dlg_item_help(const char * /*txt*/); extern void dlg_print_autowrap(WINDOW * /*win*/, const char * /*prompt*/, int /*height*/, int /*width*/); +extern void dlg_print_listitem(WINDOW * /*win*/, const char * /*text*/, int /*climit*/, bool /*first*/, int /*selected*/); extern void dlg_print_size(int /*height*/, int /*width*/); extern void dlg_print_text(WINDOW * /*win*/, const char * /*txt*/, int /*len*/, chtype * /*attr*/); extern void dlg_put_backtitle(void); @@ -715,11 +783,7 @@ extern void dlg_trim_string(char * /*src*/); extern void end_dialog(void); extern void init_dialog(FILE * /*input*/, FILE * /*output*/); -extern void dlg_exiterr(const char *, ...) GCC_NORETURN -#if defined(__GNUC__) && !defined(printf) -__attribute__((format(printf,1,2))) -#endif -; +extern void dlg_exiterr(const char *, ...) GCC_NORETURN GCC_PRINTFLIKE(1,2); #ifdef HAVE_COLOR extern chtype dlg_color_pair(int /*foreground*/, int /*background*/); @@ -736,11 +800,7 @@ extern int dlg_strcmp(const char * /*a*/, const char * /*b*/); #ifdef HAVE_DLG_TRACE #define DLG_TRACE(params) dlg_trace_msg params -extern void dlg_trace_msg(const char *fmt, ...) -#ifdef GCC_PRINTF - __attribute__((format(printf,1,2))) -#endif -; +extern void dlg_trace_msg(const char *fmt, ...) GCC_PRINTFLIKE(1,2); extern void dlg_trace_win(WINDOW * /*win*/); extern void dlg_trace_chr(int /*ch*/, int /*fkey*/); extern void dlg_trace(const char * /*fname*/); @@ -779,6 +839,7 @@ extern mseRegion * dlg_mouse_mkregion (int /*y*/, int /*x*/, int /*height*/, int extern void dlg_mouse_free_regions (void); extern void dlg_mouse_mkbigregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/, int /*step_x*/, int /*step_y*/, int /*mode*/); extern void dlg_mouse_setbase (int /*x*/, int /*y*/); +extern void dlg_mouse_setcode (int /*code*/); #define USE_MOUSE 1 @@ -790,6 +851,7 @@ extern void dlg_mouse_setbase (int /*x*/, int /*y*/); #define dlg_mouse_mkregion(y, x, height, width, code) /*nothing*/ #define dlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/ #define dlg_mouse_setbase(x, y) /*nothing*/ +#define dlg_mouse_setcode(c) /*nothing*/ #define USE_MOUSE 0 |