1.1 --- a/core/MenuStyle_Radio.h Fri Mar 28 06:21:34 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,148 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod
1.8 - * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
1.9 - * =============================================================================
1.10 - *
1.11 - * This program is free software; you can redistribute it and/or modify it under
1.12 - * the terms of the GNU General Public License, version 3.0, as published by the
1.13 - * Free Software Foundation.
1.14 - *
1.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.18 - * details.
1.19 - *
1.20 - * You should have received a copy of the GNU General Public License along with
1.21 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.22 - *
1.23 - * As a special exception, AlliedModders LLC gives you permission to link the
1.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.26 - * by the Valve Corporation. You must obey the GNU General Public License in
1.27 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.28 - * this exception to all derivative works. AlliedModders LLC defines further
1.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.30 - * or <http://www.sourcemod.net/license.php>.
1.31 - *
1.32 - * Version: $Id$
1.33 - */
1.34 -
1.35 -#ifndef _INCLUDE_MENUSTYLE_RADIO_H
1.36 -#define _INCLUDE_MENUSTYLE_RADIO_H
1.37 -
1.38 -#include "sm_globals.h"
1.39 -#include "MenuManager.h"
1.40 -#include "MenuStyle_Base.h"
1.41 -#include "sourcemm_api.h"
1.42 -#include <IPlayerHelpers.h>
1.43 -#include <IUserMessages.h>
1.44 -#include "sm_fastlink.h"
1.45 -#include <sh_stack.h>
1.46 -#include <compat_wrappers.h>
1.47 -
1.48 -using namespace SourceMod;
1.49 -
1.50 -class CRadioDisplay;
1.51 -class CRadioMenu;
1.52 -
1.53 -class CRadioMenuPlayer : public CBaseMenuPlayer
1.54 -{
1.55 -public:
1.56 - void Radio_Init(int keys, const char *title, const char *buffer);
1.57 - bool Radio_NeedsRefresh();
1.58 - void Radio_Refresh();
1.59 - void Radio_SetIndex(unsigned int index);
1.60 -private:
1.61 - unsigned int m_index;
1.62 - size_t display_len;
1.63 - char display_pkt[512];
1.64 - int display_keys;
1.65 - float display_last_refresh;
1.66 -};
1.67 -
1.68 -class CRadioStyle :
1.69 - public BaseMenuStyle,
1.70 - public SMGlobalClass,
1.71 - public IUserMessageListener
1.72 -{
1.73 -public:
1.74 - CRadioStyle();
1.75 -public: //SMGlobalClass
1.76 - void OnSourceModAllInitialized();
1.77 - void OnSourceModLevelChange(const char *mapName);
1.78 - void OnSourceModShutdown();
1.79 -public: //BaseMenuStyle
1.80 - CBaseMenuPlayer *GetMenuPlayer(int client);
1.81 - void SendDisplay(int client, IMenuPanel *display);
1.82 - void ProcessWatchList();
1.83 -public: //IMenuStyle
1.84 - const char *GetStyleName();
1.85 - IMenuPanel *CreatePanel();
1.86 - IBaseMenu *CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
1.87 - unsigned int GetMaxPageItems();
1.88 -public: //IUserMessageListener
1.89 - void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
1.90 - void OnUserMessageSent(int msg_id);
1.91 -public:
1.92 - bool IsSupported();
1.93 - bool OnClientCommand(int client, const char *cmdname, const CCommand &cmd);
1.94 -public:
1.95 - CRadioDisplay *MakeRadioDisplay(CRadioMenu *menu=NULL);
1.96 - void FreeRadioDisplay(CRadioDisplay *display);
1.97 - CRadioMenuPlayer *GetRadioMenuPlayer(int client);
1.98 - IMenuPanel *MakeRadioDisplay(const char *str, int keys);
1.99 -private:
1.100 - CRadioMenuPlayer *m_players;
1.101 - CStack<CRadioDisplay *> m_FreeDisplays;
1.102 -};
1.103 -
1.104 -class CRadioDisplay : public IMenuPanel
1.105 -{
1.106 - friend class CRadioStyle;
1.107 -public:
1.108 - CRadioDisplay();
1.109 - CRadioDisplay(CRadioMenu *menu);
1.110 -public: //IMenuPanel
1.111 - IMenuStyle *GetParentStyle();
1.112 - void Reset();
1.113 - void DrawTitle(const char *text, bool onlyIfEmpty=false);
1.114 - unsigned int DrawItem(const ItemDrawInfo &item);
1.115 - bool DrawRawLine(const char *rawline);
1.116 - bool SetExtOption(MenuOption option, const void *valuePtr);
1.117 - bool CanDrawItem(unsigned int drawFlags);
1.118 - bool SendDisplay(int client, IMenuHandler *handler, unsigned int time);
1.119 - void DeleteThis();
1.120 - void SendRawDisplay(int client, unsigned int time);
1.121 - bool SetSelectableKeys(unsigned int keymap);
1.122 - unsigned int GetCurrentKey();
1.123 - bool SetCurrentKey(unsigned int key);
1.124 - int GetAmountRemaining();
1.125 -public:
1.126 - void DirectSet(const char *str, int keymap);
1.127 -private:
1.128 - String m_BufferText;
1.129 - String m_Title;
1.130 - unsigned int m_NextPos;
1.131 - int keys;
1.132 -};
1.133 -
1.134 -class CRadioMenu : public CBaseMenu
1.135 -{
1.136 -public:
1.137 - CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
1.138 -public:
1.139 - bool SetExtOption(MenuOption option, const void *valuePtr);
1.140 - IMenuPanel *CreatePanel();
1.141 - bool Display(int client, unsigned int time, IMenuHandler *alt_handler=NULL);
1.142 - bool DisplayAtItem(int client,
1.143 - unsigned int time,
1.144 - unsigned int start_item,
1.145 - IMenuHandler *alt_handler/* =NULL */);
1.146 - void Cancel_Finally();
1.147 -};
1.148 -
1.149 -extern CRadioStyle g_RadioMenuStyle;
1.150 -
1.151 -#endif //_INCLUDE_MENUSTYLE_RADIO_H