|
pred@2048
|
1 |
/** |
|
pred@2048
|
2 |
* vim: set ts=4 : |
|
pred@2048
|
3 |
* ============================================================================= |
|
pred@2048
|
4 |
* SourceMod Client Preferences Extension |
|
pred@2048
|
5 |
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. |
|
pred@2048
|
6 |
* ============================================================================= |
|
pred@2048
|
7 |
* |
|
pred@2048
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
pred@2048
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
pred@2048
|
10 |
* Free Software Foundation. |
|
pred@2048
|
11 |
* |
|
pred@2048
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
pred@2048
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
pred@2048
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
pred@2048
|
15 |
* details. |
|
pred@2048
|
16 |
* |
|
pred@2048
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
pred@2048
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
pred@2048
|
19 |
* |
|
pred@2048
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
pred@2048
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
pred@2048
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
pred@2048
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
pred@2048
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
pred@2048
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
pred@2048
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
pred@2048
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
pred@2048
|
28 |
* |
|
pred@2048
|
29 |
* Version: $Id$ |
|
pred@2048
|
30 |
*/ |
|
pred@2048
|
31 |
|
|
pred@2048
|
32 |
#ifndef _INCLUDE_SOURCEMOD_CLIENTPREFS_MENUS_H_ |
|
pred@2048
|
33 |
#define _INCLUDE_SOURCEMOD_CLIENTPREFS_MENUS_H_ |
|
pred@2048
|
34 |
|
|
pred@2048
|
35 |
#include "extension.h" |
|
pred@2048
|
36 |
#include "cookie.h" |
|
pred@2048
|
37 |
|
|
pred@2048
|
38 |
enum CookieMenuAction |
|
pred@2048
|
39 |
{ |
|
pred@2048
|
40 |
/** |
|
pred@2048
|
41 |
* An option is being drawn for a menu. |
|
pred@2048
|
42 |
* |
|
pred@2048
|
43 |
* INPUT : Client index and any data if available. |
|
pred@2048
|
44 |
* OUTPUT: Buffer for rendering, maxlength of buffer. |
|
pred@2048
|
45 |
*/ |
|
pred@2048
|
46 |
CookieMenuAction_DisplayOption = 0, |
|
pred@2048
|
47 |
|
|
pred@2048
|
48 |
/** |
|
pred@2048
|
49 |
* A menu option has been selected. |
|
pred@2048
|
50 |
* |
|
pred@2048
|
51 |
* INPUT : Client index and any data if available. |
|
pred@2048
|
52 |
*/ |
|
pred@2048
|
53 |
CookieMenuAction_SelectOption = 1, |
|
pred@2048
|
54 |
}; |
|
pred@2048
|
55 |
|
|
pred@2048
|
56 |
enum CookieMenu |
|
pred@2048
|
57 |
{ |
|
pred@2048
|
58 |
CookieMenu_YesNo, /**< Yes/No menu with "yes"/"no" results saved into the cookie */ |
|
pred@2048
|
59 |
CookieMenu_YesNo_Int, /**< Yes/No menu with 1/0 saved into the cookie */ |
|
pred@2048
|
60 |
CookieMenu_OnOff, /**< On/Off menu with "on"/"off" results saved into the cookie */ |
|
pred@2048
|
61 |
CookieMenu_OnOff_Int, /**< On/Off menu with 1/0 saved into the cookie */ |
|
kyle@3804
|
62 |
CookieMenu_Elements |
|
pred@2048
|
63 |
}; |
|
pred@2048
|
64 |
|
|
pred@2048
|
65 |
struct ItemHandler |
|
pred@2048
|
66 |
{ |
|
pred@2048
|
67 |
IChangeableForward *forward; |
|
pred@2048
|
68 |
CookieMenu autoMenuType; |
|
kyle@3804
|
69 |
bool isAutoMenu; |
|
pred@2048
|
70 |
}; |
|
pred@2048
|
71 |
|
|
pred@2048
|
72 |
class ClientMenuHandler : public IMenuHandler |
|
pred@2048
|
73 |
{ |
|
pred@2048
|
74 |
void OnMenuSelect(IBaseMenu *menu, int client, unsigned int item); |
|
pred@2048
|
75 |
unsigned int OnMenuDisplayItem(IBaseMenu *menu, |
|
pred@2048
|
76 |
int client, |
|
pred@2048
|
77 |
IMenuPanel *panel, |
|
pred@2048
|
78 |
unsigned int item, |
|
pred@2048
|
79 |
const ItemDrawInfo &dr); |
|
pred@2048
|
80 |
}; |
|
pred@2048
|
81 |
|
|
pred@2048
|
82 |
class AutoMenuHandler : public IMenuHandler |
|
pred@2048
|
83 |
{ |
|
pred@2048
|
84 |
void OnMenuSelect(IBaseMenu *menu, int client, unsigned int item); |
|
pred@2048
|
85 |
void OnMenuEnd(IBaseMenu *menu, MenuEndReason reason); |
|
pred@2048
|
86 |
}; |
|
pred@2048
|
87 |
|
|
pred@2048
|
88 |
extern ClientMenuHandler g_Handler; |
|
pred@2048
|
89 |
extern AutoMenuHandler g_AutoHandler; |
|
pred@2048
|
90 |
|
|
pred@2048
|
91 |
/* Something went wrong with the includes and made me do this */ |
|
pred@2048
|
92 |
struct Cookie; |
|
pred@2048
|
93 |
enum CookieMenu; |
|
pred@2048
|
94 |
struct ItemHandler; |
|
pred@2048
|
95 |
|
|
pred@2048
|
96 |
struct AutoMenuData |
|
pred@2048
|
97 |
{ |
|
pred@2048
|
98 |
ItemHandler *handler; |
|
pred@2048
|
99 |
Cookie *pCookie; |
|
kyle@3804
|
100 |
cell_t datavalue; |
|
pred@2048
|
101 |
CookieMenu type; |
|
pred@2048
|
102 |
}; |
|
pred@2048
|
103 |
|
|
pred@2048
|
104 |
#endif // _INCLUDE_SOURCEMOD_CLIENTPREFS_MENUS_H_ |