]> code.delx.au - refind/blob - refind/menu.h
Fixed uninitialized-pointer bug that manifested as a crash with
[refind] / refind / menu.h
1 /*
2 * refind/menu.h
3 * menu functions header file
4 *
5 * Copyright (c) 2006-2009 Christoph Pfisterer
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
18 * distribution.
19 *
20 * * Neither the name of Christoph Pfisterer nor the names of the
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36 /*
37 * Modifications copyright (c) 2012 Roderick W. Smith
38 *
39 * Modifications distributed under the terms of the GNU General Public
40 * License (GPL) version 3 (GPLv3), a copy of which must be distributed
41 * with this source code or binaries made from it.
42 *
43 */
44
45 #ifndef __REFIND_MENU_H_
46 #define __REFIND_MENU_H_
47
48 #ifdef __MAKEWITH_GNUEFI
49 #include "efi.h"
50 #include "efilib.h"
51 #else
52 #include "../include/tiano_includes.h"
53 #endif
54 #include "global.h"
55
56 #ifndef _EFI_POINT_H
57 #include "../EfiLib/AbsolutePointer.h"
58 #endif
59
60 #include "libeg.h"
61
62 //
63 // menu module
64 //
65
66 #define MENU_EXIT_ENTER (1)
67 #define MENU_EXIT_ESCAPE (2)
68 #define MENU_EXIT_DETAILS (3)
69 #define MENU_EXIT_TIMEOUT (4)
70 #define MENU_EXIT_EJECT (5)
71
72 #define TAG_RETURN (99)
73
74 // scrolling definitions
75
76 typedef struct {
77 INTN CurrentSelection, PreviousSelection, MaxIndex;
78 INTN FirstVisible, LastVisible, MaxVisible;
79 INTN FinalRow0, InitialRow1;
80 INTN ScrollMode;
81 BOOLEAN PaintAll, PaintSelection;
82 } SCROLL_STATE;
83
84 #define SCROLL_LINE_UP (0)
85 #define SCROLL_LINE_DOWN (1)
86 #define SCROLL_PAGE_UP (2)
87 #define SCROLL_PAGE_DOWN (3)
88 #define SCROLL_FIRST (4)
89 #define SCROLL_LAST (5)
90 #define SCROLL_NONE (6)
91 #define SCROLL_LINE_RIGHT (7)
92 #define SCROLL_LINE_LEFT (8)
93
94 #define SCROLL_MODE_TEXT (0) /* Used in text mode & for GUI submenus */
95 #define SCROLL_MODE_ICONS (1) /* Used for main GUI menu */
96
97 #define TOUCH_NO_ITEM (-1)
98 #define TOUCH_LEFT_ARROW (-2)
99 #define TOUCH_RIGHT_ARROW (-3)
100
101 struct _refit_menu_screen;
102
103 VOID AddMenuInfoLine(IN REFIT_MENU_SCREEN *Screen, IN CHAR16 *InfoLine);
104 VOID AddMenuEntry(IN REFIT_MENU_SCREEN *Screen, IN REFIT_MENU_ENTRY *Entry);
105 UINTN ComputeRow0PosY(VOID);
106 VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINTN Function, IN CHAR16 *ParamText);
107 UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry);
108 UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16** DefaultSelection, OUT REFIT_MENU_ENTRY **ChosenEntry);
109 UINTN FindMainMenuItem(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT64 PosX, IN UINT64 PosY);
110
111 #endif
112
113 /* EOF */