Fix naming conventions.
[bertos.git] / mware / menu.h
index 86cca04044fedf3c68c1a3864b9ef0d94e7126f0..63aa0e8d8cf3ae9089d897fd61778a960459adf3 100755 (executable)
@@ -1,7 +1,7 @@
 /*!
  * \file
  * <!--
- * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
  * Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
  * All Rights Reserved.
  * -->
 
 /*#*
  *#* $Log$
+ *#* Revision 1.4  2006/04/11 00:07:32  bernie
+ *#* Implemenent MF_SAVESEL flag.
+ *#*
+ *#* Revision 1.3  2006/03/22 09:49:51  bernie
+ *#* Simplifications from project_grl.
+ *#*
+ *#* Revision 1.2  2006/03/20 17:48:35  bernie
+ *#* Implement support for ROM menus.
+ *#*
  *#* Revision 1.1  2006/02/10 12:29:36  bernie
  *#* Add menu system.
  *#*
 /* Fwd decl */
 struct Bitmap;
 
-/*! Menu callback function */
+/** Menu callback function */
 typedef void (*MenuHook)(iptr_t userdata);
 
-/*! Menu item description */
+/**
+ * Menu item description.
+ */
 typedef struct MenuItem
 {
        const_iptr_t label;    /*!< Item label (ID or ptr to string, 0 to disable) */
@@ -66,8 +77,13 @@ typedef struct MenuItem
        iptr_t       userdata; /*!< User data to be passed back to the hook */
 } MenuItem;
 
-/*! Flags for MenuItem.flags */
-#define MIF_EXCLUDE_MASK    0x00FF
+/**
+ * \name Flags for MenuItem.flags.
+ * \{
+ */
+#define MIF_EXCLUDE_MASK    0x00FF /**< Mask for mutual exclusion map (shared with priority). */
+#define MIF_PRI_MASK        0x00FF /**< Mask for priority value (shared with mutual exclusion). */
+#define MIF_PRI(x)          ((x) & MIF_PRI_MASK) /**< Set menu item priority. */
 #define MIF_EXCLUDE_0       BV(0)  /*!< Exclude item 0 when this item is checked */
 #define MIF_EXCLUDE_1       BV(1)  /*!< Exclude item 1 when this item is checked */
 #define MIF_EXCLUDE_2       BV(2)  /*!< Exclude item 2 when this item is checked */
@@ -82,22 +98,29 @@ typedef struct MenuItem
 #define MIF_HIDDEN          BV(11) /*!< This menu item is not visible */
 #define MIF_DISABLED        BV(12) /*!< This menu item is not visible */
 #define MIF_RAMLABEL        BV(13) /*!< Item label is stored in RAM, not in program memory */
+/* \} */
 
-
-/*! Menu description */
+/**
+ * Menu description.
+ */
 typedef struct Menu
 {
        MenuItem        *items;    /*!< Array of items (end with a NULL hook) */
        const_iptr_t     title;    /*!< Menu title (ID or ptr to string, 0 to disable) */
        int              flags;    /*!< See MF_#? definitions below */
        struct Bitmap   *bitmap;   /*!< Bitmap where the menu is rendered */
-       int              startrow; /*!< Display starting row */
+       int              selected; /*!< Initial selection (written to if #MF_SAVESEL is set). */
 } Menu;
 
-
-#define MF_STICKY    BV(0)  /*!< Stay in the menu when the items called return */
-#define MF_TOPLEVEL  BV(1)  /*!< Top-level menu (do not display "back" label) */
-
+/**
+ * \name Flags for Menu.flags.
+ * \{
+ */
+#define MF_STICKY   BV(0)  /**< Stay in the menu when the items called return */
+#define MF_TOPLEVEL BV(1)  /**< Top-level menu (do not display "back" label) */
+#define MF_ROMITEMS BV(2)  /**< Menu items are stored in ROM (default is RAM) */
+#define MF_SAVESEL  BV(3)  /**< Remember the selected item across invocations. */
+/* \} */
 
 /* Function prototypes */
 iptr_t menu_handle(const struct Menu *menu);