1 /*
2  * file mi_base.h
3  *
4  * $Id: mi_base.h,v 1.5 2006/02/09 21:21:24 fzago Exp $
5  *
6  * Program XBLAST
7  * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net)
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published
11  * by the Free Software Foundation; either version 2; or (at your option)
12  * any later version
13  *
14  * This program is distributed in the hope that it will be entertaining,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.
21  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 #ifndef _MI_BASE_H
24 #define _MI_BASE_H
25 
26 /*
27  * global macros
28  */
29 #define MIF_SELECTED    0x01
30 #define MIF_FOCUS       0x02
31 #define MIF_DEACTIVATED 0x04
32 
33 /* known menu item types */
34 typedef enum
35 {
36 	MIT_Button,
37 	MIT_Toggle,
38 	MIT_Label,
39 	MIT_Combo,
40 	MIT_Player,
41 	MIT_String,
42 	MIT_Color,
43 	MIT_Keysym,
44 	MIT_Cyclic,
45 	MIT_Integer,
46 	MIT_Host,
47 	MIT_Tag,
48 	MIT_Table,
49 	MIT_Team
50 } XBMenuItemType;
51 
52 struct _menu_item;
53 
54 /* function pointers for item specific behaviour */
55 typedef void (*MIC_focus) (struct _menu_item *, XBBool);
56 typedef void (*MIC_select) (struct _menu_item *);
57 typedef void (*MIC_mouse) (struct _menu_item *, XBEventCode);
58 typedef void (*MIC_poll) (struct _menu_item *);
59 
60 /* generic item data */
61 typedef struct _menu_item
62 {
63 	XBMenuItemType type;
64 	MENU_ID id;
65 	struct _menu_item *next;
66 	struct _menu_item *prev;
67 	struct _menu_item *left;
68 	struct _menu_item *right;
69 	struct _menu_item *up;
70 	struct _menu_item *down;
71 	int x;
72 	int y;
73 	int w;
74 	int h;
75 	unsigned flags;
76 	MIC_focus focus;
77 	MIC_select select;
78 	MIC_mouse mouse;
79 	MIC_poll poll;
80 } XBMenuItem;
81 
82 /*
83  * prototypes
84  */
85 extern void MenuResetBase (void);
86 extern void MenuSetItem (XBMenuItem * item, XBMenuItemType type, int x, int y, int w, int h,
87 						 MIC_focus focus, MIC_select select, MIC_mouse mouse, MIC_poll poll);
88 extern XBMenuItem *MenuFindLeftItem (const XBMenuItem * item);
89 extern XBMenuItem *MenuFindRightItem (const XBMenuItem * item);
90 extern XBMenuItem *MenuFindUpperItem (const XBMenuItem * item);
91 extern XBMenuItem *MenuFindLowerItem (const XBMenuItem * item);
92 extern XBMenuItem *MenuGetMouseItem (int x, int y);
93 
94 #endif
95 /*
96  * end of file mi_base.h
97  */
98