added request amb320
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40846
This commit is contained in:
parent
220aec7789
commit
82c578f32d
@ -198,6 +198,23 @@ void CRadioDisplay::Reset()
|
||||
keys = 0;
|
||||
}
|
||||
|
||||
unsigned int CRadioDisplay::GetCurrentKey()
|
||||
{
|
||||
return m_NextPos;
|
||||
}
|
||||
|
||||
bool CRadioDisplay::SetCurrentKey(unsigned int key)
|
||||
{
|
||||
if (key < m_NextPos || m_NextPos > 10)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_NextPos = key;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRadioDisplay::SendDisplay(int client, IMenuHandler *handler, unsigned int time)
|
||||
{
|
||||
return g_RadioMenuStyle.DoClientMenu(client, this, handler, time);
|
||||
|
@ -79,6 +79,8 @@ public: //IMenuPanel
|
||||
void DeleteThis();
|
||||
void SendRawDisplay(int client, unsigned int time);
|
||||
bool SetSelectableKeys(unsigned int keymap);
|
||||
unsigned int GetCurrentKey();
|
||||
bool SetCurrentKey(unsigned int key);
|
||||
private:
|
||||
String m_BufferText;
|
||||
String m_Title;
|
||||
|
@ -194,6 +194,23 @@ void CValveMenuDisplay::Reset()
|
||||
m_TitleDrawn = false;
|
||||
}
|
||||
|
||||
unsigned int CValveMenuDisplay::GetCurrentKey()
|
||||
{
|
||||
return m_NextPos;
|
||||
}
|
||||
|
||||
bool CValveMenuDisplay::SetCurrentKey(unsigned int key)
|
||||
{
|
||||
if (key < m_NextPos || key > 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_NextPos = key;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CValveMenuDisplay::SetExtOption(MenuOption option, const void *valuePtr)
|
||||
{
|
||||
if (option == MenuOption_IntroMessage)
|
||||
|
@ -83,6 +83,8 @@ public:
|
||||
void SendRawDisplay(int client, int priority, unsigned int time);
|
||||
void DeleteThis();
|
||||
bool SetSelectableKeys(unsigned int keymap);
|
||||
unsigned int GetCurrentKey();
|
||||
bool SetCurrentKey(unsigned int key);
|
||||
private:
|
||||
KeyValues *m_pKv;
|
||||
unsigned int m_NextPos;
|
||||
|
@ -869,6 +869,34 @@ static cell_t SetPanelKeys(IPluginContext *pContext, const cell_t *params)
|
||||
return panel->SetSelectableKeys(params[2]);
|
||||
}
|
||||
|
||||
static cell_t GetPanelCurrentKey(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
IMenuPanel *panel;
|
||||
|
||||
if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
return panel->GetCurrentKey();
|
||||
}
|
||||
|
||||
static cell_t SetPanelCurrentKey(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = (Handle_t)params[1];
|
||||
HandleError err;
|
||||
IMenuPanel *panel;
|
||||
|
||||
if ((err=ReadPanelHandle(hndl, &panel)) != HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
return panel->SetCurrentKey(params[2]) ? 1 : 0;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(menuNatives)
|
||||
{
|
||||
{"AddMenuItem", AddMenuItem},
|
||||
@ -890,6 +918,7 @@ REGISTER_NATIVES(menuNatives)
|
||||
{"GetMenuPagination", GetMenuPagination},
|
||||
{"GetMenuStyle", GetMenuStyle},
|
||||
{"GetMenuStyleHandle", GetMenuStyleHandle},
|
||||
{"GetPanelCurrentKey", GetPanelCurrentKey},
|
||||
{"GetPanelStyle", GetPanelStyle},
|
||||
{"InsertMenuItem", InsertMenuItem},
|
||||
{"RemoveAllMenuItems", RemoveAllMenuItems},
|
||||
@ -898,6 +927,7 @@ REGISTER_NATIVES(menuNatives)
|
||||
{"SetMenuExitButton", SetMenuExitButton},
|
||||
{"SetMenuPagination", SetMenuPagination},
|
||||
{"SetMenuTitle", SetMenuTitle},
|
||||
{"SetPanelCurrentKey", SetPanelCurrentKey},
|
||||
{"SetPanelTitle", SetPanelTitle},
|
||||
{"SetPanelKeys", SetPanelKeys},
|
||||
{NULL, NULL},
|
||||
|
@ -509,3 +509,24 @@ native bool:SetPanelKeys(Handle:panel, keys);
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native bool:SendPanelToClient(Handle:panel, client, MenuHandler:handler, time);
|
||||
|
||||
/**
|
||||
* @brief Returns the current key position.
|
||||
*
|
||||
* @param panel A MenuPanel Handle.
|
||||
* @return Current key position starting at 1.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native GetPanelCurrentKey(Handle:panel);
|
||||
|
||||
/**
|
||||
* @brief Sets the next key position. This cannot be used
|
||||
* to traverse backwards.
|
||||
*
|
||||
* @param panel A MenuPanel Handle.
|
||||
* @param key Key that is greater or equal to
|
||||
* GetPanelCurrentKey().
|
||||
* @return True on success, false otherwise.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native bool:SetPanelCurrentKey(Handle:panel, key);
|
||||
|
@ -236,6 +236,23 @@ namespace SourceMod
|
||||
* @return True on success, false if not supported.
|
||||
*/
|
||||
virtual bool SetSelectableKeys(unsigned int keymap) =0;
|
||||
|
||||
/**
|
||||
* @brief Returns the current key position.
|
||||
*
|
||||
* @return Current key position starting at 1.
|
||||
*/
|
||||
virtual unsigned int GetCurrentKey() =0;
|
||||
|
||||
/**
|
||||
* @brief Sets the next key position. This cannot be used
|
||||
* to traverse backwards.
|
||||
*
|
||||
* @param key Key that is greater or equal to
|
||||
* GetCurrentKey().
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
virtual bool SetCurrentKey(unsigned int key) =0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user