Added a reset argument to 'sm cvars' (
bug 5043, r=psychonic).
3 * =============================================================================
5 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_MENUSTYLE_BASE_H
33 #define _INCLUDE_MENUSTYLE_BASE_H
35 #include <IMenuManager.h>
36 #include <IPlayerHelpers.h>
37 #include <sh_string.h>
38 #include <sh_vector.h>
39 #include "sm_memtable.h"
40 #include "sm_fastlink.h"
42 using namespace SourceMod;
43 using namespace SourceHook;
65 CBaseMenuPlayer() : bInMenu(false), bAutoIgnore(false), bInExternMenu(false)
72 unsigned int menuHoldTime;
80 public IClientListener
85 bool CancelClientMenu(int client, bool autoIgnore/* =false */);
86 MenuSource GetClientMenu(int client, void **object);
88 public: //IClientListener
89 void OnClientDisconnected(int client);
90 public: //what derived must implement
91 virtual CBaseMenuPlayer *GetMenuPlayer(int client) =0;
92 virtual void SendDisplay(int client, IMenuPanel *display) =0;
93 public: //what derived may implement
94 virtual bool DoClientMenu(int client,
96 unsigned int first_item,
99 virtual bool DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time);
100 virtual void AddClientToWatch(int client);
101 virtual void RemoveClientFromWatch(int client);
102 virtual void ProcessWatchList();
104 void CancelMenu(CBaseMenu *menu);
105 void ClientPressedKey(int client, unsigned int key_press);
107 void _CancelClientMenu(int client, MenuCancelReason reason, bool bAutoIgnore=false);
108 bool RedoClientMenu(int client, ItemOrder order);
110 FastLink<int> m_WatchList;
114 class CBaseMenu : public IBaseMenu
117 CBaseMenu(IMenuHandler *pHandler, IMenuStyle *pStyle, IdentityToken_t *pOwner);
118 virtual ~CBaseMenu();
120 virtual bool AppendItem(const char *info, const ItemDrawInfo &draw);
121 virtual bool InsertItem(unsigned int position, const char *info, const ItemDrawInfo &draw);
122 virtual bool RemoveItem(unsigned int position);
123 virtual void RemoveAllItems();
124 virtual const char *GetItemInfo(unsigned int position, ItemDrawInfo *draw=NULL);
125 virtual unsigned int GetItemCount();
126 virtual bool SetPagination(unsigned int itemsPerPage);
127 virtual unsigned int GetPagination();
128 virtual IMenuStyle *GetDrawStyle();
129 virtual void SetDefaultTitle(const char *message);
130 virtual const char *GetDefaultTitle();
131 virtual void Cancel();
132 virtual void Destroy(bool releaseHandle);
133 virtual void Cancel_Finally() =0;
134 virtual Handle_t GetHandle();
135 virtual unsigned int GetMenuOptionFlags();
136 virtual void SetMenuOptionFlags(unsigned int flags);
137 virtual IMenuHandler *GetHandler();
138 unsigned int GetBaseMemUsage();
140 void InternalDelete();
143 IMenuStyle *m_pStyle;
144 BaseStringTable m_Strings;
145 unsigned int m_Pagination;
146 CVector<CItem> m_items;
147 bool m_bShouldDelete;
149 IdentityToken_t *m_pOwner;
151 bool m_bWillFreeHandle;
153 IMenuHandler *m_pHandler;
154 unsigned int m_nFlags;
157 #endif //_INCLUDE_MENUSTYLE_BASE_H