menu_wrap.h (1831B) - raw
1 /*
2 * This is a curses menu wrapper as part of ncurses-ruby.
3 * It borrows heavily from form_wrap.h.
4 * Contributed by Earle Clubb <eclubb@valcom.com>
5 * Valcom Inc. <http://www.valcom.com>
6 * Copyright 2007
7 *
8 * This module is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This module is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this module; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * Changes
23 * (C) 2011 Tobias Herzke
24 */
25
26 #if !defined(MENU_HH) && (defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H))
27 #define MENU_HH
28
29 #ifdef HAVE_MENU_H
30 #include <menu.h>
31 #else
32 #include <ncursesw/menu.h>
33 #endif
34 #include <ruby.h>
35
36 extern VALUE mMenu;
37 extern VALUE cITEM;
38 extern VALUE cMENU;
39
40 #define MENU_DEF_CONST(name) \
41 rb_define_const(mMenu, #name, INT2NUM(name));
42
43 #define MENU_SNG_FUNC(name, nargs) \
44 rb_define_singleton_method(mMenu, #name, &rbncurs_m_ ## name, nargs)
45
46 #define RB_CLASS_METH(class, alt_name, name, nargs) \
47 rb_define_method(class, #name, (&rbncurs_c_ ## name), nargs); \
48 if (alt_name != NULL) \
49 rb_define_method(class, alt_name, (&rbncurs_c_ ## name), nargs); \
50
51 //void init_menu_req_constants(void);
52 //void init_menu_opts_constants(void);
53 void init_menu(void);
54
55 #endif