Merge pull request #21 from Nextra/newmenus

Newmenus: Add menu timeouts (+ extra bugfix)
This commit is contained in:
Vincent Herbet
2014-05-27 12:31:30 +02:00
7 changed files with 99 additions and 66 deletions

View File

@ -269,9 +269,10 @@ enum {
#define INVALID_PLUGIN_ID -1
#define MENU_EXIT -3
#define MENU_BACK -2
#define MENU_MORE -1
#define MENU_TIMEOUT -4
#define MENU_EXIT -3
#define MENU_BACK -2
#define MENU_MORE -1
#define ITEM_IGNORE 0
#define ITEM_ENABLED 1
#define ITEM_DISABLED 2

View File

@ -115,13 +115,21 @@ native menu_items(menu);
* when the item is less than 0 (i.e. calling this from a cancelled menu will
* result in an error).
*
* Starting with 1.8.3 this allows to specify a menu timeout similar to the
* show_menu native. If the menu exists on the client past the timeout *any*
* further action will send the MENU_TIMEOUT status code to the menu handler.
* That includes actions which would otherwise send MENU_EXIT, such as the
* client selecting an item or disconnecting and calling menu_cancel or
* menu_destroy on a live menu.
*
* @param id Client index.
* @param menu Menu resource identifier.
* @param page Page to start from (starting from 0).
* @param time If >=0 menu will timeout after this many seconds
* @noreturn
* @error Invalid menu resource or client index.
*/
native menu_display(id, menu, page=0);
native menu_display(id, menu, page=0, time=-1);
/**
* Given a page on a menu and a keypress on that page, returns the item id selected.