2 * COPYRIGHT: See COPYING in the top level directory
4 * FILE: boot/freeldr/freeldr/ui/minitui.c
5 * PURPOSE: Mini Text UI interface
6 * PROGRAMMERS: Brian Palmer <brianp@sginet.com>
12 VOID
MiniTuiDrawBackdrop(VOID
)
15 // Fill in a black background
17 TuiFillArea(0, 0, UiScreenWidth
- 1, UiScreenHeight
- 1, 0, 0);
20 // Update the screen buffer
22 VideoCopyOffScreenBufferToVRAM();
25 VOID
MiniTuiDrawStatusText(PCSTR StatusText
)
28 // Minimal UI doesn't have a status bar
32 VOID
MiniTuiDrawProgressBarCenter(ULONG Position
, ULONG Range
, PCHAR ProgressText
)
34 ULONG Left
, Top
, Right
, Bottom
;
35 ULONG Width
= 50; // Allow for 50 "bars"
41 Top
= UiScreenHeight
- Height
- 4;
42 Bottom
= Top
+ Height
+ 1;
44 MiniTuiDrawProgressBar(Left
, Top
, Right
, Bottom
, Position
, Range
, ProgressText
);
47 VOID
MiniTuiDrawProgressBar(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, ULONG Position
, ULONG Range
, PCHAR ProgressText
)
50 ULONG ProgressBarWidth
= (Right
- Left
) - 4;
52 // First make sure the progress bar text fits
53 UiTruncateStringEllipsis(ProgressText
, ProgressBarWidth
- 4);
61 // Draw the "Loading..." text
63 TuiDrawCenteredText(Left
+ 2, Top
+ 1, Right
- 2, Top
+ 1, ProgressText
, ATTR(7, 0));
65 // Draw the percent complete
66 for (i
=0; i
<(Position
*ProgressBarWidth
)/Range
; i
++)
68 TuiDrawText(Left
+2+i
, Top
+2, "\xDB", ATTR(UiTextColor
, UiMenuBgColor
));
72 VideoCopyOffScreenBufferToVRAM();
76 MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo
)
86 // No GUI status bar text, just minimal text. Show the menu header.
88 if (MenuInfo
->MenuHeader
)
93 ATTR(UiMenuFgColor
, UiMenuBgColor
));
97 // Now tell the user how to choose
100 MenuInfo
->Bottom
+ 1,
101 "Use \x18 and \x19 to move the highlight to your choice.",
102 ATTR(UiMenuFgColor
, UiMenuBgColor
));
104 MenuInfo
->Bottom
+ 2,
105 "Press ENTER to choose.",
106 ATTR(UiMenuFgColor
, UiMenuBgColor
));
109 // And show the menu footer
111 if (MenuInfo
->MenuFooter
)
115 MenuInfo
->MenuFooter
,
116 ATTR(UiMenuFgColor
, UiMenuBgColor
));
122 TuiDrawMenuBox(MenuInfo
);
125 // Draw each line of the menu
127 for (i
= 0; i
< MenuInfo
->MenuItemCount
; i
++)
129 TuiDrawMenuItem(MenuInfo
, i
);
133 // Display the boot options if needed
135 if (MenuInfo
->ShowBootOptions
)
137 DisplayBootTimeOptions();
140 VideoCopyOffScreenBufferToVRAM();
143 const UIVTBL MiniTuiVtbl
=
154 MiniTuiDrawStatusText
,
157 TuiMessageBoxCritical
,
158 MiniTuiDrawProgressBarCenter
,
159 MiniTuiDrawProgressBar
,
163 MiniTuiDrawBackdrop
, /* no FadeIn */