added key selection setting
fixed amb309 --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40825
This commit is contained in:
parent
98374f2ce6
commit
daceab19cd
@ -286,6 +286,8 @@ void CRadioDisplay::SendRawDisplay(int client, unsigned int time)
|
|||||||
|
|
||||||
cell_t players[1] = {client};
|
cell_t players[1] = {client};
|
||||||
|
|
||||||
|
int _sel_keys = (keys == 0) ? (1<<9) : keys;
|
||||||
|
|
||||||
char *ptr = buffer;
|
char *ptr = buffer;
|
||||||
char save = 0;
|
char save = 0;
|
||||||
while (true)
|
while (true)
|
||||||
@ -296,7 +298,7 @@ void CRadioDisplay::SendRawDisplay(int client, unsigned int time)
|
|||||||
ptr[240] = '\0';
|
ptr[240] = '\0';
|
||||||
}
|
}
|
||||||
bf_write *buffer = g_UserMsgs.StartMessage(g_ShowMenuId, players, 1, 0);
|
bf_write *buffer = g_UserMsgs.StartMessage(g_ShowMenuId, players, 1, 0);
|
||||||
buffer->WriteWord(keys);
|
buffer->WriteWord(_sel_keys);
|
||||||
buffer->WriteChar(time ? time : -1);
|
buffer->WriteChar(time ? time : -1);
|
||||||
buffer->WriteByte( (len > 240) ? 1 : 0 );
|
buffer->WriteByte( (len > 240) ? 1 : 0 );
|
||||||
buffer->WriteString(ptr);
|
buffer->WriteString(ptr);
|
||||||
@ -317,6 +319,11 @@ void CRadioDisplay::DeleteThis()
|
|||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRadioDisplay::SetSelectableKeys(unsigned int keymap)
|
||||||
|
{
|
||||||
|
keys = (signed)keymap;
|
||||||
|
}
|
||||||
|
|
||||||
CRadioMenu::CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner) :
|
CRadioMenu::CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner) :
|
||||||
CBaseMenu(pHandler, &g_RadioMenuStyle, pOwner)
|
CBaseMenu(pHandler, &g_RadioMenuStyle, pOwner)
|
||||||
{
|
{
|
||||||
|
@ -78,6 +78,7 @@ public: //IMenuPanel
|
|||||||
bool SendDisplay(int client, IMenuHandler *handler, unsigned int time);
|
bool SendDisplay(int client, IMenuHandler *handler, unsigned int time);
|
||||||
void DeleteThis();
|
void DeleteThis();
|
||||||
void SendRawDisplay(int client, unsigned int time);
|
void SendRawDisplay(int client, unsigned int time);
|
||||||
|
bool SetSelectableKeys(unsigned int keymap);
|
||||||
private:
|
private:
|
||||||
String m_BufferText;
|
String m_BufferText;
|
||||||
String m_Title;
|
String m_Title;
|
||||||
|
@ -305,6 +305,11 @@ bool CValveMenuDisplay::SendDisplay(int client, IMenuHandler *handler, unsigned
|
|||||||
return g_ValveMenuStyle.DoClientMenu(client, this, handler, time);
|
return g_ValveMenuStyle.DoClientMenu(client, this, handler, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CValveMenuDisplay::SetSelectableKeys(unsigned int keymap)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CValveMenu::CValveMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner) :
|
CValveMenu::CValveMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner) :
|
||||||
CBaseMenu(pHandler, &g_ValveMenuStyle, pOwner),
|
CBaseMenu(pHandler, &g_ValveMenuStyle, pOwner),
|
||||||
m_IntroColor(255, 0, 0, 255)
|
m_IntroColor(255, 0, 0, 255)
|
||||||
|
@ -82,6 +82,7 @@ public:
|
|||||||
bool CanDrawItem(unsigned int drawFlags);
|
bool CanDrawItem(unsigned int drawFlags);
|
||||||
void SendRawDisplay(int client, int priority, unsigned int time);
|
void SendRawDisplay(int client, int priority, unsigned int time);
|
||||||
void DeleteThis();
|
void DeleteThis();
|
||||||
|
bool SetSelectableKeys(unsigned int keymap);
|
||||||
private:
|
private:
|
||||||
KeyValues *m_pKv;
|
KeyValues *m_pKv;
|
||||||
unsigned int m_NextPos;
|
unsigned int m_NextPos;
|
||||||
|
@ -855,6 +855,20 @@ static cell_t SendPanelToClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t SetPanelKeys(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->SetSelectableKeys(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(menuNatives)
|
REGISTER_NATIVES(menuNatives)
|
||||||
{
|
{
|
||||||
{"AddMenuItem", AddMenuItem},
|
{"AddMenuItem", AddMenuItem},
|
||||||
@ -885,5 +899,6 @@ REGISTER_NATIVES(menuNatives)
|
|||||||
{"SetMenuPagination", SetMenuPagination},
|
{"SetMenuPagination", SetMenuPagination},
|
||||||
{"SetMenuTitle", SetMenuTitle},
|
{"SetMenuTitle", SetMenuTitle},
|
||||||
{"SetPanelTitle", SetPanelTitle},
|
{"SetPanelTitle", SetPanelTitle},
|
||||||
|
{"SetPanelKeys", SetPanelKeys},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -479,6 +479,17 @@ native DrawPanelText(Handle:panel, const String:text[]);
|
|||||||
*/
|
*/
|
||||||
native CanPanelDrawFlags(Handle:panel, style);
|
native CanPanelDrawFlags(Handle:panel, style);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the selectable key map of a panel. This is not supported by
|
||||||
|
* all styles (only by Radio, as of this writing).
|
||||||
|
*
|
||||||
|
* @param keys An integer where each bit N allows key
|
||||||
|
* N+1 to be selected. If no keys are selectable,
|
||||||
|
* then key 0 (bit 9) is automatically set.
|
||||||
|
* @return True if supported, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:SetPanelKeys(Handle:panel, keys);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a panel to a client. Unlike full menus, the handler
|
* Sends a panel to a client. Unlike full menus, the handler
|
||||||
* function will only receive the following actions, both of
|
* function will only receive the following actions, both of
|
||||||
|
@ -224,6 +224,18 @@ namespace SourceMod
|
|||||||
* @brief Destroys the display object.
|
* @brief Destroys the display object.
|
||||||
*/
|
*/
|
||||||
virtual void DeleteThis() =0;
|
virtual void DeleteThis() =0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the selectable key map. Returns false if the function
|
||||||
|
* is not supported.
|
||||||
|
*
|
||||||
|
* @param keys A bit string where each bit N-1 specifies
|
||||||
|
* that key N is selectable (key 0 is bit 9).
|
||||||
|
* If the selectable key map is 0, it will be
|
||||||
|
* automatically set to allow 0.
|
||||||
|
* @return True on success, false if not supported.
|
||||||
|
*/
|
||||||
|
virtual bool SetSelectableKeys(unsigned int keymap) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user