kconfig/nconf.h
changeset 2882 da77b5e7cb9f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/kconfig/nconf.h	Mon Feb 13 21:10:06 2012 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +/*
     1.5 + * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com?
     1.6 + * Released under the terms of the GNU GPL v2.0.
     1.7 + *
     1.8 + * Derived from menuconfig.
     1.9 + *
    1.10 + */
    1.11 +
    1.12 +#include <ctype.h>
    1.13 +#include <errno.h>
    1.14 +#include <fcntl.h>
    1.15 +#include <limits.h>
    1.16 +#include <stdarg.h>
    1.17 +#include <stdlib.h>
    1.18 +#include <string.h>
    1.19 +#include <unistd.h>
    1.20 +#include <locale.h>
    1.21 +#include <curses.h>
    1.22 +#include <menu.h>
    1.23 +#include <panel.h>
    1.24 +#include <form.h>
    1.25 +
    1.26 +#include <stdio.h>
    1.27 +#include <time.h>
    1.28 +#include <sys/time.h>
    1.29 +
    1.30 +#include "ncurses.h"
    1.31 +
    1.32 +#define max(a, b) ({\
    1.33 +		typeof(a) _a = a;\
    1.34 +		typeof(b) _b = b;\
    1.35 +		_a > _b ? _a : _b; })
    1.36 +
    1.37 +#define min(a, b) ({\
    1.38 +		typeof(a) _a = a;\
    1.39 +		typeof(b) _b = b;\
    1.40 +		_a < _b ? _a : _b; })
    1.41 +
    1.42 +typedef enum {
    1.43 +	NORMAL = 1,
    1.44 +	MAIN_HEADING,
    1.45 +	MAIN_MENU_BOX,
    1.46 +	MAIN_MENU_FORE,
    1.47 +	MAIN_MENU_BACK,
    1.48 +	MAIN_MENU_GREY,
    1.49 +	MAIN_MENU_HEADING,
    1.50 +	SCROLLWIN_TEXT,
    1.51 +	SCROLLWIN_HEADING,
    1.52 +	SCROLLWIN_BOX,
    1.53 +	DIALOG_TEXT,
    1.54 +	DIALOG_MENU_FORE,
    1.55 +	DIALOG_MENU_BACK,
    1.56 +	DIALOG_BOX,
    1.57 +	INPUT_BOX,
    1.58 +	INPUT_HEADING,
    1.59 +	INPUT_TEXT,
    1.60 +	INPUT_FIELD,
    1.61 +	FUNCTION_TEXT,
    1.62 +	FUNCTION_HIGHLIGHT,
    1.63 +	ATTR_MAX
    1.64 +} attributes_t;
    1.65 +extern attributes_t attributes[];
    1.66 +
    1.67 +typedef enum {
    1.68 +	F_HELP = 1,
    1.69 +	F_SYMBOL = 2,
    1.70 +	F_INSTS = 3,
    1.71 +	F_CONF = 4,
    1.72 +	F_BACK = 5,
    1.73 +	F_SAVE = 6,
    1.74 +	F_LOAD = 7,
    1.75 +	F_SEARCH = 8,
    1.76 +	F_EXIT = 9,
    1.77 +} function_key;
    1.78 +
    1.79 +void set_colors(void);
    1.80 +
    1.81 +/* this changes the windows attributes !!! */
    1.82 +void print_in_middle(WINDOW *win,
    1.83 +		int starty,
    1.84 +		int startx,
    1.85 +		int width,
    1.86 +		const char *string,
    1.87 +		chtype color);
    1.88 +int get_line_length(const char *line);
    1.89 +int get_line_no(const char *text);
    1.90 +const char *get_line(const char *text, int line_no);
    1.91 +void fill_window(WINDOW *win, const char *text);
    1.92 +int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
    1.93 +int dialog_inputbox(WINDOW *main_window,
    1.94 +		const char *title, const char *prompt,
    1.95 +		const char *init, char *result, int result_len);
    1.96 +void refresh_all_windows(WINDOW *main_window);
    1.97 +void show_scroll_win(WINDOW *main_window,
    1.98 +		const char *title,
    1.99 +		const char *text);