added request amb320
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40846
This commit is contained in:
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user