diff options
Diffstat (limited to 'scripts/kconfig/lxdialog/dialog.h')
-rw-r--r-- | scripts/kconfig/lxdialog/dialog.h | 144 |
1 files changed, 95 insertions, 49 deletions
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index af3cf716e215..8dea47f9d3e4 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | #define TR(params) _tracef params | 49 | #define TR(params) _tracef params |
50 | 50 | ||
51 | #define ESC 27 | 51 | #define KEY_ESC 27 |
52 | #define TAB 9 | 52 | #define TAB 9 |
53 | #define MAX_LEN 2048 | 53 | #define MAX_LEN 2048 |
54 | #define BUF_SIZE (10*1024) | 54 | #define BUF_SIZE (10*1024) |
@@ -86,63 +86,111 @@ | |||
86 | #define ACS_DARROW 'v' | 86 | #define ACS_DARROW 'v' |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | /* error return codes */ | ||
90 | #define ERRDISPLAYTOOSMALL (KEY_MAX + 1) | ||
91 | |||
89 | /* | 92 | /* |
90 | * Attribute names | 93 | * Color definitions |
91 | */ | 94 | */ |
92 | #define screen_attr attributes[0] | 95 | struct dialog_color { |
93 | #define shadow_attr attributes[1] | 96 | chtype atr; /* Color attribute */ |
94 | #define dialog_attr attributes[2] | 97 | int fg; /* foreground */ |
95 | #define title_attr attributes[3] | 98 | int bg; /* background */ |
96 | #define border_attr attributes[4] | 99 | int hl; /* highlight this item */ |
97 | #define button_active_attr attributes[5] | 100 | }; |
98 | #define button_inactive_attr attributes[6] | 101 | |
99 | #define button_key_active_attr attributes[7] | 102 | struct dialog_info { |
100 | #define button_key_inactive_attr attributes[8] | 103 | const char *backtitle; |
101 | #define button_label_active_attr attributes[9] | 104 | struct dialog_color screen; |
102 | #define button_label_inactive_attr attributes[10] | 105 | struct dialog_color shadow; |
103 | #define inputbox_attr attributes[11] | 106 | struct dialog_color dialog; |
104 | #define inputbox_border_attr attributes[12] | 107 | struct dialog_color title; |
105 | #define searchbox_attr attributes[13] | 108 | struct dialog_color border; |
106 | #define searchbox_title_attr attributes[14] | 109 | struct dialog_color button_active; |
107 | #define searchbox_border_attr attributes[15] | 110 | struct dialog_color button_inactive; |
108 | #define position_indicator_attr attributes[16] | 111 | struct dialog_color button_key_active; |
109 | #define menubox_attr attributes[17] | 112 | struct dialog_color button_key_inactive; |
110 | #define menubox_border_attr attributes[18] | 113 | struct dialog_color button_label_active; |
111 | #define item_attr attributes[19] | 114 | struct dialog_color button_label_inactive; |
112 | #define item_selected_attr attributes[20] | 115 | struct dialog_color inputbox; |
113 | #define tag_attr attributes[21] | 116 | struct dialog_color inputbox_border; |
114 | #define tag_selected_attr attributes[22] | 117 | struct dialog_color searchbox; |
115 | #define tag_key_attr attributes[23] | 118 | struct dialog_color searchbox_title; |
116 | #define tag_key_selected_attr attributes[24] | 119 | struct dialog_color searchbox_border; |
117 | #define check_attr attributes[25] | 120 | struct dialog_color position_indicator; |
118 | #define check_selected_attr attributes[26] | 121 | struct dialog_color menubox; |
119 | #define uarrow_attr attributes[27] | 122 | struct dialog_color menubox_border; |
120 | #define darrow_attr attributes[28] | 123 | struct dialog_color item; |
121 | 124 | struct dialog_color item_selected; | |
122 | /* number of attributes */ | 125 | struct dialog_color tag; |
123 | #define ATTRIBUTE_COUNT 29 | 126 | struct dialog_color tag_selected; |
127 | struct dialog_color tag_key; | ||
128 | struct dialog_color tag_key_selected; | ||
129 | struct dialog_color check; | ||
130 | struct dialog_color check_selected; | ||
131 | struct dialog_color uarrow; | ||
132 | struct dialog_color darrow; | ||
133 | }; | ||
124 | 134 | ||
125 | /* | 135 | /* |
126 | * Global variables | 136 | * Global variables |
127 | */ | 137 | */ |
128 | extern bool use_colors; | 138 | extern struct dialog_info dlg; |
129 | extern bool use_shadow; | 139 | extern char dialog_input_result[]; |
130 | |||
131 | extern chtype attributes[]; | ||
132 | |||
133 | extern const char *backtitle; | ||
134 | 140 | ||
135 | /* | 141 | /* |
136 | * Function prototypes | 142 | * Function prototypes |
137 | */ | 143 | */ |
138 | extern void create_rc(const char *filename); | ||
139 | extern int parse_rc(void); | ||
140 | 144 | ||
141 | void init_dialog(void); | 145 | /* item list as used by checklist and menubox */ |
146 | void item_reset(void); | ||
147 | void item_make(const char *fmt, ...); | ||
148 | void item_add_str(const char *fmt, ...); | ||
149 | void item_set_tag(char tag); | ||
150 | void item_set_data(void *p); | ||
151 | void item_set_selected(int val); | ||
152 | int item_activate_selected(void); | ||
153 | void *item_data(void); | ||
154 | char item_tag(void); | ||
155 | |||
156 | /* item list manipulation for lxdialog use */ | ||
157 | #define MAXITEMSTR 200 | ||
158 | struct dialog_item { | ||
159 | char str[MAXITEMSTR]; /* promtp displayed */ | ||
160 | char tag; | ||
161 | void *data; /* pointer to menu item - used by menubox+checklist */ | ||
162 | int selected; /* Set to 1 by dialog_*() function if selected. */ | ||
163 | }; | ||
164 | |||
165 | /* list of lialog_items */ | ||
166 | struct dialog_list { | ||
167 | struct dialog_item node; | ||
168 | struct dialog_list *next; | ||
169 | }; | ||
170 | |||
171 | extern struct dialog_list *item_cur; | ||
172 | extern struct dialog_list item_nil; | ||
173 | extern struct dialog_list *item_head; | ||
174 | |||
175 | int item_count(void); | ||
176 | void item_set(int n); | ||
177 | int item_n(void); | ||
178 | const char *item_str(void); | ||
179 | int item_is_selected(void); | ||
180 | int item_is_tag(char tag); | ||
181 | #define item_foreach() \ | ||
182 | for (item_cur = item_head ? item_head: item_cur; \ | ||
183 | item_cur && (item_cur != &item_nil); item_cur = item_cur->next) | ||
184 | |||
185 | /* generic key handlers */ | ||
186 | int on_key_esc(WINDOW *win); | ||
187 | int on_key_resize(void); | ||
188 | |||
189 | void init_dialog(const char *backtitle); | ||
190 | void reset_dialog(void); | ||
142 | void end_dialog(void); | 191 | void end_dialog(void); |
143 | void attr_clear(WINDOW * win, int height, int width, chtype attr); | 192 | void attr_clear(WINDOW * win, int height, int width, chtype attr); |
144 | void dialog_clear(void); | 193 | void dialog_clear(void); |
145 | void color_setup(void); | ||
146 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); | 194 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); |
147 | void print_button(WINDOW * win, const char *label, int y, int x, int selected); | 195 | void print_button(WINDOW * win, const char *label, int y, int x, int selected); |
148 | void print_title(WINDOW *dialog, const char *title, int width); | 196 | void print_title(WINDOW *dialog, const char *title, int width); |
@@ -155,12 +203,10 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width); | |||
155 | int dialog_msgbox(const char *title, const char *prompt, int height, | 203 | int dialog_msgbox(const char *title, const char *prompt, int height, |
156 | int width, int pause); | 204 | int width, int pause); |
157 | int dialog_textbox(const char *title, const char *file, int height, int width); | 205 | int dialog_textbox(const char *title, const char *file, int height, int width); |
158 | int dialog_menu(const char *title, const char *prompt, int height, int width, | 206 | int dialog_menu(const char *title, const char *prompt, |
159 | int menu_height, const char *choice, int item_no, | 207 | const void *selected, int *s_scroll); |
160 | const char *const *items); | ||
161 | int dialog_checklist(const char *title, const char *prompt, int height, | 208 | int dialog_checklist(const char *title, const char *prompt, int height, |
162 | int width, int list_height, int item_no, | 209 | int width, int list_height); |
163 | const char *const *items); | ||
164 | extern char dialog_input_result[]; | 210 | extern char dialog_input_result[]; |
165 | int dialog_inputbox(const char *title, const char *prompt, int height, | 211 | int dialog_inputbox(const char *title, const char *prompt, int height, |
166 | int width, const char *init); | 212 | int width, const char *init); |