vkQuake2 doxygen  1.0 dev
qmenu.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
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.
18 
19 */
20 #ifndef __QMENU_H__
21 #define __QMENU_H__
22 
23 #define MAXMENUITEMS 64
24 
25 #define MTYPE_SLIDER 0
26 #define MTYPE_LIST 1
27 #define MTYPE_ACTION 2
28 #define MTYPE_SPINCONTROL 3
29 #define MTYPE_SEPARATOR 4
30 #define MTYPE_FIELD 5
31 
32 #define K_TAB 9
33 #define K_ENTER 13
34 #define K_ESCAPE 27
35 #define K_SPACE 32
36 
37 // normal keys should be passed as lowercased ascii
38 
39 #define K_BACKSPACE 127
40 #define K_UPARROW 128
41 #define K_DOWNARROW 129
42 #define K_LEFTARROW 130
43 #define K_RIGHTARROW 131
44 
45 #define QMF_LEFT_JUSTIFY 0x00000001
46 #define QMF_GRAYED 0x00000002
47 #define QMF_NUMBERSONLY 0x00000004
48 
49 typedef struct _tag_menuframework
50 {
51  int x, y;
52  int cursor;
53 
54  int nitems;
55  int nslots;
56  void *items[64];
57 
58  const char *statusbar;
59 
61 
63 
64 typedef struct
65 {
66  int type;
67  const char *name;
68  int x, y;
71  int localdata[4];
72  unsigned flags;
73 
74  const char *statusbar;
75 
76  void (*callback)( void *self );
77  void (*statusbarfunc)( void *self );
78  void (*ownerdraw)( void *self );
79  void (*cursordraw)( void *self );
80 } menucommon_s;
81 
82 typedef struct
83 {
84  menucommon_s generic;
85 
86  char buffer[80];
87  int cursor;
88  int length;
91 } menufield_s;
92 
93 typedef struct
94 {
95  menucommon_s generic;
96 
97  float minvalue;
98  float maxvalue;
99  float curvalue;
100 
101  float range;
102 } menuslider_s;
103 
104 typedef struct
105 {
106  menucommon_s generic;
107 
108  int curvalue;
109 
110  const char **itemnames;
111 } menulist_s;
112 
113 typedef struct
114 {
115  menucommon_s generic;
116 } menuaction_s;
117 
118 typedef struct
119 {
120  menucommon_s generic;
122 
123 qboolean Field_Key( menufield_s *field, int key );
124 
125 void Menu_AddItem( menuframework_s *menu, void *item );
126 void Menu_AdjustCursor( menuframework_s *menu, int dir );
127 void Menu_Center( menuframework_s *menu );
128 void Menu_Draw( menuframework_s *menu );
131 void Menu_SetStatusBar( menuframework_s *s, const char *string );
132 void Menu_SlideItem( menuframework_s *s, int dir );
133 int Menu_TallySlots( menuframework_s *menu );
134 
135 void Menu_DrawString( int, int, const char * );
136 void Menu_DrawStringDark( int, int, const char * );
137 void Menu_DrawStringR2L( int, int, const char * );
138 void Menu_DrawStringR2LDark( int, int, const char * );
139 
140 #endif
menuseparator_s
Definition: qmenu.h:118
menufield_s::visible_offset
int visible_offset
Definition: qmenu.h:90
menuframework_s
struct _tag_menuframework menuframework_s
_tag_menuframework::items
void * items[64]
Definition: qmenu.h:56
menufield_s::visible_length
int visible_length
Definition: qmenu.h:89
menucommon_s::type
int type
Definition: qmenu.h:66
Menu_AddItem
void Menu_AddItem(menuframework_s *menu, void *item)
Definition: qmenu.c:266
_tag_menuframework::y
int y
Definition: qmenu.h:51
Menu_DrawStringR2L
void Menu_DrawStringR2L(int, int, const char *)
Definition: qmenu.c:454
menufield_s::length
int length
Definition: qmenu.h:88
qboolean
qboolean
Definition: q_shared.h:63
x
GLint GLenum GLint x
Definition: qgl_win.c:116
Menu_DrawStringDark
void Menu_DrawStringDark(int, int, const char *)
Definition: qmenu.c:444
menucommon_s::flags
unsigned flags
Definition: qmenu.h:72
Menu_AdjustCursor
void Menu_AdjustCursor(menuframework_s *menu, int dir)
Definition: qmenu.c:288
menuslider_s::range
float range
Definition: qmenu.h:101
buffer
GLenum GLfloat * buffer
Definition: qgl_win.c:151
_tag_menuframework::statusbar
const char * statusbar
Definition: qmenu.h:58
menuslider_s::minvalue
float minvalue
Definition: qmenu.h:97
menufield_s::cursor
int cursor
Definition: qmenu.h:87
menucommon_s::y
int y
Definition: qmenu.h:68
Menu_SlideItem
void Menu_SlideItem(menuframework_s *s, int dir)
Definition: qmenu.c:511
menucommon_s
Definition: qmenu.h:64
menulist_s
Definition: qmenu.h:104
menuslider_s::maxvalue
float maxvalue
Definition: qmenu.h:98
_tag_menuframework::cursordraw
void(* cursordraw)(struct _tag_menuframework *m)
Definition: qmenu.h:60
_tag_menuframework::cursor
int cursor
Definition: qmenu.h:52
Menu_SetStatusBar
void Menu_SetStatusBar(menuframework_s *s, const char *string)
Definition: qmenu.c:506
menucommon_s::cursor_offset
int cursor_offset
Definition: qmenu.h:70
menuaction_s
Definition: qmenu.h:113
Menu_Draw
void Menu_Draw(menuframework_s *menu)
Definition: qmenu.c:346
_tag_menuframework
Definition: qmenu.h:49
_tag_menuframework::nitems
int nitems
Definition: qmenu.h:54
menulist_s::curvalue
int curvalue
Definition: qmenu.h:108
s
static fixed16_t s
Definition: r_scan.c:30
Menu_DrawStringR2LDark
void Menu_DrawStringR2LDark(int, int, const char *)
Definition: qmenu.c:464
Menu_TallySlots
int Menu_TallySlots(menuframework_s *menu)
Definition: qmenu.c:529
Menu_ItemAtCursor
void * Menu_ItemAtCursor(menuframework_s *m)
Definition: qmenu.c:474
Menu_SelectItem
qboolean Menu_SelectItem(menuframework_s *s)
Definition: qmenu.c:482
_tag_menuframework::x
int x
Definition: qmenu.h:51
menucommon_s::statusbar
const char * statusbar
Definition: qmenu.h:74
menuslider_s::curvalue
float curvalue
Definition: qmenu.h:99
menuslider_s
Definition: qmenu.h:93
menucommon_s::name
const char * name
Definition: qmenu.h:67
menufield_s
Definition: qmenu.h:82
menulist_s::itemnames
const char ** itemnames
Definition: qmenu.h:110
_tag_menuframework::nslots
int nslots
Definition: qmenu.h:55
Menu_Center
void Menu_Center(menuframework_s *menu)
Definition: qmenu.c:336
Menu_DrawString
void Menu_DrawString(int, int, const char *)
Definition: qmenu.c:434
menucommon_s::parent
menuframework_s * parent
Definition: qmenu.h:69
Field_Key
qboolean Field_Key(menufield_s *field, int key)
Definition: qmenu.c:135
void
void(APIENTRY *qglAccum)(GLenum op