core/smn_menus.cpp
changeset 1290 1a3198e040fa
parent 1271 22f1534f2a61
child 1291 c6d26de53926
     1.1 --- a/core/smn_menus.cpp	Thu Aug 09 18:19:23 2007 +0000
     1.2 +++ b/core/smn_menus.cpp	Thu Aug 09 18:25:00 2007 +0000
     1.3 @@ -811,6 +811,25 @@
     1.4  	return 1;
     1.5  }
     1.6  
     1.7 +static cell_t GetMenuTitle(IPluginContext *pContext, const cell_t *params)
     1.8 +{
     1.9 +	Handle_t hndl = (Handle_t)params[1];
    1.10 +	HandleError err;
    1.11 +	IBaseMenu *menu;
    1.12 +
    1.13 +	if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
    1.14 +	{
    1.15 +		return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    1.16 +	}
    1.17 +
    1.18 +	size_t written;
    1.19 +	const char *title = menu->GetDefaultTitle();
    1.20 +	pContext->StringToLocalUTF8(params[2], params[3], title, &written);
    1.21 +
    1.22 +	return (cell_t)written;
    1.23 +}
    1.24 +
    1.25 +
    1.26  static cell_t CreatePanelFromMenu(IPluginContext *pContext, const cell_t *params)
    1.27  {
    1.28  	Handle_t hndl = (Handle_t)params[1];
    1.29 @@ -1329,6 +1348,7 @@
    1.30  	{"GetMenuPagination",		GetMenuPagination},
    1.31  	{"GetMenuStyle",			GetMenuStyle},
    1.32  	{"GetMenuStyleHandle",		GetMenuStyleHandle},
    1.33 +	{"GetMenuTitle",			GetMenuTitle},
    1.34  	{"GetPanelCurrentKey",		GetPanelCurrentKey},
    1.35  	{"GetPanelStyle",			GetPanelStyle},
    1.36  	{"InsertMenuItem",			InsertMenuItem},