📄 dialog.h
字号:
/* * $Id: dialog.h,v 1.137 2003/11/27 00:22:55 tom Exp $ * * dialog.h -- common declarations for all dialog modules * * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * and: Thomas E. Dickey * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#ifndef DIALOG_H_included#define DIALOG_H_included 1#include <dlg_config.h>#include <sys/types.h>#include <fcntl.h>#include <unistd.h>#include <ctype.h>#include <stdlib.h>#include <string.h>#include <signal.h> /* fork() etc. */#include <math.h> /* sqrt() */#if defined(HAVE_NCURSESW_NCURSES_H)#include <ncursesw/ncurses.h>#elif defined(HAVE_NCURSES_NCURSES_H)#include <ncurses/ncurses.h>#elif defined(HAVE_NCURSES_CURSES_H)#include <ncurses/curses.h>#elif defined(HAVE_NCURSES_H)#include <ncurses.h>#elif defined(ultrix)#include <cursesX.h>#else#include <curses.h>#endif/* possible conflicts with <term.h> which may be included in <curses.h> */#ifdef color_names#undef color_names#endif#ifdef buttons#undef buttons#endif#ifdef ENABLE_NLS#include <libintl.h>#include <langinfo.h>#define _(s) gettext(s)#else#undef _#define _(s) s#endif#ifndef GCC_NORETURN#define GCC_NORETURN /*nothing*/#endif#ifndef GCC_UNUSED#define GCC_UNUSED /*nothing*/#endif#ifndef HAVE_WGET_WCH#undef USE_WIDE_CURSES#endif/* * FIXME: a configure check would be useful */#ifdef __hpux#undef ACS_UARROW#undef ACS_DARROW#endif/* * Change these if you want */#define USE_SHADOW TRUE#define USE_COLORS TRUE#ifdef HAVE_COLOR#define SCOLS (COLS - (dialog_state.use_shadow ? 2 : 0))#define SLINES (LINES - (dialog_state.use_shadow ? 1 : 0))#else#define SCOLS COLS#define SLINES LINES#endif#define DLG_EXIT_ESC 255#define DLG_EXIT_UNKNOWN -2 /* never return this (internal use) */#define DLG_EXIT_ERROR -1 /* the shell sees this as 255 */#define DLG_EXIT_OK 0#define DLG_EXIT_CANCEL 1#define DLG_EXIT_HELP 2#define DLG_EXIT_EXTRA 3#define CHR_BACKSPACE 8#define CHR_REPAINT 12 /* control/L */#define CHR_DELETE 127#define CHR_NEXT ('n' & 0x1f)#define CHR_PREVIOUS ('p' & 0x1f)#define ESC 27#define TAB 9#define MARGIN 1#define GUTTER 2#define SHADOW_ROWS 1#define SHADOW_COLS 2#define MAX_LEN 2048#define BUF_SIZE (10*1024)#undef MIN#define MIN(x,y) ((x) < (y) ? (x) : (y))#undef MAX#define MAX(x,y) ((x) > (y) ? (x) : (y))#define DEFAULT_SEPARATE_STR "\t"#define DEFAULT_ASPECT_RATIO 9/* how many spaces is a tab long (default)? */#define TAB_LEN 8#define WTIMEOUT_VAL 10#ifndef A_CHARTEXT#define A_CHARTEXT 0xff#endif#define CharOf(ch) ((ch) & A_CHARTEXT)#ifndef ACS_ULCORNER#define ACS_ULCORNER '+'#endif#ifndef ACS_LLCORNER#define ACS_LLCORNER '+'#endif#ifndef ACS_URCORNER#define ACS_URCORNER '+'#endif#ifndef ACS_LRCORNER#define ACS_LRCORNER '+'#endif#ifndef ACS_HLINE#define ACS_HLINE '-'#endif#ifndef ACS_VLINE#define ACS_VLINE '|'#endif#ifndef ACS_LTEE#define ACS_LTEE '+'#endif#ifndef ACS_RTEE#define ACS_RTEE '+'#endif#ifndef ACS_UARROW#define ACS_UARROW '^'#endif#ifndef ACS_DARROW#define ACS_DARROW 'v'#endif/* these definitions may work for antique versions of curses */#ifndef HAVE_GETBEGYX#undef getbegyx#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)#endif#ifndef HAVE_GETMAXYX#undef getmaxyx#define getmaxyx(win,y,x) (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR)#endif#ifndef HAVE_GETPARYX#undef getparyx#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)#endif/* these definitions may be needed for bleeding-edge curses implementations */#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY))#undef getbegx#undef getbegy#define getbegx(win) dlg_getbegx(win)#define getbegy(win) dlg_getbegy(win)extern int dlg_getbegx(WINDOW *);extern int dlg_getbegy(WINDOW *);#endif#if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY))#undef getcurx#undef getcury#define getcurx(win) dlg_getcurx(win)#define getcury(win) dlg_getcury(win)extern int dlg_getcurx(WINDOW *);extern int dlg_getcury(WINDOW *);#endif#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY))#undef getmaxx#undef getmaxy#define getmaxx(win) dlg_getmaxx(win)#define getmaxy(win) dlg_getmaxy(win)extern int dlg_getmaxx(WINDOW *);extern int dlg_getmaxy(WINDOW *);#endif#if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY))#undef getparx#undef getpary#define getparx(win) dlg_getparx(win)#define getpary(win) dlg_getpary(win)extern int dlg_getparx(WINDOW *);extern int dlg_getpary(WINDOW *);#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 * symbols from libdialog have "dlg_" prefix, or "dialog_" prefix or "_dialog" * suffix. */#ifdef __DIALOG_OLD_NAMES__#define color_table dlg_color_table#define attr_clear(win,h,w,a) dlg_attr_clear(win,h,w,a)#define auto_size(t,s,h,w,xl,mc) dlg_auto_size(t,s,h,w,xl,mc)#define auto_sizefile(t,f,h,w,xl,mc) dlg_auto_sizefile(t,f,h,w,xl,mc)#define beeping() dlg_beeping()#define box_x_ordinate(w) dlg_box_x_ordinate(w)#define box_y_ordinate(h) dlg_box_y_ordinate(h)#define calc_listh(h,lh,in) dlg_calc_listh(h,lh,in)#define calc_listw(in,items,group) dlg_calc_listw(in,items,group)#define color_setup() dlg_color_setup()#define create_rc(f) dlg_create_rc(f)#define ctl_size(h,w) dlg_ctl_size(h,w)#define del_window(win) dlg_del_window(win)#define dialog_clear() dlg_clear()#define draw_bottom_box(win) dlg_draw_bottom_box(win)#define draw_box(win,y,x,h,w,xc,bc) dlg_draw_box(win,y,x,h,w,xc,bc)#define draw_shadow(win,h,w,y,x) dlg_draw_shadow(win,h,w,y,x)#define draw_title(win,t) dlg_draw_title(win,t)#define exiterr dlg_exiterr#define killall_bg(n) dlg_killall_bg(n)#define mouse_bigregion(y,x) dlg_mouse_bigregion(y,x)#define mouse_free_regions() dlg_mouse_free_regions()#define mouse_mkbigregion(y,x,h,w,n,ix,iy,m) dlg_mouse_mkbigregion(y,x,h,w,n,ix,iy,m)#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_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()#define print_autowrap(win,s,h,w) dlg_print_autowrap(win,s,h,w)#define print_size(h,w) dlg_print_size(h,w)#define put_backtitle() dlg_put_backtitle()#define strclone(cprompt) dlg_strclone(cprompt)#define sub_window(win,h,w,y,x) dlg_sub_window(win,h,w,y,x)#define tab_correct_str(s) dlg_tab_correct_str(s)#endif/* * Attribute names */#define DIALOG_ATR(n) dlg_color_table[n].atr#define screen_attr DIALOG_ATR(0)#define shadow_attr DIALOG_ATR(1)#define dialog_attr DIALOG_ATR(2)#define title_attr DIALOG_ATR(3)#define border_attr DIALOG_ATR(4)#define button_active_attr DIALOG_ATR(5)#define button_inactive_attr DIALOG_ATR(6)#define button_key_active_attr DIALOG_ATR(7)#define button_key_inactive_attr DIALOG_ATR(8)#define button_label_active_attr DIALOG_ATR(9)#define button_label_inactive_attr DIALOG_ATR(10)#define inputbox_attr DIALOG_ATR(11)#define inputbox_border_attr DIALOG_ATR(12)#define searchbox_attr DIALOG_ATR(13)#define searchbox_title_attr DIALOG_ATR(14)#define searchbox_border_attr DIALOG_ATR(15)#define position_indicator_attr DIALOG_ATR(16)#define menubox_attr DIALOG_ATR(17)#define menubox_border_attr DIALOG_ATR(18)#define item_attr DIALOG_ATR(19)#define item_selected_attr DIALOG_ATR(20)#define tag_attr DIALOG_ATR(21)#define tag_selected_attr DIALOG_ATR(22)#define tag_key_attr DIALOG_ATR(23)#define tag_key_selected_attr DIALOG_ATR(24)#define check_attr DIALOG_ATR(25)#define check_selected_attr DIALOG_ATR(26)#define uarrow_attr DIALOG_ATR(27)#define darrow_attr DIALOG_ATR(28)#define itemhelp_attr DIALOG_ATR(29)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -