2 * COPYRIGHT: See COPYING in the top level directory
4 * FILE: 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.
91 ATTR(UiMenuFgColor
, UiMenuBgColor
));
94 // Now tell the user how to choose
98 "Use \x18 and \x19 to move the highlight to your choice.",
99 ATTR(UiMenuFgColor
, UiMenuBgColor
));
101 MenuInfo
->Bottom
+ 2,
102 "Press ENTER to choose.",
103 ATTR(UiMenuFgColor
, UiMenuBgColor
));
106 // And show the menu footer
110 MenuInfo
->MenuFooter
,
111 ATTR(UiMenuFgColor
, UiMenuBgColor
));
116 TuiDrawMenuBox(MenuInfo
);
119 // Draw each line of the menu
121 for (i
= 0; i
< MenuInfo
->MenuItemCount
; i
++)
123 TuiDrawMenuItem(MenuInfo
, i
);
127 // Display the boot options if needed
129 if (MenuInfo
->ShowBootOptions
)
131 DisplayBootTimeOptions();
134 VideoCopyOffScreenBufferToVRAM();
137 const UIVTBL MiniTuiVtbl
=
147 MiniTuiDrawStatusText
,
150 TuiMessageBoxCritical
,
151 MiniTuiDrawProgressBarCenter
,
152 MiniTuiDrawProgressBar
,
156 MiniTuiDrawBackdrop
, /* no FadeIn */