1.1 --- a/core/MenuStyle_Radio.h Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,151 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod
1.8 - * Copyright (C) 2004-2008 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 - unsigned int GetApproxMemUsage();
1.89 -public: //IUserMessageListener
1.90 - void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
1.91 - void OnUserMessageSent(int msg_id);
1.92 -public:
1.93 - bool IsSupported();
1.94 - bool OnClientCommand(int client, const char *cmdname, const CCommand &cmd);
1.95 -public:
1.96 - CRadioDisplay *MakeRadioDisplay(CRadioMenu *menu=NULL);
1.97 - void FreeRadioDisplay(CRadioDisplay *display);
1.98 - CRadioMenuPlayer *GetRadioMenuPlayer(int client);
1.99 - IMenuPanel *MakeRadioDisplay(const char *str, int keys);
1.100 -private:
1.101 - CRadioMenuPlayer *m_players;
1.102 - CStack<CRadioDisplay *> m_FreeDisplays;
1.103 -};
1.104 -
1.105 -class CRadioDisplay : public IMenuPanel
1.106 -{
1.107 - friend class CRadioStyle;
1.108 -public:
1.109 - CRadioDisplay();
1.110 - CRadioDisplay(CRadioMenu *menu);
1.111 -public: //IMenuPanel
1.112 - IMenuStyle *GetParentStyle();
1.113 - void Reset();
1.114 - void DrawTitle(const char *text, bool onlyIfEmpty=false);
1.115 - unsigned int DrawItem(const ItemDrawInfo &item);
1.116 - bool DrawRawLine(const char *rawline);
1.117 - bool SetExtOption(MenuOption option, const void *valuePtr);
1.118 - bool CanDrawItem(unsigned int drawFlags);
1.119 - bool SendDisplay(int client, IMenuHandler *handler, unsigned int time);
1.120 - void DeleteThis();
1.121 - void SendRawDisplay(int client, unsigned int time);
1.122 - bool SetSelectableKeys(unsigned int keymap);
1.123 - unsigned int GetCurrentKey();
1.124 - bool SetCurrentKey(unsigned int key);
1.125 - int GetAmountRemaining();
1.126 - unsigned int GetApproxMemUsage();
1.127 -public:
1.128 - void DirectSet(const char *str, int keymap);
1.129 -private:
1.130 - String m_BufferText;
1.131 - String m_Title;
1.132 - unsigned int m_NextPos;
1.133 - int keys;
1.134 -};
1.135 -
1.136 -class CRadioMenu : public CBaseMenu
1.137 -{
1.138 -public:
1.139 - CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
1.140 -public:
1.141 - bool SetExtOption(MenuOption option, const void *valuePtr);
1.142 - IMenuPanel *CreatePanel();
1.143 - bool Display(int client, unsigned int time, IMenuHandler *alt_handler=NULL);
1.144 - bool DisplayAtItem(int client,
1.145 - unsigned int time,
1.146 - unsigned int start_item,
1.147 - IMenuHandler *alt_handler/* =NULL */);
1.148 - void Cancel_Finally();
1.149 - unsigned int GetApproxMemUsage();
1.150 -};
1.151 -
1.152 -extern CRadioStyle g_RadioMenuStyle;
1.153 -
1.154 -#endif //_INCLUDE_MENUSTYLE_RADIO_H