ReactOS 0.4.15-dev-5669-g09dde2c
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 58 of file minitui.c.

59{
60 /* Fill in a black background */
64
65 /* Update the screen buffer */
67}
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:332
ULONG UiScreenWidth
Definition: ui.c:56
#define ATTR(cFore, cBack)
Definition: ui.h:314
UCHAR UiBackdropFgColor
Definition: ui.c:29
UCHAR UiBackdropFillStyle
Definition: ui.c:31
UCHAR UiBackdropBgColor
Definition: ui.c:30
ULONG UiScreenHeight
Definition: ui.c:57

◆ MiniTuiDrawMenu()

VOID MiniTuiDrawMenu ( _In_ PUI_MENU_INFO  MenuInfo)

Definition at line 189 of file minitui.c.

191{
192 ULONG i;
193
194#ifndef _M_ARM
195 /* Draw the backdrop */
197#endif
198
199 /* No GUI status bar text, just minimal text. Show the menu header. */
200 if (MenuInfo->MenuHeader)
201 {
203 MenuInfo->Top - 2,
204 MenuInfo->MenuHeader,
206 }
207
208 /* Draw the menu box */
210
211 /* Draw each line of the menu */
212 for (i = 0; i < MenuInfo->MenuItemCount; ++i)
213 {
215 }
216
217 /* Now tell the user how to choose */
219 MenuInfo->Bottom + 1,
220 "Use \x18 and \x19 to move the highlight to your choice.",
223 MenuInfo->Bottom + 2,
224 "Press ENTER to choose.",
226
227 /* And show the menu footer */
228 if (MenuInfo->MenuFooter)
229 {
231 UiScreenHeight - 4,
232 MenuInfo->MenuFooter,
234 }
235
236 /* Display the boot options if needed */
237 if (MenuInfo->ShowBootOptions)
238 {
240 }
241
242#ifndef _M_ARM
244#endif
245}
VOID DisplayBootTimeOptions(VOID)
Definition: options.c:181
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:254
VOID TuiDrawMenuItem(_In_ PUI_MENU_INFO MenuInfo, _In_ ULONG MenuItemNumber)
Definition: tuimenu.c:426
VOID TuiDrawMenuBox(_In_ PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:400
uint32_t ULONG
Definition: typedefs.h:59
UCHAR UiMenuBgColor
Definition: ui.c:37
UIVTBL UiVtbl
Definition: ui.c:70
VOID UiDrawBackdrop(VOID)
Definition: ui.c:239
UCHAR UiMenuFgColor
Definition: ui.c:36

◆ MiniTuiDrawProgressBar()

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

Definition at line 178 of file minitui.c.

184{
185 UiInitProgressBar(Left, Top, Right, Bottom, ProgressText);
186}
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:392

Referenced by MiniTuiDrawProgressBarCenter(), and UiDrawProgressBar().

◆ MiniTuiDrawProgressBarCenter()

VOID MiniTuiDrawProgressBarCenter ( _In_ PCSTR  ProgressText)

Definition at line 153 of file minitui.c.

155{
156 ULONG Left, Top, Right, Bottom, Width, Height;
157
158 /* Build the coordinates and sizes */
159#ifdef NTLDR_PROGRESSBAR
160 Height = 2;
162 Left = 0;
163 Top = UiScreenHeight - Height - 2;
164#else // BTMGR_PROGRESSBAR
165 Height = 3;
166 Width = UiScreenWidth - 4;
167 Left = 2;
168 Top = UiScreenHeight - Height - 3;
169#endif
170 Right = Left + Width - 1;
171 Bottom = Top + Height - 1;
172
173 /* Draw the progress bar */
174 MiniTuiDrawProgressBar(Left, Top, Right, Bottom, ProgressText);
175}
VOID MiniTuiDrawProgressBar(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: minitui.c:178
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:126
_In_ HFONT _Out_ PUINT Height
Definition: font.h:125

Referenced by UiDrawProgressBarCenter().

◆ MiniTuiDrawStatusText()

VOID MiniTuiDrawStatusText ( PCSTR  StatusText)

Definition at line 69 of file minitui.c.

70{
71 /* Minimal UI doesn't have a status bar */
72}

◆ MiniTuiInitialize()

BOOLEAN MiniTuiInitialize ( VOID  )

Definition at line 18 of file minitui.c.

19{
20 /* Initialize main TUI */
21 if (!TuiInitialize())
22 return FALSE;
23
24 /* Override default settings with "Mini" TUI Theme */
25
26 UiTextColor = TuiTextToColor("Default");
27
32 UiBackdropFillStyle = ' '; // TuiTextToFillStyle("None");
35 // UiMessageBoxFgColor = COLOR_WHITE;
36 // UiMessageBoxBgColor = COLOR_BLUE;
41 // UiEditBoxTextColor = COLOR_WHITE;
42 // UiEditBoxBgColor = COLOR_BLACK;
43
48
49 // TODO: Have a boolean to show/hide title box?
51
53 "Seconds until highlighted choice will be started automatically:");
54
55 return TRUE;
56}
#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:865
BOOLEAN TuiInitialize(VOID)
Definition: tui.c:206
UCHAR UiStatusBarBgColor
Definition: ui.c:28
BOOLEAN UiUseSpecialEffects
Definition: ui.c:47
BOOLEAN UiCenterMenu
Definition: ui.c:46
UCHAR UiTitleBoxBgColor
Definition: ui.c:33
UCHAR UiTextColor
Definition: ui.c:38
CHAR UiTimeText[260]
Definition: ui.c:50
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:49
#define COLOR_WHITE
Definition: ui.h:335
UCHAR UiTitleBoxFgColor
Definition: ui.c:32
BOOLEAN UiShowTime
Definition: ui.c:44
BOOLEAN UiMenuBox
Definition: ui.c:45
#define COLOR_BLACK
Definition: ui.h:319
UCHAR UiStatusBarFgColor
Definition: ui.c:27
UCHAR UiSelectedTextColor
Definition: ui.c:39
UCHAR UiSelectedTextBgColor
Definition: ui.c:40

◆ MiniTuiSetProgressBarText()

VOID MiniTuiSetProgressBarText ( _In_ PCSTR  ProgressText)

Definition at line 77 of file minitui.c.

79{
80 ULONG ProgressBarWidth;
81 CHAR ProgressString[256];
82
83 /* Make sure the progress bar is enabled */
85
86 /* Calculate the width of the bar proper */
87 ProgressBarWidth = UiProgressBar.Right - UiProgressBar.Left + 1;
88
89 /* First make sure the progress bar text fits */
90 RtlStringCbCopyA(ProgressString, sizeof(ProgressString), ProgressText);
91 TuiTruncateStringEllipsis(ProgressString, ProgressBarWidth);
92
93 /* Clear the text area */
96#ifdef NTLDR_PROGRESSBAR
98#else // BTMGR_PROGRESSBAR
99 UiProgressBar.Bottom - 2, // One empty line between text and bar.
100#endif
102
103 /* Draw the "Loading..." text */
106#ifdef NTLDR_PROGRESSBAR
108#else // BTMGR_PROGRESSBAR
109 UiProgressBar.Bottom - 2, // One empty line between text and bar.
110#endif
111 ProgressString, ATTR(UiTextColor, UiMenuBgColor));
112}
#define ASSERT(a)
Definition: mode.c:44
ULONG Top
Definition: ui.h:125
ULONG Bottom
Definition: ui.h:127
BOOLEAN Show
Definition: ui.h:129
ULONG Left
Definition: ui.h:124
ULONG Right
Definition: ui.h:126
VOID TuiDrawCenteredText(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
Definition: tui.c:119
VOID TuiTruncateStringEllipsis(_Inout_z_ PSTR StringText, _In_ ULONG MaxChars)
Definition: tui.c:57
UI_PROGRESS_BAR UiProgressBar
Definition: ui.c:66
char CHAR
Definition: xmlstorage.h:175

Referenced by UiInitProgressBar(), and UiSetProgressBarText().

◆ MiniTuiTickProgressBar()

VOID MiniTuiTickProgressBar ( _In_ ULONG  SubPercentTimes100)

Definition at line 115 of file minitui.c.

117{
118 ULONG ProgressBarWidth;
119 ULONG FillCount;
120
121 /* Make sure the progress bar is enabled */
123
124 ASSERT(SubPercentTimes100 <= (100 * 100));
125
126 /* Calculate the width of the bar proper */
127 ProgressBarWidth = UiProgressBar.Right - UiProgressBar.Left + 1;
128
129 /* Compute fill count */
130 // FillCount = (ProgressBarWidth * Position) / Range;
131 FillCount = ProgressBarWidth * SubPercentTimes100 / (100 * 100);
132
133 /* Fill the progress bar */
134 /* Draw the percent complete -- Use the fill character */
135 if (FillCount > 0)
136 {
138 UiProgressBar.Left + FillCount - 1, UiProgressBar.Bottom,
139 '\xDB', ATTR(UiTextColor, UiMenuBgColor));
140 }
141 /* Fill the remaining with blanks */
145
146#ifndef _M_ARM
149#endif
150}
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:552

Referenced by UiInitProgressBar(), and UiUpdateProgressBar().

Variable Documentation

◆ MiniTuiVtbl

const UIVTBL MiniTuiVtbl
Initial value:
=
{
}
VOID MiniTuiTickProgressBar(_In_ ULONG SubPercentTimes100)
Definition: minitui.c:115
VOID MiniTuiDrawStatusText(PCSTR StatusText)
Definition: minitui.c:69
VOID MiniTuiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: minitui.c:77
VOID MiniTuiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: minitui.c:153
BOOLEAN MiniTuiInitialize(VOID)
Definition: minitui.c:18
VOID MiniTuiDrawBackdrop(VOID)
Definition: minitui.c:58
VOID MiniTuiDrawMenu(_In_ PUI_MENU_INFO MenuInfo)
Definition: minitui.c:189
VOID TuiMessageBox(PCSTR MessageText)
Definition: tui.c:642
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:507
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: tui.c:362
VOID TuiUnInitialize(VOID)
Definition: tui.c:252
UCHAR TuiTextToFillStyle(PCSTR FillStyleText)
Definition: tui.c:904
VOID TuiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:72
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:89
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
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:659
BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: tui.c:984
VOID TuiFadeOut(VOID)
Definition: tui.c:954

Definition at line 249 of file minitui.c.

Referenced by UiInitialize(), and UiResetForSOS().