#include <aversive.h>
Go to the source code of this file.
Data Structures | |
struct | menu |
Defines | |
#define | MENU_TYPE_ROOT 0 |
#define | MENU_TYPE_MENU 1 |
#define | MENU_TYPE_FCT_HDR 2 |
#define | MENU_TYPE_FCT_PTR 3 |
#define | MENU_TYPE_FCT_DATA 4 |
#define | MENU_TYPE_END 5 |
#define | MENU_TYPE_UNKNOWN 255 |
#define | MENU_ROOT(text) { MENU_TYPE_ROOT, (void *)text } |
#define | MENU_START(text) { MENU_TYPE_MENU, (void *)text } |
#define | MENU_END() { MENU_TYPE_END, NULL } |
#define | MENU_FCT(text, f, data) |
Functions | |
struct menu * | menu_left (struct menu *m) |
struct menu * | menu_right (struct menu *m) |
struct menu * | menu_down (struct menu *m) |
struct menu * | menu_up (struct menu *m) |
struct menu * | menu_default_update (struct menu *m, char c) |
void | menu_default_display (struct menu *m) |
char * | menu_get_name (struct menu *m) |
uint8_t | menu_get_type (struct menu *m) |
uint8_t | menu_call_fct (struct menu *m) |
struct menu * | menu_get_previous (struct menu *m) |
struct menu * | menu_get_next (struct menu *m) |
struct menu * | menu_get_parent (struct menu *m) |
struct menu * | menu_get_first_son (struct menu *m) |
struct menu * | menu_get_sub (struct menu *m, uint8_t num) |
uint8_t | menu_get_sub_howmany (struct menu *m) |
#define MENU_FCT | ( | text, | |||
f, | |||||
data | ) |
Value:
{ MENU_TYPE_FCT_HDR, (void *)text }, \ { MENU_TYPE_FCT_PTR, (void *)f }, \ { MENU_TYPE_FCT_DATA, (void *)data }
#define MENU_TYPE_END 5 |
#define MENU_TYPE_FCT_DATA 4 |
#define MENU_TYPE_FCT_HDR 2 |
Definition at line 240 of file menu.h.
Referenced by menu_call_fct(), menu_get_name(), menu_get_next(), and menu_get_previous().
#define MENU_TYPE_FCT_PTR 3 |
#define MENU_TYPE_MENU 1 |
Definition at line 239 of file menu.h.
Referenced by menu_get_name(), menu_get_next(), and menu_get_previous().
#define MENU_TYPE_ROOT 0 |
Definition at line 238 of file menu.h.
Referenced by menu_default_update(), menu_get_name(), menu_get_next(), menu_get_parent(), and menu_get_previous().
#define MENU_TYPE_UNKNOWN 255 |
uint8_t menu_call_fct | ( | struct menu * | m | ) |
call the function described by the menu, and return 0 on success
call the function described by the menu, and return 0 on success
Definition at line 64 of file menu.c.
References parse_symbols::f, MENU_TYPE_FCT_DATA, MENU_TYPE_FCT_HDR, MENU_TYPE_FCT_PTR, and menu::type.
Referenced by menu_right().
void menu_default_display | ( | struct menu * | m | ) |
default function to display a menu, you can reimplement it
Definition at line 328 of file menu.c.
References i, menu_get_name(), menu_get_parent(), menu_get_sub(), and menu_get_sub_howmany().
move in the menu, depending on the action (the character c)
move in the menu, depending on the action
Definition at line 299 of file menu.c.
References menu_down(), menu_get_parent(), menu_get_sub(), menu_left(), menu_right(), MENU_TYPE_ROOT, menu_up(), and menu::type.
return the next menu on same level (if it is the last, go back to beginning, never return NULL except if param is null
return the next menu on same level (if it is the first, go back to the end
Definition at line 274 of file menu.c.
References menu_get_next(), and menu_get_previous().
Referenced by menu_default_update().
return first son or NULL if there is no son
Definition at line 178 of file menu.c.
Referenced by menu_get_sub(), menu_get_sub_howmany(), and menu_right().
char* menu_get_name | ( | struct menu * | m | ) |
return name of a menu, if the type is correct
Definition at line 34 of file menu.c.
References menu::data, MENU_TYPE_FCT_HDR, MENU_TYPE_MENU, MENU_TYPE_ROOT, and menu::type.
Referenced by menu_default_display().
get next menu on same level, return NULL if no one
Definition at line 120 of file menu.c.
References MENU_TYPE_END, MENU_TYPE_FCT_HDR, MENU_TYPE_MENU, MENU_TYPE_ROOT, and menu::type.
Referenced by menu_down(), menu_get_sub(), menu_get_sub_howmany(), and menu_up().
get the parent of the menu - return NULL if no parent
Definition at line 154 of file menu.c.
References menu_get_previous(), MENU_TYPE_ROOT, and menu::type.
Referenced by menu_default_display(), menu_default_update(), and menu_left().
get previous menu on same level, return NULL if no one
Definition at line 87 of file menu.c.
References MENU_TYPE_END, MENU_TYPE_FCT_HDR, MENU_TYPE_MENU, MENU_TYPE_ROOT, and menu::type.
Referenced by menu_down(), menu_get_parent(), and menu_up().
get the submenu 'num' -> can return NULL if does not exist
Definition at line 190 of file menu.c.
References menu_get_first_son(), and menu_get_next().
Referenced by menu_default_display(), and menu_default_update().
uint8_t menu_get_sub_howmany | ( | struct menu * | m | ) |
return number of submenus in a menu
Definition at line 203 of file menu.c.
References menu_get_first_son(), and menu_get_next().
Referenced by menu_default_display().
uint8_t menu_get_type | ( | struct menu * | m | ) |
return type of a menu
Definition at line 47 of file menu.c.
References MENU_TYPE_UNKNOWN, and menu::type.
get the parent of the menu - never return NULL except if param is null
get the parent of the menu - never return NULL except if m is null
Definition at line 219 of file menu.c.
References menu_get_parent().
Referenced by menu_default_update().
get the first son number self if it does not exist, try to call the fonction if it exists, never return NULL except if param is null
get the son number 'num' or self if it does not exist, try to call the function if it exists, does not return null except if m is null
Definition at line 235 of file menu.c.
References menu_call_fct(), and menu_get_first_son().
Referenced by menu_default_update().
return the next menu on same level (if it is the first, go back to the end, never return NULL except if param is null
return the next menu on same level (if it is the last, go back to beginning
Definition at line 250 of file menu.c.
References menu_get_next(), and menu_get_previous().
Referenced by menu_default_update().