|
|
1.1 root 1: #ifndef __QMENU_H__
2: #define __QMENU_H__
3:
4: #define MAXMENUITEMS 64
5:
6: #define MTYPE_SLIDER 0
7: #define MTYPE_LIST 1
8: #define MTYPE_ACTION 2
9: #define MTYPE_SPINCONTROL 3
10: #define MTYPE_SEPARATOR 4
11: #define MTYPE_FIELD 5
12:
13: #define K_TAB 9
14: #define K_ENTER 13
15: #define K_ESCAPE 27
16: #define K_SPACE 32
17:
18: // normal keys should be passed as lowercased ascii
19:
20: #define K_BACKSPACE 127
21: #define K_UPARROW 128
22: #define K_DOWNARROW 129
23: #define K_LEFTARROW 130
24: #define K_RIGHTARROW 131
25:
26: #define QMF_LEFT_JUSTIFY 0x00000001
27: #define QMF_GRAYED 0x00000002
28: #define QMF_NUMBERSONLY 0x00000004
29:
30: typedef struct _tag_menuframework
31: {
32: int x, y;
33: int cursor;
34:
35: int nitems;
36: int nslots;
37: void *items[64];
38:
39: const char *statusbar;
40:
41: void (*cursordraw)( struct _tag_menuframework *m );
42:
43: } menuframework_s;
44:
45: typedef struct
46: {
47: int type;
48: const char *name;
49: int x, y;
50: menuframework_s *parent;
51: int cursor_offset;
52: int localdata[4];
53: unsigned flags;
54:
55: const char *statusbar;
56:
57: void (*callback)( void *self );
58: void (*statusbarfunc)( void *self );
59: void (*ownerdraw)( void *self );
60: void (*cursordraw)( void *self );
61: } menucommon_s;
62:
63: typedef struct
64: {
65: menucommon_s generic;
66:
67: char buffer[80];
68: int cursor;
69: int length;
70: int visible_length;
71: int visible_offset;
72: } menufield_s;
73:
74: typedef struct
75: {
76: menucommon_s generic;
77:
78: float minvalue;
79: float maxvalue;
80: float curvalue;
81:
82: float range;
83: } menuslider_s;
84:
85: typedef struct
86: {
87: menucommon_s generic;
88:
89: int curvalue;
90:
91: const char **itemnames;
92: } menulist_s;
93:
94: typedef struct
95: {
96: menucommon_s generic;
97: } menuaction_s;
98:
99: typedef struct
100: {
101: menucommon_s generic;
102: } menuseparator_s;
103:
104: qboolean Field_Key( menufield_s *field, int key );
105:
106: void Menu_AddItem( menuframework_s *menu, void *item );
107: void Menu_AdjustCursor( menuframework_s *menu, int dir );
108: void Menu_Center( menuframework_s *menu );
109: void Menu_Draw( menuframework_s *menu );
110: void *Menu_ItemAtCursor( menuframework_s *m );
111: qboolean Menu_SelectItem( menuframework_s *s );
112: void Menu_SetStatusBar( menuframework_s *s, const char *string );
113: void Menu_SlideItem( menuframework_s *s, int dir );
114: int Menu_TallySlots( menuframework_s *menu );
115:
116: void Menu_DrawString( int, int, const char * );
117: void Menu_DrawStringDark( int, int, const char * );
118: void Menu_DrawStringR2L( int, int, const char * );
119: void Menu_DrawStringR2LDark( int, int, const char * );
120:
121: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.