changed IMenuDisplay/CreateDisplay to IMenuPanel/CreatePanel

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40793
This commit is contained in:
David Anderson 2007-05-13 18:55:59 +00:00
parent ae8b06194f
commit 0b45984017
9 changed files with 46 additions and 46 deletions

View File

@ -44,7 +44,7 @@ void BroadcastHandler::OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReaso
m_pHandler->OnMenuCancel(menu, client, reason); m_pHandler->OnMenuCancel(menu, client, reason);
} }
void BroadcastHandler::OnMenuDisplay(IBaseMenu *menu, int client, IMenuDisplay *display) void BroadcastHandler::OnMenuDisplay(IBaseMenu *menu, int client, IMenuPanel *display)
{ {
numClients++; numClients++;
m_pHandler->OnMenuDisplay(menu, client, display); m_pHandler->OnMenuDisplay(menu, client, display);
@ -214,7 +214,7 @@ IMenuStyle *MenuManager::FindStyleByName(const char *name)
return NULL; return NULL;
} }
inline bool IsSlotItem(IMenuDisplay *display, inline bool IsSlotItem(IMenuPanel *display,
unsigned int style) unsigned int style)
{ {
if (!display->CanDrawItem(style)) if (!display->CanDrawItem(style))
@ -233,7 +233,7 @@ inline bool IsSlotItem(IMenuDisplay *display,
return true; return true;
} }
IMenuDisplay *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder order) IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder order)
{ {
IBaseMenu *menu = md.menu; IBaseMenu *menu = md.menu;
@ -290,7 +290,7 @@ IMenuDisplay *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder o
} }
/* Get our Display pointer and initialize some crap */ /* Get our Display pointer and initialize some crap */
IMenuDisplay *display = menu->CreateDisplay(); IMenuPanel *display = menu->CreatePanel();
IMenuHandler *mh = md.mh; IMenuHandler *mh = md.mh;
bool foundExtra = false; bool foundExtra = false;
unsigned int extraItem = 0; unsigned int extraItem = 0;

View File

@ -30,7 +30,7 @@ class BroadcastHandler : public IMenuHandler
public: public:
BroadcastHandler(IMenuHandler *handler); BroadcastHandler(IMenuHandler *handler);
public: //IMenuHandler public: //IMenuHandler
void OnMenuDisplay(IBaseMenu *menu, int client, IMenuDisplay *display); void OnMenuDisplay(IBaseMenu *menu, int client, IMenuPanel *display);
void OnMenuSelect(IBaseMenu *menu, int client, unsigned int item); void OnMenuSelect(IBaseMenu *menu, int client, unsigned int item);
void OnMenuEnd(IBaseMenu *menu); void OnMenuEnd(IBaseMenu *menu);
void OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason reason); void OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason reason);
@ -94,7 +94,7 @@ public:
IMenuStyle *GetDefaultStyle(); IMenuStyle *GetDefaultStyle();
void AddStyle(IMenuStyle *style); void AddStyle(IMenuStyle *style);
bool SetDefaultStyle(IMenuStyle *style); bool SetDefaultStyle(IMenuStyle *style);
IMenuDisplay *RenderMenu(int client, menu_states_t &states, ItemOrder order); IMenuPanel *RenderMenu(int client, menu_states_t &states, ItemOrder order);
protected: protected:
void FreeBroadcastHandler(BroadcastHandler *bh); void FreeBroadcastHandler(BroadcastHandler *bh);
void FreeVoteHandler(VoteHandler *vh); void FreeVoteHandler(VoteHandler *vh);

View File

@ -251,7 +251,7 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
mh->OnMenuEnd(menu); mh->OnMenuEnd(menu);
} }
bool BaseMenuStyle::DoClientMenu(int client, IMenuDisplay *menu, IMenuHandler *mh, unsigned int time) bool BaseMenuStyle::DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time)
{ {
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client); CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer || pPlayer->IsFakeClient() || !pPlayer->IsInGame()) if (!pPlayer || pPlayer->IsFakeClient() || !pPlayer->IsInGame())
@ -355,7 +355,7 @@ bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh,
states.mh = mh; states.mh = mh;
states.apiVers = SMINTERFACE_MENUMANAGER_VERSION; states.apiVers = SMINTERFACE_MENUMANAGER_VERSION;
IMenuDisplay *display = g_Menus.RenderMenu(client, states, ItemOrder_Ascending); IMenuPanel *display = g_Menus.RenderMenu(client, states, ItemOrder_Ascending);
if (!display) if (!display)
{ {
player->bAutoIgnore = false; player->bAutoIgnore = false;
@ -393,7 +393,7 @@ bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
menu_states_t &states = player->states; menu_states_t &states = player->states;
player->bAutoIgnore = true; player->bAutoIgnore = true;
IMenuDisplay *display = g_Menus.RenderMenu(client, states, order); IMenuPanel *display = g_Menus.RenderMenu(client, states, order);
if (!display) if (!display)
{ {
if (player->menuHoldTime) if (player->menuHoldTime)

View File

@ -69,10 +69,10 @@ public: //IClientListener
void OnClientDisconnected(int client); void OnClientDisconnected(int client);
public: //what derived must implement public: //what derived must implement
virtual CBaseMenuPlayer *GetMenuPlayer(int client) =0; virtual CBaseMenuPlayer *GetMenuPlayer(int client) =0;
virtual void SendDisplay(int client, IMenuDisplay *display) =0; virtual void SendDisplay(int client, IMenuPanel *display) =0;
public: //what derived may implement public: //what derived may implement
virtual bool DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh, unsigned int time); virtual bool DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh, unsigned int time);
virtual bool DoClientMenu(int client, IMenuDisplay *menu, IMenuHandler *mh, unsigned int time); virtual bool DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time);
virtual void AddClientToWatch(int client); virtual void AddClientToWatch(int client);
virtual void RemoveClientFromWatch(int client); virtual void RemoveClientFromWatch(int client);
virtual void ProcessWatchList(); virtual void ProcessWatchList();

View File

@ -117,13 +117,13 @@ void CRadioStyle::OnUserMessageSent(int msg_id)
g_last_client_count = 0; g_last_client_count = 0;
} }
void CRadioStyle::SendDisplay(int client, IMenuDisplay *display) void CRadioStyle::SendDisplay(int client, IMenuPanel *display)
{ {
CRadioDisplay *rDisplay = (CRadioDisplay *)display; CRadioDisplay *rDisplay = (CRadioDisplay *)display;
rDisplay->SendRawDisplay(client, m_players[client].menuHoldTime); rDisplay->SendRawDisplay(client, m_players[client].menuHoldTime);
} }
IMenuDisplay *CRadioStyle::CreateDisplay() IMenuPanel *CRadioStyle::CreatePanel()
{ {
return new CRadioDisplay(); return new CRadioDisplay();
} }
@ -301,7 +301,7 @@ bool CRadioMenu::SetExtOption(MenuOption option, const void *valuePtr)
return false; return false;
} }
IMenuDisplay *CRadioMenu::CreateDisplay() IMenuPanel *CRadioMenu::CreatePanel()
{ {
return new CRadioDisplay(this); return new CRadioDisplay(this);
} }

View File

@ -37,10 +37,10 @@ public: //SMGlobalClass
void OnSourceModShutdown(); void OnSourceModShutdown();
public: //BaseMenuStyle public: //BaseMenuStyle
CBaseMenuPlayer *GetMenuPlayer(int client); CBaseMenuPlayer *GetMenuPlayer(int client);
void SendDisplay(int client, IMenuDisplay *display); void SendDisplay(int client, IMenuPanel *display);
public: //IMenuStyle public: //IMenuStyle
const char *GetStyleName(); const char *GetStyleName();
IMenuDisplay *CreateDisplay(); IMenuPanel *CreatePanel();
IBaseMenu *CreateMenu(); IBaseMenu *CreateMenu();
unsigned int GetMaxPageItems(); unsigned int GetMaxPageItems();
public: //IUserMessageListener public: //IUserMessageListener
@ -55,12 +55,12 @@ private:
class CRadioMenu; class CRadioMenu;
class CRadioDisplay : public IMenuDisplay class CRadioDisplay : public IMenuPanel
{ {
public: public:
CRadioDisplay(); CRadioDisplay();
CRadioDisplay(CRadioMenu *menu); CRadioDisplay(CRadioMenu *menu);
public: //IMenuDisplay public: //IMenuPanel
IMenuStyle *GetParentStyle(); IMenuStyle *GetParentStyle();
void Reset(); void Reset();
void DrawTitle(const char *text, bool onlyIfEmpty=false); void DrawTitle(const char *text, bool onlyIfEmpty=false);
@ -84,7 +84,7 @@ public:
CRadioMenu(); CRadioMenu();
public: public:
bool SetExtOption(MenuOption option, const void *valuePtr); bool SetExtOption(MenuOption option, const void *valuePtr);
IMenuDisplay *CreateDisplay(); IMenuPanel *CreatePanel();
bool Display(int client, IMenuHandler *handler, unsigned int time); bool Display(int client, IMenuHandler *handler, unsigned int time);
void Cancel_Finally(); void Cancel_Finally();
}; };

View File

@ -104,7 +104,7 @@ void ValveMenuStyle::OnSourceModVSPReceived(IServerPluginCallbacks *iface)
g_pVSPHandle = iface; g_pVSPHandle = iface;
} }
IMenuDisplay *ValveMenuStyle::CreateDisplay() IMenuPanel *ValveMenuStyle::CreatePanel()
{ {
return new CValveMenuDisplay(); return new CValveMenuDisplay();
} }
@ -124,14 +124,14 @@ unsigned int ValveMenuStyle::GetMaxPageItems()
return 8; return 8;
} }
void ValveMenuStyle::SendDisplay(int client, IMenuDisplay *display) void ValveMenuStyle::SendDisplay(int client, IMenuPanel *display)
{ {
m_players[client].curPrioLevel--; m_players[client].curPrioLevel--;
CValveMenuDisplay *vDisplay = (CValveMenuDisplay *)display; CValveMenuDisplay *vDisplay = (CValveMenuDisplay *)display;
vDisplay->SendRawDisplay(client, m_players[client].curPrioLevel, m_players[client].menuHoldTime); vDisplay->SendRawDisplay(client, m_players[client].curPrioLevel, m_players[client].menuHoldTime);
} }
bool ValveMenuStyle::DoClientMenu(int client, IMenuDisplay *menu, IMenuHandler *mh, unsigned int time) bool ValveMenuStyle::DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time)
{ {
if (!g_pVSPHandle) if (!g_pVSPHandle)
{ {
@ -354,7 +354,7 @@ bool CValveMenu::Display(int client, IMenuHandler *handler, unsigned int time)
return g_ValveMenuStyle.DoClientMenu(client, this, handler, time); return g_ValveMenuStyle.DoClientMenu(client, this, handler, time);
} }
IMenuDisplay *CValveMenu::CreateDisplay() IMenuPanel *CValveMenu::CreatePanel()
{ {
return new CValveMenuDisplay(this); return new CValveMenuDisplay(this);
} }

View File

@ -45,16 +45,16 @@ public:
bool OnClientCommand(int client); bool OnClientCommand(int client);
public: //BaseMenuStyle public: //BaseMenuStyle
CBaseMenuPlayer *GetMenuPlayer(int client); CBaseMenuPlayer *GetMenuPlayer(int client);
void SendDisplay(int client, IMenuDisplay *display); void SendDisplay(int client, IMenuPanel *display);
bool DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh, unsigned int time); bool DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh, unsigned int time);
bool DoClientMenu(int client, IMenuDisplay *menu, IMenuHandler *mh, unsigned int time); bool DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time);
public: //SMGlobalClass public: //SMGlobalClass
void OnSourceModAllInitialized(); void OnSourceModAllInitialized();
void OnSourceModShutdown(); void OnSourceModShutdown();
void OnSourceModVSPReceived(IServerPluginCallbacks *iface); void OnSourceModVSPReceived(IServerPluginCallbacks *iface);
public: //IMenuStyle public: //IMenuStyle
const char *GetStyleName(); const char *GetStyleName();
IMenuDisplay *CreateDisplay(); IMenuPanel *CreatePanel();
IBaseMenu *CreateMenu(); IBaseMenu *CreateMenu();
unsigned int GetMaxPageItems(); unsigned int GetMaxPageItems();
private: private:
@ -65,7 +65,7 @@ private:
class CValveMenu; class CValveMenu;
class CValveMenuDisplay : public IMenuDisplay class CValveMenuDisplay : public IMenuPanel
{ {
public: public:
CValveMenuDisplay(); CValveMenuDisplay();
@ -95,7 +95,7 @@ public:
CValveMenu(); CValveMenu();
public: //IBaseMenu public: //IBaseMenu
bool SetExtOption(MenuOption option, const void *valuePtr); bool SetExtOption(MenuOption option, const void *valuePtr);
IMenuDisplay *CreateDisplay(); IMenuPanel *CreatePanel();
bool GetExitButton(); bool GetExitButton();
bool SetExitButton(bool set); bool SetExitButton(bool set);
bool SetPagination(unsigned int itemsPerPage); bool SetPagination(unsigned int itemsPerPage);

View File

@ -62,7 +62,7 @@ namespace SourceMod
}; };
class IBaseMenu; class IBaseMenu;
class IMenuDisplay; class IMenuPanel;
class IMenuHandler; class IMenuHandler;
/** /**
@ -109,10 +109,10 @@ namespace SourceMod
*/ */
enum MenuCancelReason enum MenuCancelReason
{ {
MenuCancel_Disconnect = -1, /** Client dropped from the server */ MenuCancel_Disconnect = -1, /**< Client dropped from the server */
MenuCancel_Interrupt = -2, /** Client was interrupted with another menu */ MenuCancel_Interrupt = -2, /**< Client was interrupted with another menu */
MenuCancel_Exit = -3, /** Client selected "exit" on a paginated menu */ MenuCancel_Exit = -3, /**< Client selected "exit" on a paginated menu */
MenuCancel_NoDisplay = -4, /** Menu could not be displayed to the client */ MenuCancel_NoDisplay = -4, /**< Menu could not be displayed to the client */
}; };
#define MENU_NO_PAGINATION 0 /**< Menu should not be paginated (10 items max) */ #define MENU_NO_PAGINATION 0 /**< Menu should not be paginated (10 items max) */
@ -140,7 +140,7 @@ namespace SourceMod
MenuSource_None = 0, /**< No menu is being displayed */ MenuSource_None = 0, /**< No menu is being displayed */
MenuSource_External = 1, /**< External menu, no pointer */ MenuSource_External = 1, /**< External menu, no pointer */
MenuSource_BaseMenu = 2, /**< An IBaseMenu pointer. */ MenuSource_BaseMenu = 2, /**< An IBaseMenu pointer. */
MenuSource_Display = 3, /**< IMenuDisplay source, no pointer */ MenuSource_Display = 3, /**< IMenuPanel source, no pointer */
}; };
class IMenuStyle; class IMenuStyle;
@ -148,7 +148,7 @@ namespace SourceMod
/** /**
* @brief Sets how a raw menu should be drawn. * @brief Sets how a raw menu should be drawn.
*/ */
class IMenuDisplay class IMenuPanel
{ {
public: public:
/** /**
@ -250,13 +250,13 @@ namespace SourceMod
virtual const char *GetStyleName() =0; virtual const char *GetStyleName() =0;
/** /**
* @brief Creates an IMenuDisplay object. * @brief Creates an IMenuPanel object.
* *
* Note: the object should be freed using ::DeleteThis. * Note: the object should be freed using ::DeleteThis.
* *
* @return IMenuDisplay object. * @return IMenuPanel object.
*/ */
virtual IMenuDisplay *CreateDisplay() =0; virtual IMenuPanel *CreatePanel() =0;
/** /**
* @brief Creates an IBaseMenu object of this style. * @brief Creates an IBaseMenu object of this style.
@ -397,14 +397,14 @@ namespace SourceMod
virtual bool SetExtOption(MenuOption option, const void *valuePtr) =0; virtual bool SetExtOption(MenuOption option, const void *valuePtr) =0;
/** /**
* @brief Creates a new IMenuDisplay object using extended options specific * @brief Creates a new IMenuPanel object using extended options specific
* to the IMenuStyle parent. Titles, items, etc, are not copied. * to the IMenuStyle parent. Titles, items, etc, are not copied.
* *
* Note: The object should be freed with IMenuDisplay::DeleteThis. * Note: The object should be freed with IMenuPanel::DeleteThis.
* *
* @return IMenuDisplay pointer. * @return IMenuPanel pointer.
*/ */
virtual IMenuDisplay *CreateDisplay() =0; virtual IMenuPanel *CreatePanel() =0;
/** /**
* @brief Returns whether or not the menu should have an "Exit" button for * @brief Returns whether or not the menu should have an "Exit" button for
@ -479,9 +479,9 @@ namespace SourceMod
* *
* @param menu Menu pointer. * @param menu Menu pointer.
* @param client Client index. * @param client Client index.
* @param display IMenuDisplay pointer. * @param display IMenuPanel pointer.
*/ */
virtual void OnMenuDisplay(IBaseMenu *menu, int client, IMenuDisplay *display) virtual void OnMenuDisplay(IBaseMenu *menu, int client, IMenuPanel *display)
{ {
} }
@ -630,9 +630,9 @@ namespace SourceMod
* @return IDisplay pointer, or NULL if no items could be * @return IDisplay pointer, or NULL if no items could be
* found in the IBaseMenu pointer, or NULL if any * found in the IBaseMenu pointer, or NULL if any
* other error occurred. Any valid pointer must * other error occurred. Any valid pointer must
* be freed using IMenuDisplay::DeleteThis. * be freed using IMenuPanel::DeleteThis.
*/ */
virtual IMenuDisplay *RenderMenu(int client, menu_states_t &states, ItemOrder order) =0; virtual IMenuPanel *RenderMenu(int client, menu_states_t &states, ItemOrder order) =0;
}; };
} }