⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.h

📁 This version of dialog, formerly known as cdialog is based on the Debian package for dialog 0.9a (se
💻 H
📖 第 1 页 / 共 2 页
字号:
#define form_active_text_attr         DIALOG_ATR(30)#define form_text_attr                DIALOG_ATR(31)/* * Internal keycodes are used for commands. */typedef enum {    DLGK_min = KEY_MAX + 1    , DLGK_NEXT_FIELD    , DLGK_PREV_FIELD} DLGK_xxx;#define DLGK_max (KEY_MAX + 256)/* * Callbacks are used to implement the "background" tailbox. */typedef struct _dlg_callback {    struct _dlg_callback *next;    FILE *input;    WINDOW *win;    bool keep_bg;	/* keep in background, on exit */    bool bg_task;	/* true if this is background task */    bool (*handle_getc)(struct _dlg_callback *p, int ch, int fkey, int *result);} DIALOG_CALLBACK;typedef struct _dlg_windows {    struct _dlg_windows *next;    WINDOW *normal;    WINDOW *shadow;} DIALOG_WINDOWS;/* * Global variables, which are initialized as needed */typedef struct {    DIALOG_CALLBACK *getc_callbacks;    DIALOG_CALLBACK *getc_redirect;    DIALOG_WINDOWS *all_windows;    FILE *output;		/* option "--output-fd fd" */    FILE *pipe_input;		/* used for gauge widget */    FILE *screen_output;	/* newterm(), etc. */    bool screen_initialized;    bool use_colors;		/* use colors by default? */    bool use_shadow;		/* shadow dialog boxes by default? */    bool visit_items;		/* option "--visit-items" */    char *separate_str;		/* option "--separate-widget string" */    int aspect_ratio;		/* option "--aspect ratio" */    int output_count;		/* # of widgets that may have done output */    int tab_len;		/* option "--tab-len n" */} DIALOG_STATE;extern DIALOG_STATE dialog_state;/* * Global variables, which dialog resets before each widget */typedef struct {    bool beep_after_signal;	/* option "--beep-after" */    bool beep_signal;		/* option "--beep" */    bool begin_set;		/* option "--begin y x" was used */    bool cant_kill;		/* option "--no-kill" */    bool colors;		/* option "--colors" */    bool cr_wrap;		/* option "--cr-wrap" */    bool defaultno;		/* option "--defaultno" */    bool dlg_clear_screen;	/* option "--clear" */    bool extra_button;		/* option "--extra-button" */    bool help_button;		/* option "--help-button" */    bool help_status;		/* option "--help-status" */    bool input_menu;		/* menu vs inputmenu widget */    bool insecure;		/* option "--insecure" */    bool item_help;		/* option "--item-help" */    bool keep_window;		/* option "--keep-window" */    bool nocancel;		/* option "--no-cancel" */    bool nocollapse;		/* option "--no-collapse" */    bool print_siz;		/* option "--print-size" */    bool separate_output;	/* option "--separate-output" */    bool size_err;		/* option "--size-err" */    bool tab_correct;		/* option "--tab-correct" */    bool trim_whitespace;	/* option "--trim" */    char *backtitle;		/* option "--backtitle backtitle" */    char *cancel_label;		/* option "--cancel-label string" */    char *default_item;		/* option "--default-item string" */    char *exit_label;		/* option "--exit-label string" */    char *extra_label;		/* option "--extra-label string" */    char *help_label;		/* option "--help-label string" */    char *input_result;    char *no_label;		/* option "--no-label string" */    char *ok_label;		/* option "--ok-label string" */    char *title;		/* option "--title title" */    char *yes_label;		/* option "--yes-label string" */    int begin_x;		/* option "--begin y x" (second value) */    int begin_y;		/* option "--begin y x" (first value) */    int max_input;		/* option "--max-input size" */    int sleep_secs;		/* option "--sleep secs" */    int timeout_secs;		/* option "--timeout secs" */    unsigned input_length;	/* nonzero if input_result is allocated */} 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)extern DIALOG_VARS dialog_vars;#ifndef HAVE_TYPE_CHTYPE#define chtype long#endif#define UCH(ch)			((unsigned char)(ch))#define assert_ptr(ptr,msg) if ((ptr) == 0) dlg_exiterr("cannot allocate memory in " msg)/* * Table for attribute- and color-values. */typedef struct {    chtype atr;#ifdef HAVE_COLOR    int fg;    int bg;    int hilite;#endif#ifdef HAVE_RC_FILE    char *name;    char *comment;#endif} DIALOG_COLORS;extern DIALOG_COLORS dlg_color_table[];/* * Function prototypes */extern char *dialog_version(void);/* widgets, each in separate files */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_form(const char *title, const char *cprompt, int height, int width, int form_height, int item_no, char **items);extern int dialog_fselect(const char *title, const char *path, int height, int width);extern int dialog_gauge(const char *title, const char *cprompt, int height, int width, int percent);extern int dialog_inputbox(const char *title, const char *cprompt, int height, int width, const char *init, const int password);extern int dialog_menu(const char *title, const char *cprompt, int height, int width, int menu_height, int item_no, char **items);extern int dialog_msgbox(const char *title, const char *cprompt, int height, int width, int pauseopt);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_yesno(const char *title, const char *cprompt, int height, int width);/* arrows.c */extern void dlg_draw_arrows(WINDOW *dialog, int top_arrow, int bottom_arrow, int x, int top, int bottom);/* buttons.c */extern const char ** dlg_exit_label(void);extern const char ** dlg_ok_label(void);extern const char ** dlg_ok_labels(void);extern const char ** dlg_yes_labels(void);extern int dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *step);extern int dlg_char_to_button(int ch, const char **labels);extern int dlg_match_char(int ch, const char *string);extern int dlg_next_button(const char **labels, int button);extern int dlg_next_ok_buttonindex(int current, int extra);extern int dlg_ok_buttoncode(int button);extern int dlg_prev_button(const char **labels, int button);extern int dlg_prev_ok_buttonindex(int current, int extra);extern void dlg_button_layout(const char **labels, int *limit);extern void dlg_button_sizes(const char **labels, int vertical, int *longest, int *length);extern void dlg_draw_buttons(WINDOW *win, int y, int x, const char **labels, int selected, int vertical, int limit);/* inputstr.c */extern bool dlg_edit_string(char *string, int *offset, int key, int fkey, bool force);extern const int * dlg_index_columns(const char *string);extern const int * dlg_index_wchars(const char *string);extern int dlg_count_columns(const char *string);extern int dlg_count_wchars(const char *string);extern int dlg_edit_offset(char *string, int offset, int x_last);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);/* rc.c */#ifdef HAVE_RC_FILEextern int dlg_parse_rc(void);extern void dlg_create_rc(const char *filename);#endif/* 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_callback(DIALOG_CALLBACK *p);extern void dlg_flush_getc(void);extern void dlg_remove_callback(DIALOG_CALLBACK *p);extern void dlg_killall_bg(int *retval);/* util.c */extern WINDOW * dlg_new_window(int height, int width, int y, int x);extern WINDOW * dlg_sub_window(WINDOW *win, int height, int width, int y, int x);extern char * dlg_strclone(const char *cprompt);extern int dlg_box_x_ordinate(int width);extern int dlg_box_y_ordinate(int height);extern int dlg_calc_listw(int item_no, char **items, int group);extern int dlg_default_item(char **items, int llen);extern int dlg_defaultno_button(void);extern void dlg_add_quoted(char *string);extern void dlg_add_result(char *string);extern void dlg_attr_clear(WINDOW * win, int height, int width, chtype attr);extern void dlg_auto_size(const char * title, const char *prompt, int *height, int *width, int boxlines, int mincols);extern void dlg_auto_sizefile(const char * title, const char *file, int *height, int *width, int boxlines, int mincols);extern void dlg_beeping(void);extern void dlg_calc_listh(int *height, int *list_height, int item_no);extern void dlg_clear(void);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_box(WINDOW * win, int y, int x, int height, int width, chtype boxchar, chtype borderchar);extern void dlg_draw_title(WINDOW *win, const char *title);extern void dlg_exit(int code) GCC_NORETURN;extern void dlg_item_help(char *txt);extern void dlg_print_autowrap(WINDOW *win, const char *prompt, int height, int width);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);extern void dlg_set_focus(WINDOW *parent, WINDOW *win);extern void dlg_tab_correct_str(char *prompt);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 *, ...)#if defined(__GNUC__) && !defined(printf)__attribute__((format(printf,1,2)))#endif;#ifdef HAVE_COLORextern int dlg_color_count(void);extern void dlg_color_setup(void);extern void dlg_draw_shadow(WINDOW * win, int height, int width, int y, int x);#endif#ifdef HAVE_STRCASECMP#define dlg_strcmp(a,b) strcasecmp(a,b)#elseextern int dlg_strcmp(const char *a, const char *b);#endif/* * The following stuff is needed for mouse support */typedef struct mseRegion {    int x, y, X, Y, code;    int mode, step_x, step_y;    struct mseRegion *next;} mseRegion;#if defined(NCURSES_MOUSE_VERSION)#define	mouse_open() mousemask(BUTTON1_CLICKED, (mmask_t *) 0)#define	mouse_close() mousemask(0, (mmask_t *) 0)extern mseRegion * dlg_mouse_mkregion (int y, int x, int height, int width, int code);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);#define USE_MOUSE 1#else#define	mouse_open() /*nothing*/#define	mouse_close() /*nothing*/#define dlg_mouse_free_regions() /* nothing */#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 USE_MOUSE 0#endifextern mseRegion *dlg_mouse_region (int y, int x);extern mseRegion *dlg_mouse_bigregion (int y, int x);extern int dlg_mouse_wgetch (WINDOW *, int *);#define mouse_mkbutton(y,x,len,code) dlg_mouse_mkregion(y,x,1,len,code);/* * This is the base for fictitious keys, which activate * the buttons. * * Mouse-generated keys are the following: *   -- the first 32 are used as numbers, in addition to '0'-'9' *   -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') *   -- uppercase chars are used to invoke the button (M_EVENT + 'O') */#define M_EVENT (DLGK_max + 1)/* * The `flag' parameter in checklist is used to select between * radiolist and checklist */#define FLAG_CHECK 1#define FLAG_RADIO 0#endif /* DIALOG_H_included */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -