Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
0004  *
0005  * Derived from menuconfig.
0006  */
0007 
0008 #include <ctype.h>
0009 #include <errno.h>
0010 #include <fcntl.h>
0011 #include <limits.h>
0012 #include <stdarg.h>
0013 #include <stdlib.h>
0014 #include <string.h>
0015 #include <unistd.h>
0016 #include <ncurses.h>
0017 #include <menu.h>
0018 #include <panel.h>
0019 #include <form.h>
0020 
0021 #include <stdio.h>
0022 #include <time.h>
0023 #include <sys/time.h>
0024 
0025 #define max(a, b) ({\
0026         typeof(a) _a = a;\
0027         typeof(b) _b = b;\
0028         _a > _b ? _a : _b; })
0029 
0030 #define min(a, b) ({\
0031         typeof(a) _a = a;\
0032         typeof(b) _b = b;\
0033         _a < _b ? _a : _b; })
0034 
0035 extern int attr_normal;
0036 extern int attr_main_heading;
0037 extern int attr_main_menu_box;
0038 extern int attr_main_menu_fore;
0039 extern int attr_main_menu_back;
0040 extern int attr_main_menu_grey;
0041 extern int attr_main_menu_heading;
0042 extern int attr_scrollwin_text;
0043 extern int attr_scrollwin_heading;
0044 extern int attr_scrollwin_box;
0045 extern int attr_dialog_text;
0046 extern int attr_dialog_menu_fore;
0047 extern int attr_dialog_menu_back;
0048 extern int attr_dialog_box;
0049 extern int attr_input_box;
0050 extern int attr_input_heading;
0051 extern int attr_input_text;
0052 extern int attr_input_field;
0053 extern int attr_function_text;
0054 extern int attr_function_highlight;
0055 
0056 typedef enum {
0057     F_HELP = 1,
0058     F_SYMBOL = 2,
0059     F_INSTS = 3,
0060     F_CONF = 4,
0061     F_BACK = 5,
0062     F_SAVE = 6,
0063     F_LOAD = 7,
0064     F_SEARCH = 8,
0065     F_EXIT = 9,
0066 } function_key;
0067 
0068 void set_colors(void);
0069 
0070 /* this changes the windows attributes !!! */
0071 void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs);
0072 int get_line_length(const char *line);
0073 int get_line_no(const char *text);
0074 const char *get_line(const char *text, int line_no);
0075 void fill_window(WINDOW *win, const char *text);
0076 int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
0077 int dialog_inputbox(WINDOW *main_window,
0078         const char *title, const char *prompt,
0079         const char *init, char **resultp, int *result_len);
0080 void refresh_all_windows(WINDOW *main_window);
0081 void show_scroll_win(WINDOW *main_window,
0082         const char *title,
0083         const char *text);