1 | /*␊ |
2 | * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com?␊ |
3 | * Released under the terms of the GNU GPL v2.0.␊ |
4 | *␊ |
5 | * Derived from menuconfig.␊ |
6 | *␊ |
7 | */␊ |
8 | ␊ |
9 | #include <ctype.h>␊ |
10 | #include <errno.h>␊ |
11 | #include <fcntl.h>␊ |
12 | #include <limits.h>␊ |
13 | #include <stdarg.h>␊ |
14 | #include <stdlib.h>␊ |
15 | #include <string.h>␊ |
16 | #include <unistd.h>␊ |
17 | #include <locale.h>␊ |
18 | #include <curses.h>␊ |
19 | #include <menu.h>␊ |
20 | #include <panel.h>␊ |
21 | #include <form.h>␊ |
22 | ␊ |
23 | #include <stdio.h>␊ |
24 | #include <time.h>␊ |
25 | #include <sys/time.h>␊ |
26 | ␊ |
27 | #include "ncurses.h"␊ |
28 | ␊ |
29 | typedef enum {␊ |
30 | ␉NORMAL = 1,␊ |
31 | ␉MAIN_HEADING,␊ |
32 | ␉MAIN_MENU_BOX,␊ |
33 | ␉MAIN_MENU_FORE,␊ |
34 | ␉MAIN_MENU_BACK,␊ |
35 | ␉MAIN_MENU_GREY,␊ |
36 | ␉MAIN_MENU_HEADING,␊ |
37 | ␉SCROLLWIN_TEXT,␊ |
38 | ␉SCROLLWIN_HEADING,␊ |
39 | ␉SCROLLWIN_BOX,␊ |
40 | ␉DIALOG_TEXT,␊ |
41 | ␉DIALOG_MENU_FORE,␊ |
42 | ␉DIALOG_MENU_BACK,␊ |
43 | ␉DIALOG_BOX,␊ |
44 | ␉INPUT_BOX,␊ |
45 | ␉INPUT_HEADING,␊ |
46 | ␉INPUT_TEXT,␊ |
47 | ␉INPUT_FIELD,␊ |
48 | ␉FUNCTION_TEXT,␊ |
49 | ␉FUNCTION_HIGHLIGHT,␊ |
50 | ␉ATTR_MAX␊ |
51 | } attributes_t;␊ |
52 | extern attributes_t attributes[];␊ |
53 | ␊ |
54 | typedef enum {␊ |
55 | ␉F_HELP = 1,␊ |
56 | ␉F_SYMBOL = 2,␊ |
57 | ␉F_INSTS = 3,␊ |
58 | ␉F_CONF = 4,␊ |
59 | ␉F_BACK = 5,␊ |
60 | ␉F_SAVE = 6,␊ |
61 | ␉F_LOAD = 7,␊ |
62 | ␉F_SEARCH = 8,␊ |
63 | ␉F_EXIT = 9,␊ |
64 | } function_key;␊ |
65 | ␊ |
66 | void set_colors(void);␊ |
67 | ␊ |
68 | /* this changes the windows attributes !!! */␊ |
69 | void print_in_middle(WINDOW *win,␊ |
70 | ␉␉int starty,␊ |
71 | ␉␉int startx,␊ |
72 | ␉␉int width,␊ |
73 | ␉␉const char *string,␊ |
74 | ␉␉chtype color);␊ |
75 | int get_line_length(const char *line);␊ |
76 | int get_line_no(const char *text);␊ |
77 | const char *get_line(const char *text, int line_no);␊ |
78 | void fill_window(WINDOW *win, const char *text);␊ |
79 | int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);␊ |
80 | int dialog_inputbox(WINDOW *main_window,␊ |
81 | ␉␉const char *title, const char *prompt,␊ |
82 | ␉␉const char *init, char *result, int result_len);␊ |
83 | void refresh_all_windows(WINDOW *main_window);␊ |
84 | void show_scroll_win(WINDOW *main_window,␊ |
85 | ␉␉const char *title,␊ |
86 | ␉␉const char *text);␊ |
87 | |