some minor fixups
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40782
This commit is contained in:
parent
5aabd81406
commit
d9b06e298c
@ -368,7 +368,7 @@ IMenuDisplay *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder o
|
||||
/* There were no items to draw! */
|
||||
if (!foundItems)
|
||||
{
|
||||
delete display;
|
||||
display->DeleteThis();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -520,9 +520,15 @@ skip_search:
|
||||
slots[position].type = ItemSel_None;
|
||||
}
|
||||
}
|
||||
ItemDrawInfo dr(text, 0);
|
||||
|
||||
/* Put a fake spacer before control stuff, if possible */
|
||||
{
|
||||
ItemDrawInfo draw("", ITEMDRAW_RAWLINE|ITEMDRAW_SPACER);
|
||||
display->DrawItem(draw);
|
||||
}
|
||||
|
||||
/* PREVIOUS */
|
||||
ItemDrawInfo dr(text, 0);
|
||||
if (displayPrev || canDrawDisabled)
|
||||
{
|
||||
CorePlayerTranslate(client, text, sizeof(text), "Back", NULL);
|
||||
|
@ -376,7 +376,7 @@ bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh,
|
||||
SendDisplay(client, display);
|
||||
|
||||
/* Free the display pointer */
|
||||
delete display;
|
||||
display->DeleteThis();
|
||||
|
||||
/* We can be interrupted again! */
|
||||
player->bAutoIgnore = false;
|
||||
@ -403,7 +403,7 @@ bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
|
||||
|
||||
SendDisplay(client, display);
|
||||
|
||||
delete display;
|
||||
display->DeleteThis();
|
||||
|
||||
player->bAutoIgnore = false;
|
||||
|
||||
|
@ -177,6 +177,11 @@ CValveMenuDisplay::CValveMenuDisplay(CValveMenu *pMenu)
|
||||
m_pKv->SetString("title", pMenu->m_IntroMsg);
|
||||
}
|
||||
|
||||
void CValveMenuDisplay::DeleteThis()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
CValveMenuDisplay::~CValveMenuDisplay()
|
||||
{
|
||||
m_pKv->deleteThis();
|
||||
|
@ -81,6 +81,7 @@ public:
|
||||
bool SetExtOption(MenuOption option, const void *valuePtr);
|
||||
bool CanDrawItem(unsigned int drawFlags);
|
||||
void SendRawDisplay(int client, int priority, unsigned int time);
|
||||
void DeleteThis();
|
||||
private:
|
||||
KeyValues *m_pKv;
|
||||
unsigned int m_NextPos;
|
||||
@ -92,13 +93,14 @@ class CValveMenu : public CBaseMenu
|
||||
friend class CValveMenuDisplay;
|
||||
public:
|
||||
CValveMenu();
|
||||
public:
|
||||
public: //IBaseMenu
|
||||
bool SetExtOption(MenuOption option, const void *valuePtr);
|
||||
IMenuDisplay *CreateDisplay();
|
||||
bool GetExitButton();
|
||||
bool SetExitButton(bool set);
|
||||
bool SetPagination(unsigned int itemsPerPage);
|
||||
bool Display(int client, IMenuHandler *handler, unsigned int time);
|
||||
public: //CBaseMenu
|
||||
void Cancel_Finally();
|
||||
private:
|
||||
Color m_IntroColor;
|
||||
|
@ -117,20 +117,18 @@ namespace SourceMod
|
||||
#define MENU_NO_PAGINATION -1 /**< Menu should not be paginated (10 items max) */
|
||||
#define MENU_TIME_FOREVER 0 /**< Menu should be displayed as long as possible */
|
||||
|
||||
#define MENU_DETAIL_NOITEMCOLORS (1<<0) /**< Disables extended colors; menus will be white only */
|
||||
|
||||
/**
|
||||
* @brief Extended menu options.
|
||||
*/
|
||||
enum MenuOption
|
||||
{
|
||||
MenuOption_DetailFlags, /**< INT *: A combination of MENU_DETAIL properties (default=0) */
|
||||
MenuOption_IntroMessage, /**< CONST CHAR *: Valve menus only; defaults to:
|
||||
"You have a menu, hit ESC"
|
||||
*/
|
||||
MenuOption_IntroColor, /**< INT[4]: Valve menus only; specifies the intro message colour
|
||||
using R,G,B,A (defaults to 255,0,0,255)
|
||||
*/
|
||||
MenuOption_Priority, /**< INT *: Valve menus only; priority (less is higher) */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -151,10 +149,6 @@ namespace SourceMod
|
||||
*/
|
||||
class IMenuDisplay
|
||||
{
|
||||
public:
|
||||
virtual ~IMenuDisplay()
|
||||
{
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief Returns the parent IMenuStyle pointer.
|
||||
@ -223,6 +217,11 @@ namespace SourceMod
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
virtual bool SendDisplay(int client, IMenuHandler *handler, unsigned int time) =0;
|
||||
|
||||
/**
|
||||
* @brief Destroys the display object.
|
||||
*/
|
||||
virtual void DeleteThis() =0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -252,7 +251,7 @@ namespace SourceMod
|
||||
/**
|
||||
* @brief Creates an IMenuDisplay object.
|
||||
*
|
||||
* Note: the object should be freed using delete.
|
||||
* Note: the object should be freed using ::DeleteThis.
|
||||
*
|
||||
* @return IMenuDisplay object.
|
||||
*/
|
||||
@ -400,7 +399,7 @@ namespace SourceMod
|
||||
* @brief Creates a new IMenuDisplay object using extended options specific
|
||||
* to the IMenuStyle parent. Titles, items, etc, are not copied.
|
||||
*
|
||||
* Note: The object should be freed with delete.
|
||||
* Note: The object should be freed with IMenuDisplay::DeleteThis.
|
||||
*
|
||||
* @return IMenuDisplay pointer.
|
||||
*/
|
||||
@ -638,7 +637,7 @@ namespace SourceMod
|
||||
* @return IDisplay pointer, or NULL if no items could be
|
||||
* found in the IBaseMenu pointer, or NULL if any
|
||||
* other error occurred. Any valid pointer must
|
||||
* be freed using delete.
|
||||
* be freed using IMenuDisplay::DeleteThis.
|
||||
*/
|
||||
virtual IMenuDisplay *RenderMenu(int client, menu_states_t &states, ItemOrder order) =0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user