- Implementation of 'hidden' menus

- addition of the new MenuItem property 'client' obsoletes
  'association' for this task, so it's only used for driver
  (look for menu_set_association() in menuscreens.c) (V.Boerchers)
This commit is contained in:
marschap
2005-05-20 09:44:12 +00:00
parent 4e08a3d944
commit 84c810f0ec
2 changed files with 97 additions and 37 deletions
+26 -23
View File
@@ -30,56 +30,56 @@
#include "shared/LL.h"
typedef MenuItem Menu;
/* A Menu is a MenuItem too.
/** A Menu is a MenuItem too.
* This definition is only for better understanding of this code.
*/
typedef MenuItem Menu;
#include "screen.h"
/** Creates a new menu. */
Menu *menu_create (char *id, MenuEventFunc(*event_func),
char *text, void *association);
/* Creates a new menu. */
char *text, Client *client);
void menu_destroy (Menu *menu);
/* Deletes menu from memory.
/** Deletes menu from memory.
* Destructors will be called for all subitems.
* DO NOT CALL THIS FUNCTION, CALL menuitem_destroy INSTEAD !
*/
void menu_destroy (Menu *menu);
void menu_add_item (Menu *menu, MenuItem *item);
/* Adds an item to the menu */
/** Adds an item to the menu */
/** Removes an item from the menu (does not destroy it) */
void menu_remove_item (Menu *menu, MenuItem *item);
/* Removes an item from the menu (does not destroy it) */
/** Destroys and removes all items from the menu */
void menu_destroy_all_items (Menu *menu);
/* Destroys and removes all items from the menu */
static inline MenuItem *menu_getfirst_item (Menu *menu)
/* Enumeration function.
/** Enumeration function.
* Retrieves the first item from the list of items in the menu.
*/
static inline MenuItem *menu_getfirst_item (Menu *menu)
{
return (MenuItem*) ((menu != NULL)
? LL_GetFirst(menu->data.menu.contents)
: NULL);
}
static inline MenuItem *menu_getnext_item (Menu *menu)
/* Enumeration function.
/** Enumeration function.
* Retrieves the next item from the list of items in the menu.
* No other menu calls should be made between menu_first_item() and
* this function, to keep the list-cursor where it is.
*/
static inline MenuItem *menu_getnext_item (Menu *menu)
{
return (MenuItem*) ((menu != NULL)
? LL_GetNext(menu->data.menu.contents)
: NULL);
}
/** Retrieves the current item from the list of items in the menu. */
static inline MenuItem *menu_get_current_item (Menu *menu)
/* Retrieves the current item from the list of items in the menu. */
{
return (MenuItem*) ((menu != NULL)
? LL_GetByIndex(menu->data.menu.contents,
@@ -87,28 +87,31 @@ static inline MenuItem *menu_get_current_item (Menu *menu)
: NULL);
}
/** Finds an item in the menu by the given id. */
MenuItem *menu_find_item (Menu *menu, char *id, bool recursive);
/* Finds an item in the menu by the given id. */
void menu_reset (Menu *menu);
/* Resets it to initial state.
/** sets the association member of a Menu. */
void menu_set_association(Menu *menu, void *assoc);
/** Resets it to initial state.
* DO NOT CALL THIS FUNCTION, CALL menuitem_reset_screen INSTEAD !
*/
void menu_reset (Menu *menu);
void menu_build_screen (Menu *menu, Screen *s);
/* Builds the selected menuitem on screen using widgets.
/** Builds the selected menuitem on screen using widgets.
* DO NOT CALL THIS FUNCTION, CALL menuitem_rebuild_screen INSTEAD !
*/
void menu_build_screen (Menu *menu, Screen *s);
void menu_update_screen (Menu *menu, Screen *s);
/* Updates the widgets of the selected menuitem
/** Updates the widgets of the selected menuitem
* DO NOT CALL THIS FUNCTION, CALL menuitem_update_screen INSTEAD !
*/
void menu_update_screen (Menu *menu, Screen *s);
MenuResult menu_process_input (Menu *menu, MenuToken token, char * key, bool extended);
/* Does something with the given input.
/** Does something with the given input.
* key is only used if token is MENUTOKEN_OTHER.
* DO NOT CALL THIS FUNCTION, CALL menuitem_process_input INSTEAD !
*/
MenuResult menu_process_input (Menu *menu, MenuToken token, char * key, bool extended);
#endif