2009-07-20 Joe Auricchio <jauricchio@gmail.com>
[grub2/phcoder.git] / include / grub / menu.h
blob3bd25e875dce30c28d7d7ac8574d68d58895db24
1 /* menu.h - Menu model function prototypes and data structures. */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2009 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef GRUB_MENU_HEADER
21 #define GRUB_MENU_HEADER 1
23 struct grub_menu_entry_class
25 char *name;
26 struct grub_menu_entry_class *next;
29 /* The menu entry. */
30 struct grub_menu_entry
32 /* The title name. */
33 const char *title;
35 /* The classes associated with the menu entry:
36 used to choose an icon or other style attributes.
37 This is a dummy head node for the linked list, so for an entry E,
38 E.classes->next is the first class if it is not NULL. */
39 struct grub_menu_entry_class *classes;
41 /* The sourcecode of the menu entry, used by the editor. */
42 const char *sourcecode;
44 /* The next element. */
45 struct grub_menu_entry *next;
47 typedef struct grub_menu_entry *grub_menu_entry_t;
49 /* The menu. */
50 struct grub_menu
52 /* The size of a menu. */
53 int size;
55 /* The list of menu entries. */
56 grub_menu_entry_t entry_list;
58 typedef struct grub_menu *grub_menu_t;
60 /* Callback structure menu viewers can use to provide user feedback when
61 default entries are executed, possibly including fallback entries. */
62 typedef struct grub_menu_execute_callback
64 /* Called immediately before ENTRY is booted. */
65 void (*notify_booting) (grub_menu_entry_t entry, void *userdata);
67 /* Called when executing one entry has failed, and another entry, ENTRY, will
68 be executed as a fallback. The implementation of this function should
69 delay for a period of at least 2 seconds before returning in order to
70 allow the user time to read the information before it can be lost by
71 executing ENTRY. */
72 void (*notify_fallback) (grub_menu_entry_t entry, void *userdata);
74 /* Called when an entry has failed to execute and there is no remaining
75 fallback entry to attempt. */
76 void (*notify_failure) (void *userdata);
78 *grub_menu_execute_callback_t;
81 grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
82 int grub_menu_get_timeout (void);
83 void grub_menu_set_timeout (int timeout);
84 void grub_menu_execute_entry (grub_menu_entry_t entry);
85 void grub_menu_execute_with_fallback (grub_menu_t menu,
86 grub_menu_entry_t entry,
87 grub_menu_execute_callback_t callback,
88 void *callback_data);
89 void grub_menu_entry_run (grub_menu_entry_t entry);
91 #endif /* GRUB_MENU_HEADER */