blob: 9f6f21d3b0d4674baab323071e5cd4d057d86c2f [file] [log] [blame]
Masahiro Yamada0a9064f2014-07-30 14:08:13 +09001/*
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>
Eugeniu Roscae91610d2018-05-19 14:13:50 +020018#include <ncurses.h>
Masahiro Yamada0a9064f2014-07-30 14:08:13 +090019#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
Masahiro Yamada0a9064f2014-07-30 14:08:13 +090027#define max(a, b) ({\
28 typeof(a) _a = a;\
29 typeof(b) _b = b;\
30 _a > _b ? _a : _b; })
31
32#define min(a, b) ({\
33 typeof(a) _a = a;\
34 typeof(b) _b = b;\
35 _a < _b ? _a : _b; })
36
37typedef enum {
38 NORMAL = 1,
39 MAIN_HEADING,
40 MAIN_MENU_BOX,
41 MAIN_MENU_FORE,
42 MAIN_MENU_BACK,
43 MAIN_MENU_GREY,
44 MAIN_MENU_HEADING,
45 SCROLLWIN_TEXT,
46 SCROLLWIN_HEADING,
47 SCROLLWIN_BOX,
48 DIALOG_TEXT,
49 DIALOG_MENU_FORE,
50 DIALOG_MENU_BACK,
51 DIALOG_BOX,
52 INPUT_BOX,
53 INPUT_HEADING,
54 INPUT_TEXT,
55 INPUT_FIELD,
56 FUNCTION_TEXT,
57 FUNCTION_HIGHLIGHT,
58 ATTR_MAX
59} attributes_t;
60extern attributes_t attributes[];
61
62typedef enum {
63 F_HELP = 1,
64 F_SYMBOL = 2,
65 F_INSTS = 3,
66 F_CONF = 4,
67 F_BACK = 5,
68 F_SAVE = 6,
69 F_LOAD = 7,
70 F_SEARCH = 8,
71 F_EXIT = 9,
72} function_key;
73
74void set_colors(void);
75
76/* this changes the windows attributes !!! */
77void print_in_middle(WINDOW *win,
78 int starty,
79 int startx,
80 int width,
81 const char *string,
82 chtype color);
83int get_line_length(const char *line);
84int get_line_no(const char *text);
85const char *get_line(const char *text, int line_no);
86void fill_window(WINDOW *win, const char *text);
87int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
88int dialog_inputbox(WINDOW *main_window,
89 const char *title, const char *prompt,
90 const char *init, char **resultp, int *result_len);
91void refresh_all_windows(WINDOW *main_window);
92void show_scroll_win(WINDOW *main_window,
93 const char *title,
94 const char *text);