core/MenuStyle_Radio.h
author Scott Ehlert <ds@alliedmods.net>
Mon May 14 21:29:17 2007 +0000 (2007-05-14)
changeset 794 5947b0ee60bb
parent 790 9b1474d03470
child 819 a2f2353049b9
permissions -rw-r--r--
Implemented amb286 - .smx extension no longer required with "sm plugins load"
     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_RADIO_H
    16 #define _INCLUDE_MENUSTYLE_RADIO_H
    17 
    18 #include "sm_globals.h"
    19 #include "MenuManager.h"
    20 #include "MenuStyle_Base.h"
    21 #include "sourcemm_api.h"
    22 #include <IPlayerHelpers.h>
    23 #include <IUserMessages.h>
    24 #include "sm_fastlink.h"
    25 #include <sh_stack.h>
    26 
    27 using namespace SourceMod;
    28 
    29 class CRadioDisplay;
    30 class CRadioMenu;
    31 
    32 class CRadioStyle : 
    33 	public BaseMenuStyle,
    34 	public SMGlobalClass,
    35 	public IUserMessageListener
    36 {
    37 public:
    38 	CRadioStyle();
    39 public: //SMGlobalClass
    40 	void OnSourceModLevelChange(const char *mapName);
    41 	void OnSourceModShutdown();
    42 public: //BaseMenuStyle
    43 	CBaseMenuPlayer *GetMenuPlayer(int client);
    44 	void SendDisplay(int client, IMenuPanel *display);
    45 public: //IMenuStyle
    46 	const char *GetStyleName();
    47 	IMenuPanel *CreatePanel();
    48 	IBaseMenu *CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
    49 	unsigned int GetMaxPageItems();
    50 public: //IUserMessageListener
    51 	void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
    52 	void OnUserMessageSent(int msg_id);
    53 public:
    54 	bool IsSupported();
    55 	bool OnClientCommand(int client);
    56 public:
    57 	CRadioDisplay *MakeRadioDisplay(CRadioMenu *menu=NULL);
    58 	void FreeRadioDisplay(CRadioDisplay *display);
    59 private:
    60 	CBaseMenuPlayer *m_players;
    61 	CStack<CRadioDisplay *> m_FreeDisplays;
    62 };
    63 
    64 class CRadioDisplay : public IMenuPanel
    65 {
    66 	friend class CRadioStyle;
    67 public:
    68 	CRadioDisplay();
    69 	CRadioDisplay(CRadioMenu *menu);
    70 public: //IMenuPanel
    71 	IMenuStyle *GetParentStyle();
    72 	void Reset();
    73 	void DrawTitle(const char *text, bool onlyIfEmpty=false);
    74 	unsigned int DrawItem(const ItemDrawInfo &item);
    75 	bool DrawRawLine(const char *rawline);
    76 	bool SetExtOption(MenuOption option, const void *valuePtr);
    77 	bool CanDrawItem(unsigned int drawFlags);
    78 	bool SendDisplay(int client, IMenuHandler *handler, unsigned int time);
    79 	void DeleteThis();
    80 	void SendRawDisplay(int client, unsigned int time);
    81 private:
    82 	String m_BufferText;
    83 	String m_Title;
    84 	unsigned int m_NextPos;
    85 	int keys;
    86 };
    87 
    88 class CRadioMenu : public CBaseMenu
    89 {
    90 public:
    91 	CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
    92 public:
    93 	bool SetExtOption(MenuOption option, const void *valuePtr);
    94 	IMenuPanel *CreatePanel();
    95 	bool Display(int client, unsigned int time);
    96 	void Cancel_Finally();
    97 };
    98 
    99 extern CRadioStyle g_RadioMenuStyle;
   100 
   101 #endif //_INCLUDE_MENUSTYLE_RADIO_H