Update URL's to GitLab.
[cboard.git] / src / menu.h
blob153f536690f6795d778712b64ebcf17665a62f4c
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2002-2018 Ben Kibbey <bjk@luxsci.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MENU_H
20 #define MENU_H
22 #include "window.h"
24 #define MAX_MENU_HEIGHT (LINES - 4)
25 #define MAX_MENU_WIDTH (COLS - 4)
26 #define REFRESH_MENU -2
28 struct menu_item_s
30 char *name;
31 char *value;
32 int selected;
35 typedef struct menu_input_s MENU_INPUT;
36 typedef void (menu_key) (MENU_INPUT *);
38 struct menu_key_s
40 wint_t c;
41 menu_key *func;
42 void *data;
45 typedef void (menu_print_func) (WIN *);
46 typedef struct menu_item_s **(menu_items_fn) (WIN *);
48 struct menu_input_s
50 int update;
51 int selected;
52 int nofree;
53 int top;
54 int total;
55 menu_items_fn *func;
56 menu_key *draw_exit_func;
57 menu_print_func *print_func;
58 int print_line;
59 int name_only;
60 struct menu_item_s **items;
61 struct menu_item_s *item;
62 struct menu_key_s **keys;
63 void *data;
64 char search[16];
65 int rstatic;
66 int cstatic;
67 int ystatic;
68 int xstatic;
71 void add_menu_key (struct menu_key_s ***dst, wint_t c, menu_key func);
72 WIN *construct_menu (int rows, int cols, int y, int x, const char *title,
73 int name_only, menu_items_fn * func,
74 struct menu_key_s **keys, void *data,
75 menu_print_func * pfunc, window_exit_func * efunc,
76 window_resize_func *rfunc);
77 void redraw_menu (WIN *);
79 #endif