core/MenuStyle_Valve.h
author Scott Ehlert <ds@alliedmods.net>
Fri Jun 22 15:37:12 2007 +0000 (2007-06-22)
changeset 1001 8de56a71f200
parent 877 898c39fbfde9
child 1231 17badaf66ce4
permissions -rw-r--r--
Implemented amb423 - Added IsClientObserver() native
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  * This file is not open source and may not be copied without explicit
     8  * written permission of AlliedModders LLC.  This file may not be redistributed 
     9  * in whole or significant part.
    10  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    11  *
    12  * Version: $Id$
    13  */
    14 
    15 #ifndef _INCLUDE_MENUSTYLE_VALVE_H
    16 #define _INCLUDE_MENUSTYLE_VALVE_H
    17 
    18 #include "sm_globals.h"
    19 #include "MenuManager.h"
    20 #include "MenuStyle_Base.h"
    21 #include "sourcemm_api.h"
    22 #include "KeyValues.h"
    23 #include "sm_fastlink.h"
    24 
    25 using namespace SourceMod;
    26 
    27 class CValveMenuPlayer : public CBaseMenuPlayer
    28 {
    29 public:
    30 	CValveMenuPlayer() : curPrioLevel(1)
    31 	{
    32 	}
    33 	int curPrioLevel;
    34 };
    35 
    36 class CValveMenu;
    37 class CValveMenuDisplay;
    38 
    39 class ValveMenuStyle : 
    40 	public SMGlobalClass,
    41 	public BaseMenuStyle
    42 {
    43 public:
    44 	ValveMenuStyle();
    45 	bool OnClientCommand(int client);
    46 public: //BaseMenuStyle
    47 	CBaseMenuPlayer *GetMenuPlayer(int client);
    48 	void SendDisplay(int client, IMenuPanel *display);
    49 	bool DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh, unsigned int time);
    50 	bool DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time);
    51 public: //SMGlobalClass
    52 	void OnSourceModAllInitialized();
    53 	void OnSourceModShutdown();
    54 	void OnSourceModVSPReceived(IServerPluginCallbacks *iface);
    55 public: //IMenuStyle
    56 	const char *GetStyleName();
    57 	IMenuPanel *CreatePanel();
    58 	IBaseMenu *CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
    59 	unsigned int GetMaxPageItems();
    60 private:
    61 	void HookCreateMessage(edict_t *pEdict, DIALOG_TYPE type, KeyValues *kv, IServerPluginCallbacks *plugin);
    62 private:
    63 	CValveMenuPlayer *m_players;
    64 };
    65 
    66 class CValveMenu;
    67 
    68 class CValveMenuDisplay : public IMenuPanel
    69 {
    70 public:
    71 	CValveMenuDisplay();
    72 	CValveMenuDisplay(CValveMenu *pMenu);
    73 	~CValveMenuDisplay();
    74 public:
    75 	IMenuStyle *GetParentStyle();
    76 	void Reset();
    77 	void DrawTitle(const char *text, bool onlyIfEmpty=false);
    78 	unsigned int DrawItem(const ItemDrawInfo &item);
    79 	bool DrawRawLine(const char *rawline);
    80 	bool SendDisplay(int client, IMenuHandler *handler, unsigned int time);
    81 	bool SetExtOption(MenuOption option, const void *valuePtr);
    82 	bool CanDrawItem(unsigned int drawFlags);
    83 	void SendRawDisplay(int client, int priority, unsigned int time);
    84 	void DeleteThis();
    85 	bool SetSelectableKeys(unsigned int keymap);
    86 	unsigned int GetCurrentKey();
    87 	bool SetCurrentKey(unsigned int key);
    88 private:
    89 	KeyValues *m_pKv;
    90 	unsigned int m_NextPos;
    91 	bool m_TitleDrawn;
    92 };
    93 
    94 class CValveMenu : public CBaseMenu
    95 {
    96 	friend class CValveMenuDisplay;
    97 public:
    98 	CValveMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
    99 public: //IBaseMenu
   100 	bool SetExtOption(MenuOption option, const void *valuePtr);
   101 	IMenuPanel *CreatePanel();
   102 	bool GetExitButton();
   103 	bool SetExitButton(bool set);
   104 	bool SetPagination(unsigned int itemsPerPage);
   105 	bool Display(int client, unsigned int time);
   106 	void VoteDisplay(int client, unsigned int maxTime);
   107 public: //CBaseMenu
   108 	void Cancel_Finally();
   109 private:
   110 	Color m_IntroColor;
   111 	char m_IntroMsg[128];
   112 };
   113 
   114 extern ValveMenuStyle g_ValveMenuStyle;
   115 
   116 #endif //_INCLUDE_MENUSTYLE_VALVE_H