Fix broken bounds check.
[calfbox.git] / menu.h
blob740f44bf193319fae05cca64aec53a531d53afe1
1 /*
2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010-2011 Krzysztof Foltman
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 3 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, see <http://www.gnu.org/licenses/>.
19 #ifndef CBOX_MENU_H
20 #define CBOX_MENU_H
22 #include <ncurses.h>
23 #include <stdint.h>
25 #include "menuitem.h"
26 #include "ui.h"
28 struct cbox_menu;
29 struct cbox_menu_item;
30 struct cbox_menu_page;
32 struct cbox_menu_state
34 struct cbox_menu_page *page;
35 struct cbox_menu *menu;
36 int cursor, yoffset, yspace;
37 struct cbox_menu_measure size;
38 WINDOW *window;
39 void *context;
40 struct cbox_menu_state *caller;
41 int menu_is_temporary;
44 extern struct cbox_menu *cbox_menu_new(void);
45 extern struct cbox_menu_item *cbox_menu_add_item(struct cbox_menu *menu, struct cbox_menu_item *item);
46 extern void cbox_menu_destroy(struct cbox_menu *menu);
48 extern struct cbox_menu_state *cbox_menu_state_new(struct cbox_menu_page *page, struct cbox_menu *menu, WINDOW *window, void *context);
49 extern void cbox_menu_state_destroy(struct cbox_menu_state *st);
51 struct cbox_menu_page
53 struct cbox_ui_page page;
54 struct cbox_menu_state *state;
57 extern struct cbox_menu_page *cbox_menu_page_new(void);
58 extern void cbox_menu_page_destroy(struct cbox_menu_page *st);
60 #endif