00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <sys/types.h>
00023 #include <fcntl.h>
00024 #include <unistd.h>
00025 #include <ctype.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028
00029 #include CURSES_LOC
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE)
00040 #define OLD_NCURSES 1
00041 #undef wbkgdset
00042 #define wbkgdset(w,p)
00043 #else
00044 #define OLD_NCURSES 0
00045 #endif
00046
00047 #define TR(params) _tracef params
00048
00049 #define ESC 27
00050 #define TAB 9
00051 #define MAX_LEN 2048
00052 #define BUF_SIZE (10*1024)
00053 #define MIN(x,y) (x < y ? x : y)
00054 #define MAX(x,y) (x > y ? x : y)
00055
00056
00057 #ifndef ACS_ULCORNER
00058 #define ACS_ULCORNER '+'
00059 #endif
00060 #ifndef ACS_LLCORNER
00061 #define ACS_LLCORNER '+'
00062 #endif
00063 #ifndef ACS_URCORNER
00064 #define ACS_URCORNER '+'
00065 #endif
00066 #ifndef ACS_LRCORNER
00067 #define ACS_LRCORNER '+'
00068 #endif
00069 #ifndef ACS_HLINE
00070 #define ACS_HLINE '-'
00071 #endif
00072 #ifndef ACS_VLINE
00073 #define ACS_VLINE '|'
00074 #endif
00075 #ifndef ACS_LTEE
00076 #define ACS_LTEE '+'
00077 #endif
00078 #ifndef ACS_RTEE
00079 #define ACS_RTEE '+'
00080 #endif
00081 #ifndef ACS_UARROW
00082 #define ACS_UARROW '^'
00083 #endif
00084 #ifndef ACS_DARROW
00085 #define ACS_DARROW 'v'
00086 #endif
00087
00088
00089
00090
00091 #define screen_attr attributes[0]
00092 #define shadow_attr attributes[1]
00093 #define dialog_attr attributes[2]
00094 #define title_attr attributes[3]
00095 #define border_attr attributes[4]
00096 #define button_active_attr attributes[5]
00097 #define button_inactive_attr attributes[6]
00098 #define button_key_active_attr attributes[7]
00099 #define button_key_inactive_attr attributes[8]
00100 #define button_label_active_attr attributes[9]
00101 #define button_label_inactive_attr attributes[10]
00102 #define inputbox_attr attributes[11]
00103 #define inputbox_border_attr attributes[12]
00104 #define searchbox_attr attributes[13]
00105 #define searchbox_title_attr attributes[14]
00106 #define searchbox_border_attr attributes[15]
00107 #define position_indicator_attr attributes[16]
00108 #define menubox_attr attributes[17]
00109 #define menubox_border_attr attributes[18]
00110 #define item_attr attributes[19]
00111 #define item_selected_attr attributes[20]
00112 #define tag_attr attributes[21]
00113 #define tag_selected_attr attributes[22]
00114 #define tag_key_attr attributes[23]
00115 #define tag_key_selected_attr attributes[24]
00116 #define check_attr attributes[25]
00117 #define check_selected_attr attributes[26]
00118 #define uarrow_attr attributes[27]
00119 #define darrow_attr attributes[28]
00120
00121
00122 #define ATTRIBUTE_COUNT 29
00123
00124
00125
00126
00127 extern bool use_colors;
00128 extern bool use_shadow;
00129
00130 extern chtype attributes[];
00131
00132 extern const char *backtitle;
00133
00134
00135
00136
00137 extern void create_rc (const char *filename);
00138 extern int parse_rc (void);
00139
00140
00141 void init_dialog (void);
00142 void end_dialog (void);
00143 void attr_clear (WINDOW * win, int height, int width, chtype attr);
00144 void dialog_clear (void);
00145 void color_setup (void);
00146 void print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x);
00147 void print_button (WINDOW * win, const char *label, int y, int x, int selected);
00148 void draw_box (WINDOW * win, int y, int x, int height, int width, chtype box,
00149 chtype border);
00150 void draw_shadow (WINDOW * win, int y, int x, int height, int width);
00151
00152 int first_alpha (const char *string, const char *exempt);
00153 int dialog_yesno (const char *title, const char *prompt, int height, int width);
00154 int dialog_msgbox (const char *title, const char *prompt, int height,
00155 int width, int pause);
00156 int dialog_textbox (const char *title, const char *file, int height, int width);
00157 int dialog_menu (const char *title, const char *prompt, int height, int width,
00158 int menu_height, const char *choice, int item_no,
00159 const char * const * items);
00160 int dialog_checklist (const char *title, const char *prompt, int height,
00161 int width, int list_height, int item_no,
00162 const char * const * items, int flag);
00163 extern unsigned char dialog_input_result[];
00164 int dialog_inputbox (const char *title, const char *prompt, int height,
00165 int width, const char *init);
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 #define M_EVENT (KEY_MAX+1)
00177
00178
00179
00180
00181
00182
00183 #define FLAG_CHECK 1
00184 #define FLAG_RADIO 0