root/core/gui_menu.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef GUI_MENU_H
   2 #define GUI_MENU_H
   3 
   4 //-------------------------------------------------------------------
   5 #define MENUITEM_MASK           0x000f
   6 #define MENUITEM_BOOL           1
   7 #define MENUITEM_INT            2
   8 #define MENUITEM_SUBMENU        3
   9 #define MENUITEM_PROC           4
  10 #define MENUITEM_UP             5
  11 #define MENUITEM_TEXT           6
  12 #define MENUITEM_SEPARATOR      7
  13 #define MENUITEM_ENUM           8
  14 #define MENUITEM_COLOR_BG       9
  15 #define MENUITEM_COLOR_FG       10
  16 #define MENUITEM_ENUM2          11
  17 #define MENUITEM_SUBMENU_PROC   12
  18 #define MENUITEM_STATE_VAL_PAIR 13  // value is a pointer to a 2 element CMenuItem array
  19                                     // used for config values that have an on/off state as well as an adjustable value (e.g. ISO override, etc)
  20                                     // the first element is the value control, the second is the on/off state control
  21 #define MENUITEM_ERROR          14  // Same as MENUITEM_TEXT but text in Red
  22 #define MENUITEM_WARNING        15  // Same as MENUITEM_TEXT but text in Yellow
  23 
  24 // Flags, which describe limits of F_INT value
  25 #define MENUITEM_F_MASK         0x00f0
  26 #define MENUITEM_F_UNSIGNED     0x0010
  27 #define MENUITEM_F_MIN          0x0020
  28 #define MENUITEM_F_MAX          0x0040
  29 #define MENUITEM_F_MINMAX       0x0060
  30 
  31 // Value, which specify specific kind of argument
  32 #define MENUITEM_ARG_MASK       0x0300
  33 // menuitem.arg contain ptr to callback function
  34 #define MENUITEM_ARG_CALLBACK   0x0100
  35 
  36 // Module added to User Menu
  37 #define MENUITEM_USER_MODULE    0x0400
  38 
  39 #define MENUITEM_HHMMSS         0x1000  // Display / edit value as H:MM:SS
  40 #define MENUITEM_DECIMAL        0x2000  // Display / edit value as 0.xxxxx
  41 #define MENUITEM_SD_INT         0x4000  // Subject Distance Value is potentially a 7 digit int (0-9999999) instead of a 5 digit int (0-99999)
  42 #define MENUITEM_SCRIPT_PARAM   0x8000  // Script Parameter Menu Item
  43 
  44 #define MENU_MINMAX(min, max)   (((max)<<16)|(min&0xFFFF))
  45 #define MENU_MIN_UNSIGNED(arg)  ((unsigned short)(arg & 0xFFFF))
  46 #define MENU_MAX_UNSIGNED(arg)  ((unsigned short)((arg>>16) & 0xFFFF))
  47 #define MENU_MIN_SIGNED(arg)    ((short)(arg & 0xFFFF))
  48 #define MENU_MAX_SIGNED(arg)    ((short)((arg>>16) & 0xFFFF))
  49 
  50 //-------------------------------------------------------------------
  51 typedef struct {
  52     char                symbol;     // menuitem icon symbol
  53     char                opt_len;    // ENUM2 num of elements 
  54     short               type;       // MENUITEM_MASKS
  55     int                 text;       // Text
  56     int                 *value;     // pointer to binded variable
  57                                     //   exceptions: _PROC = pointer to processing func
  58                                     //               _ENUM = pointer to processing func
  59     int                 arg;        // additional argument
  60                                     //     by default type is controled by _ARG_MASK and by _F_MINMAX
  61                                     //     for ENUM2 - pointer to string list
  62 } CMenuItem;
  63 
  64 typedef struct {
  65     char                symbol;
  66     int                 title;
  67     const CMenuItem     *menu;
  68 } CMenu;
  69 
  70 // Menu item constructor macros
  71 #define MENU_ITEM(sym, txt, typ, val, arg)  { (char)sym, 0, (short)typ, (int)txt, (int*)val, (int)arg }
  72 #define MENU_ENUM2(sym, txt, val, arg)      { (char)sym, sizeof(arg)/sizeof(arg[0]), MENUITEM_ENUM2, (int)txt, (int*)val, (int)arg }
  73 #define MENU_ENUM2a(sym, txt, val, arg, num){ (char)sym, (char)num, MENUITEM_ENUM2, (int)txt, (int*)val, (int)arg }
  74 
  75 //-------------------------------------------------------------------
  76 extern void gui_menu_init(CMenu *menu_ptr);
  77 extern void gui_menu_erase_and_redraw();
  78 extern void gui_menu_cancel_redraw();
  79 extern int gui_menu_kbd_process();
  80 extern void gui_menu_draw(int enforce_redraw);
  81 extern void gui_menu_force_redraw();
  82 extern int menu_get_increment_factor();
  83 extern void menu_set_increment_factor(int n);
  84 extern char *menu_increment_factor_string();
  85 extern int menu_calc_max_increment_factor(int max_value);
  86 extern CMenu* get_curr_menu();
  87 
  88 extern void gui_menu_back();
  89 extern void gui_activate_sub_menu(CMenu *sub_menu);
  90 //-------------------------------------------------------------------
  91 
  92 extern gui_handler menuGuiHandler;
  93 
  94 //-------------------------------------------------------------------
  95 extern  CMenu   root_menu;                                                                      // defined in gui.c
  96 
  97 extern CMenuItem* find_menu_item(CMenu *curr_menu, int itemid );
  98 
  99 //-------------------------------------------------------------------
 100 #endif

/* [<][>][^][v][top][bottom][index][help] */