ReactOS 0.4.15-dev-8413-gc1c91f2
minitui.c File Reference
#include <freeldr.h>
Include dependency graph for minitui.c:

Go to the source code of this file.

Functions

BOOLEAN MiniTuiInitialize (VOID)
 
VOID MiniTuiDrawBackdrop (VOID)
 
VOID MiniTuiDrawStatusText (PCSTR StatusText)
 
VOID MiniTuiSetProgressBarText (_In_ PCSTR ProgressText)
 
VOID MiniTuiTickProgressBar (_In_ ULONG SubPercentTimes100)
 
VOID MiniTuiDrawProgressBarCenter (_In_ PCSTR ProgressText)
 
VOID MiniTuiDrawProgressBar (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
 
VOID MiniTuiDrawMenu (_In_ PUI_MENU_INFO MenuInfo)
 

Variables

const UIVTBL MiniTuiVtbl
 

Function Documentation

◆ MiniTuiDrawBackdrop()

VOID MiniTuiDrawBackdrop ( VOID  )

Definition at line 56 of file minitui.c.

57{
58 /* Fill in a black background */
62
63 /* Update the screen buffer */
65}
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:38
ULONG UiScreenWidth
Definition: ui.c:54
#define ATTR(cFore, cBack)
Definition: ui.h:317
UCHAR UiBackdropFgColor
Definition: ui.c:27
UCHAR UiBackdropFillStyle
Definition: ui.c:29
UCHAR UiBackdropBgColor
Definition: ui.c:28
ULONG UiScreenHeight
Definition: ui.c:55
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:329

◆ MiniTuiDrawMenu()

VOID MiniTuiDrawMenu ( _In_ PUI_MENU_INFO  MenuInfo)

Definition at line 183 of file minitui.c.

185{
186 ULONG i;
187
188 /* Draw the backdrop */
190
191 /* No GUI status bar text, just minimal text. Show the menu header. */
192 if (MenuInfo->MenuHeader)
193 {
195 MenuInfo->Top - 2,
196 MenuInfo->MenuHeader,
198 }
199
200 /* Draw the menu box */
202
203 /* Draw each line of the menu */
204 for (i = 0; i < MenuInfo->MenuItemCount; ++i)
205 {
207 }
208
209 /* Now tell the user how to choose */
211 MenuInfo->Bottom + 1,
212 "Use \x18 and \x19 to move the highlight to your choice.",
215 MenuInfo->Bottom + 2,
216 "Press ENTER to choose.",
218
219 /* And show the menu footer */
220 if (MenuInfo->MenuFooter)
221 {
223 UiScreenHeight - 4,
224 MenuInfo->MenuFooter,
226 }
227
228 /* Display the boot options if needed */
229 if (MenuInfo->ShowBootOptions)
230 {
232 }
233
235}
VOID DisplayBootTimeOptions(VOID)
Definition: options.c:181
UCHAR UiMenuBgColor
Definition: ui.c:35
UIVTBL UiVtbl
Definition: ui.c:64
VOID UiDrawBackdrop(VOID)
Definition: ui.c:233
UCHAR UiMenuFgColor
Definition: ui.c:34
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
menu info structure
Definition: window.h:276
VOID(* DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.h:257
VOID TuiDrawMenuItem(_In_ PUI_MENU_INFO MenuInfo, _In_ ULONG MenuItemNumber)
Definition: tuimenu.c:375
VOID TuiDrawMenuBox(_In_ PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:351
uint32_t ULONG
Definition: typedefs.h:59

◆ MiniTuiDrawProgressBar()

VOID MiniTuiDrawProgressBar ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ PCSTR  ProgressText 
)

Definition at line 172 of file minitui.c.

178{
179 UiInitProgressBar(Left, Top, Right, Bottom, ProgressText);
180}
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
VOID UiInitProgressBar(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: ui.c:389

Referenced by MiniTuiDrawProgressBarCenter().

◆ MiniTuiDrawProgressBarCenter()

VOID MiniTuiDrawProgressBarCenter ( _In_ PCSTR  ProgressText)

Definition at line 147 of file minitui.c.

149{
150 ULONG Left, Top, Right, Bottom, Width, Height;
151
152 /* Build the coordinates and sizes */
153#ifdef NTLDR_PROGRESSBAR
154 Height = 2;
156 Left = 0;
157 Top = UiScreenHeight - Height - 2;
158#else // BTMGR_PROGRESSBAR
159 Height = 3;
160 Width = UiScreenWidth - 4;
161 Left = 2;
162 Top = UiScreenHeight - Height - 3;
163#endif
164 Right = Left + Width - 1;
165 Bottom = Top + Height - 1;
166
167 /* Draw the progress bar */
168 MiniTuiDrawProgressBar(Left, Top, Right, Bottom, ProgressText);
169}
VOID MiniTuiDrawProgressBar(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: minitui.c:172
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88

◆ MiniTuiDrawStatusText()

VOID MiniTuiDrawStatusText ( PCSTR  StatusText)

Definition at line 67 of file minitui.c.

68{
69 /* Minimal UI doesn't have a status bar */
70}

◆ MiniTuiInitialize()

BOOLEAN MiniTuiInitialize ( VOID  )

Definition at line 16 of file minitui.c.

17{
18 /* Initialize main TUI */
19 if (!TuiInitialize())
20 return FALSE;
21
22 /* Override default settings with "Mini" TUI Theme */
23
24 UiTextColor = TuiTextToColor("Default");
25
30 UiBackdropFillStyle = ' '; // TuiTextToFillStyle("None");
33 // UiMessageBoxFgColor = COLOR_WHITE;
34 // UiMessageBoxBgColor = COLOR_BLUE;
39 // UiEditBoxTextColor = COLOR_WHITE;
40 // UiEditBoxBgColor = COLOR_BLACK;
41
46
47 // TODO: Have a boolean to show/hide title box?
49
51 "Seconds until highlighted choice will be started automatically:");
52
53 return TRUE;
54}
UCHAR UiStatusBarBgColor
Definition: ui.c:26
BOOLEAN UiUseSpecialEffects
Definition: ui.c:45
BOOLEAN UiCenterMenu
Definition: ui.c:44
UCHAR UiTitleBoxBgColor
Definition: ui.c:31
UCHAR UiTextColor
Definition: ui.c:36
CHAR UiTimeText[260]
Definition: ui.c:48
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:47
#define COLOR_WHITE
Definition: ui.h:338
UCHAR UiTitleBoxFgColor
Definition: ui.c:30
BOOLEAN UiShowTime
Definition: ui.c:42
BOOLEAN UiMenuBox
Definition: ui.c:43
#define COLOR_BLACK
Definition: ui.h:322
UCHAR UiStatusBarFgColor
Definition: ui.c:25
UCHAR UiSelectedTextColor
Definition: ui.c:37
UCHAR UiSelectedTextBgColor
Definition: ui.c:38
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ANSI_NULL
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
UCHAR TuiTextToColor(PCSTR ColorText)
Definition: tui.c:919
BOOLEAN TuiInitialize(VOID)
Definition: tui.c:203

◆ MiniTuiSetProgressBarText()

VOID MiniTuiSetProgressBarText ( _In_ PCSTR  ProgressText)

Definition at line 73 of file minitui.c.

75{
76 ULONG ProgressBarWidth;
77 CHAR ProgressString[256];
78
79 /* Make sure the progress bar is enabled */
81
82 /* Calculate the width of the bar proper */
83 ProgressBarWidth = UiProgressBar.Right - UiProgressBar.Left + 1;
84
85 /* First make sure the progress bar text fits */
86 RtlStringCbCopyA(ProgressString, sizeof(ProgressString), ProgressText);
87 TuiTruncateStringEllipsis(ProgressString, ProgressBarWidth);
88
89 /* Clear the text area */
92#ifdef NTLDR_PROGRESSBAR
94#else // BTMGR_PROGRESSBAR
95 UiProgressBar.Bottom - 2, // One empty line between text and bar.
96#endif
98
99 /* Draw the "Loading..." text */
102#ifdef NTLDR_PROGRESSBAR
104#else // BTMGR_PROGRESSBAR
105 UiProgressBar.Bottom - 2, // One empty line between text and bar.
106#endif
107 ProgressString, ATTR(UiTextColor, UiMenuBgColor));
108}
UI_PROGRESS_BAR UiProgressBar
Definition: ui.c:62
#define ASSERT(a)
Definition: mode.c:44
ULONG Top
Definition: ui.h:132
ULONG Bottom
Definition: ui.h:134
BOOLEAN Show
Definition: ui.h:136
ULONG Left
Definition: ui.h:131
ULONG Right
Definition: ui.h:133
VOID TuiDrawCenteredText(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
Definition: tui.c:118
VOID TuiTruncateStringEllipsis(_Inout_z_ PSTR StringText, _In_ ULONG MaxChars)
Definition: tui.c:63
char CHAR
Definition: xmlstorage.h:175

◆ MiniTuiTickProgressBar()

VOID MiniTuiTickProgressBar ( _In_ ULONG  SubPercentTimes100)

Definition at line 111 of file minitui.c.

113{
114 ULONG ProgressBarWidth;
115 ULONG FillCount;
116
117 /* Make sure the progress bar is enabled */
119
120 ASSERT(SubPercentTimes100 <= (100 * 100));
121
122 /* Calculate the width of the bar proper */
123 ProgressBarWidth = UiProgressBar.Right - UiProgressBar.Left + 1;
124
125 /* Compute fill count */
126 // FillCount = (ProgressBarWidth * Position) / Range;
127 FillCount = ProgressBarWidth * SubPercentTimes100 / (100 * 100);
128
129 /* Fill the progress bar */
130 /* Draw the percent complete -- Use the fill character */
131 if (FillCount > 0)
132 {
134 UiProgressBar.Left + FillCount - 1, UiProgressBar.Bottom,
135 '\xDB', ATTR(UiTextColor, UiMenuBgColor));
136 }
137 /* Fill the remaining with blanks */
141
144}
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:547

Variable Documentation

◆ MiniTuiVtbl

const UIVTBL MiniTuiVtbl
Initial value:
=
{
}
VOID MiniTuiTickProgressBar(_In_ ULONG SubPercentTimes100)
Definition: minitui.c:111
VOID MiniTuiDrawStatusText(PCSTR StatusText)
Definition: minitui.c:67
VOID MiniTuiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: minitui.c:73
VOID MiniTuiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: minitui.c:147
BOOLEAN MiniTuiInitialize(VOID)
Definition: minitui.c:16
VOID MiniTuiDrawBackdrop(VOID)
Definition: minitui.c:56
VOID MiniTuiDrawMenu(_In_ PUI_MENU_INFO MenuInfo)
Definition: minitui.c:183
VOID TuiMessageBoxCritical(_In_ PCSTR MessageText)
Definition: tui.c:761
VOID TuiDrawBox(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ BOOLEAN Fill, _In_ BOOLEAN Shadow, _In_ UCHAR Attr)
Definition: tui.c:502
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: tui.c:359
VOID TuiUnInitialize(VOID)
Definition: tui.c:249
UCHAR TuiTextToFillStyle(PCSTR FillStyleText)
Definition: tui.c:958
VOID TuiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:78
VOID TuiDrawText2(_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:95
BOOLEAN TuiDisplayMenu(IN PCSTR MenuHeader, IN PCSTR MenuFooter OPTIONAL, IN BOOLEAN ShowBootOptions, IN PCSTR MenuItemList[], IN ULONG MenuItemCount, IN ULONG DefaultMenuItem, IN LONG MenuTimeOut, OUT PULONG SelectedMenuItem, IN BOOLEAN CanEscape, IN UiMenuKeyPressFilterCallback KeyPressFilter OPTIONAL, IN PVOID Context OPTIONAL)
Definition: tuimenu.c:30
BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: tui.c:1038
VOID TuiFadeOut(VOID)
Definition: tui.c:1008
VOID TuiMessageBox(_In_ PCSTR MessageText)
Definition: tui.c:745

Definition at line 237 of file minitui.c.

Referenced by UiInitialize(), and UiResetForSOS().