dvander@769: /** dvander@769: * vim: set ts=4 : ds@1330: * ============================================================================= dvander@1231: * SourceMod dvander@1231: * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. ds@1330: * ============================================================================= dvander@769: * ds@1330: * This program is free software; you can redistribute it and/or modify it under ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the ds@1330: * Free Software Foundation. dvander@1231: * ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ds@1330: * details. dvander@1231: * ds@1330: * You should have received a copy of the GNU General Public License along with ds@1330: * this program. If not, see . dvander@1231: * ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants ds@1330: * this exception to all derivative works. AlliedModders LLC defines further ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), ds@1330: * or . dvander@769: * dvander@769: * Version: $Id$ dvander@769: */ dvander@769: dvander@769: #ifndef _INCLUDE_MENUSTYLE_VALVE_H dvander@769: #define _INCLUDE_MENUSTYLE_VALVE_H dvander@769: dvander@769: #include "sm_globals.h" dvander@769: #include "MenuManager.h" dvander@769: #include "MenuStyle_Base.h" dvander@769: #include "sourcemm_api.h" dvander@769: #include "KeyValues.h" dvander@769: #include "sm_fastlink.h" faluco@1541: #include dvander@769: dvander@769: using namespace SourceMod; dvander@769: dvander@775: class CValveMenuPlayer : public CBaseMenuPlayer dvander@769: { dvander@769: public: dvander@775: CValveMenuPlayer() : curPrioLevel(1) dvander@769: { dvander@769: } dvander@769: int curPrioLevel; dvander@769: }; dvander@769: dvander@769: class CValveMenu; dvander@769: class CValveMenuDisplay; dvander@769: dvander@769: class ValveMenuStyle : dvander@769: public SMGlobalClass, dvander@775: public BaseMenuStyle dvander@769: { dvander@769: public: dvander@769: ValveMenuStyle(); faluco@1541: bool OnClientCommand(int client, const char *cmdname, const CCommand &cmd); dvander@775: public: //BaseMenuStyle dvander@775: CBaseMenuPlayer *GetMenuPlayer(int client); dvander@787: void SendDisplay(int client, IMenuPanel *display); dvander@1474: bool DoClientMenu(int client, CBaseMenu *menu, unsigned int first_item, IMenuHandler *mh, unsigned int time); dvander@787: bool DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time); dvander@769: public: //SMGlobalClass dvander@769: void OnSourceModAllInitialized(); dvander@769: void OnSourceModShutdown(); dvander@769: void OnSourceModVSPReceived(IServerPluginCallbacks *iface); dvander@769: public: //IMenuStyle dvander@769: const char *GetStyleName(); dvander@787: IMenuPanel *CreatePanel(); dvander@790: IBaseMenu *CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner); dvander@769: unsigned int GetMaxPageItems(); dvander@769: private: dvander@769: void HookCreateMessage(edict_t *pEdict, DIALOG_TYPE type, KeyValues *kv, IServerPluginCallbacks *plugin); dvander@769: private: dvander@769: CValveMenuPlayer *m_players; dvander@769: }; dvander@769: dvander@769: class CValveMenu; dvander@769: dvander@787: class CValveMenuDisplay : public IMenuPanel dvander@769: { dvander@769: public: dvander@769: CValveMenuDisplay(); dvander@769: CValveMenuDisplay(CValveMenu *pMenu); dvander@769: ~CValveMenuDisplay(); dvander@769: public: dvander@769: IMenuStyle *GetParentStyle(); dvander@769: void Reset(); dvander@769: void DrawTitle(const char *text, bool onlyIfEmpty=false); dvander@769: unsigned int DrawItem(const ItemDrawInfo &item); dvander@769: bool DrawRawLine(const char *rawline); dvander@769: bool SendDisplay(int client, IMenuHandler *handler, unsigned int time); dvander@769: bool SetExtOption(MenuOption option, const void *valuePtr); dvander@769: bool CanDrawItem(unsigned int drawFlags); dvander@769: void SendRawDisplay(int client, int priority, unsigned int time); dvander@776: void DeleteThis(); dvander@819: bool SetSelectableKeys(unsigned int keymap); dvander@840: unsigned int GetCurrentKey(); dvander@840: bool SetCurrentKey(unsigned int key); dvander@1361: int GetAmountRemaining(); dvander@769: private: dvander@769: KeyValues *m_pKv; dvander@769: unsigned int m_NextPos; dvander@769: bool m_TitleDrawn; dvander@769: }; dvander@769: dvander@769: class CValveMenu : public CBaseMenu dvander@769: { dvander@769: friend class CValveMenuDisplay; dvander@769: public: dvander@790: CValveMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner); dvander@776: public: //IBaseMenu dvander@769: bool SetExtOption(MenuOption option, const void *valuePtr); dvander@787: IMenuPanel *CreatePanel(); dvander@769: bool GetExitButton(); dvander@769: bool SetExitButton(bool set); dvander@769: bool SetPagination(unsigned int itemsPerPage); dvander@1269: bool Display(int client, unsigned int time, IMenuHandler *alt_handler=NULL); dvander@1474: bool DisplayAtItem(int client, dvander@1474: unsigned int time, dvander@1474: unsigned int start_item, dvander@1474: IMenuHandler *alt_handler/* =NULL */); dvander@1259: void SetMenuOptionFlags(unsigned int flags); dvander@776: public: //CBaseMenu dvander@775: void Cancel_Finally(); dvander@769: private: dvander@769: Color m_IntroColor; dvander@769: char m_IntroMsg[128]; dvander@769: }; dvander@769: dvander@769: extern ValveMenuStyle g_ValveMenuStyle; dvander@769: dvander@769: #endif //_INCLUDE_MENUSTYLE_VALVE_H