ReactOS 0.4.15-dev-6068-g8061a6f
ui.h File Reference
#include <ui/minitui.h>
#include <ui/noui.h>
#include <ui/tui.h>
Include dependency graph for ui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _UI_PROGRESS_BAR
 
struct  tagUI_MENU_INFO
 
struct  tagUIVTBL
 

Macros

#define LIGHT_FILL   0xB0
 
#define MEDIUM_FILL   0xB1
 
#define DARK_FILL   0xB2
 
#define ATTR(cFore, cBack)   ((cBack << 4) | cFore)
 
#define COLOR_BLACK   0
 
#define COLOR_BLUE   1
 
#define COLOR_GREEN   2
 
#define COLOR_CYAN   3
 
#define COLOR_RED   4
 
#define COLOR_MAGENTA   5
 
#define COLOR_BROWN   6
 
#define COLOR_GRAY   7
 
#define COLOR_DARKGRAY   8
 
#define COLOR_LIGHTBLUE   9
 
#define COLOR_LIGHTGREEN   10
 
#define COLOR_LIGHTCYAN   11
 
#define COLOR_LIGHTRED   12
 
#define COLOR_LIGHTMAGENTA   13
 
#define COLOR_YELLOW   14
 
#define COLOR_WHITE   15
 
#define HORZ   0xC4
 
#define D_HORZ   0xCD
 
#define VERT   0xB3
 
#define D_VERT   0xBA
 

Typedefs

typedef struct _UI_PROGRESS_BAR UI_PROGRESS_BAR
 
typedef struct _UI_PROGRESS_BARPUI_PROGRESS_BAR
 
typedef struct tagUI_MENU_INFO UI_MENU_INFO
 
typedef struct tagUI_MENU_INFOPUI_MENU_INFO
 
typedef BOOLEAN(* UiMenuKeyPressFilterCallback) (IN ULONG KeyPress, IN ULONG SelectedMenuItem, IN PVOID Context OPTIONAL)
 
typedef struct tagUIVTBL UIVTBL
 
typedef struct tagUIVTBLPUIVTBL
 

Functions

BOOLEAN UiInitialize (BOOLEAN ShowUi)
 
VOID UiUnInitialize (PCSTR BootText)
 
VOID UiDrawBackdrop (VOID)
 
VOID UiFillArea (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
 
VOID UiDrawShadow (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
 
VOID UiDrawBox (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
 
VOID UiDrawText (_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
 
VOID UiDrawText2 (_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
 
VOID UiDrawCenteredText (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
 
VOID UiDrawStatusText (PCSTR StatusText)
 
VOID UiUpdateDateTime (VOID)
 
VOID UiInfoBox (PCSTR MessageText)
 
VOID UiMessageBox (PCSTR Format,...)
 
VOID UiMessageBoxCritical (PCSTR MessageText)
 
VOID UiInitProgressBar (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
 
VOID UiIndicateProgress (VOID)
 
VOID UiSetProgressBarSubset (_In_ ULONG Floor, _In_ ULONG Ceiling)
 
VOID UiUpdateProgressBar (_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
 
VOID UiSetProgressBarText (_In_ PCSTR ProgressText)
 
VOID UiDrawProgressBarCenter (_In_ PCSTR ProgressText)
 
VOID UiDrawProgressBar (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
 
VOID UiShowMessageBoxesInSection (IN ULONG_PTR SectionId)
 
VOID UiShowMessageBoxesInArgv (IN ULONG Argc, IN PCHAR Argv[])
 
BOOLEAN UiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 
UCHAR UiTextToColor (PCSTR ColorText)
 
UCHAR UiTextToFillStyle (PCSTR FillStyleText)
 
VOID UiFadeInBackdrop (VOID)
 
VOID UiFadeOut (VOID)
 
BOOLEAN UiDisplayMenu (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)
 
VOID UiInit (const char *CmdLine)
 

Variables

ULONG UiScreenWidth
 
ULONG UiScreenHeight
 
UCHAR UiStatusBarFgColor
 
UCHAR UiStatusBarBgColor
 
UCHAR UiBackdropFgColor
 
UCHAR UiBackdropBgColor
 
UCHAR UiBackdropFillStyle
 
UCHAR UiTitleBoxFgColor
 
UCHAR UiTitleBoxBgColor
 
UCHAR UiMessageBoxFgColor
 
UCHAR UiMessageBoxBgColor
 
UCHAR UiMenuFgColor
 
UCHAR UiMenuBgColor
 
UCHAR UiTextColor
 
UCHAR UiSelectedTextColor
 
UCHAR UiSelectedTextBgColor
 
UCHAR UiEditBoxTextColor
 
UCHAR UiEditBoxBgColor
 
BOOLEAN UiShowTime
 
BOOLEAN UiMenuBox
 
BOOLEAN UiCenterMenu
 
BOOLEAN UiUseSpecialEffects
 
CHAR UiTitleBoxTitleText [260]
 
CHAR UiTimeText [260]
 
const PCSTR UiMonthNames [12]
 
UI_PROGRESS_BAR UiProgressBar
 
UIVTBL UiVtbl
 

Macro Definition Documentation

◆ ATTR

#define ATTR (   cFore,
  cBack 
)    ((cBack << 4) | cFore)

Definition at line 314 of file ui.h.

◆ COLOR_BLACK

#define COLOR_BLACK   0

Definition at line 319 of file ui.h.

◆ COLOR_BLUE

#define COLOR_BLUE   1

Definition at line 320 of file ui.h.

◆ COLOR_BROWN

#define COLOR_BROWN   6

Definition at line 325 of file ui.h.

◆ COLOR_CYAN

#define COLOR_CYAN   3

Definition at line 322 of file ui.h.

◆ COLOR_DARKGRAY

#define COLOR_DARKGRAY   8

Definition at line 328 of file ui.h.

◆ COLOR_GRAY

#define COLOR_GRAY   7

Definition at line 326 of file ui.h.

◆ COLOR_GREEN

#define COLOR_GREEN   2

Definition at line 321 of file ui.h.

◆ COLOR_LIGHTBLUE

#define COLOR_LIGHTBLUE   9

Definition at line 329 of file ui.h.

◆ COLOR_LIGHTCYAN

#define COLOR_LIGHTCYAN   11

Definition at line 331 of file ui.h.

◆ COLOR_LIGHTGREEN

#define COLOR_LIGHTGREEN   10

Definition at line 330 of file ui.h.

◆ COLOR_LIGHTMAGENTA

#define COLOR_LIGHTMAGENTA   13

Definition at line 333 of file ui.h.

◆ COLOR_LIGHTRED

#define COLOR_LIGHTRED   12

Definition at line 332 of file ui.h.

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   5

Definition at line 324 of file ui.h.

◆ COLOR_RED

#define COLOR_RED   4

Definition at line 323 of file ui.h.

◆ COLOR_WHITE

#define COLOR_WHITE   15

Definition at line 335 of file ui.h.

◆ COLOR_YELLOW

#define COLOR_YELLOW   14

Definition at line 334 of file ui.h.

◆ D_HORZ

#define D_HORZ   0xCD

Definition at line 344 of file ui.h.

◆ D_VERT

#define D_VERT   0xBA

Definition at line 346 of file ui.h.

◆ DARK_FILL

#define DARK_FILL   0xB2

Definition at line 309 of file ui.h.

◆ HORZ

#define HORZ   0xC4

Definition at line 343 of file ui.h.

◆ LIGHT_FILL

#define LIGHT_FILL   0xB0

Definition at line 307 of file ui.h.

◆ MEDIUM_FILL

#define MEDIUM_FILL   0xB1

Definition at line 308 of file ui.h.

◆ VERT

#define VERT   0xB3

Definition at line 345 of file ui.h.

Typedef Documentation

◆ PUI_MENU_INFO

◆ PUI_PROGRESS_BAR

◆ PUIVTBL

◆ UI_MENU_INFO

◆ UI_PROGRESS_BAR

◆ UiMenuKeyPressFilterCallback

typedef BOOLEAN(* UiMenuKeyPressFilterCallback) (IN ULONG KeyPress, IN ULONG SelectedMenuItem, IN PVOID Context OPTIONAL)

Definition at line 220 of file ui.h.

◆ UIVTBL

Function Documentation

◆ UiDisplayMenu()

BOOLEAN UiDisplayMenu ( 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 at line 600 of file ui.c.

612{
613 return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, ShowBootOptions,
614 MenuItemList, MenuItemCount, DefaultMenuItem,
615 MenuTimeOut, SelectedMenuItem, CanEscape,
616 KeyPressFilter, Context);
617}
BOOLEAN(* DisplayMenu)(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: ui.h:284
UIVTBL UiVtbl
Definition: ui.c:64

Referenced by DoOptionsMenu(), and RunLoader().

◆ UiDrawBackdrop()

VOID UiDrawBackdrop ( VOID  )

Definition at line 233 of file ui.c.

234{
236}
VOID(* DrawBackdrop)(VOID)
Definition: ui.h:250

Referenced by DoOptionsMenu(), LoadAndBootWindows(), LoadReactOSSetup(), MiniTuiDrawMenu(), RunLoader(), TuiDrawMenu(), and UiUnInitialize().

◆ UiDrawBox()

VOID UiDrawBox ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
UCHAR  VertStyle,
UCHAR  HorzStyle,
BOOLEAN  Fill,
BOOLEAN  Shadow,
UCHAR  Attr 
)

Definition at line 248 of file ui.c.

249{
250 UiVtbl.DrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr);
251}
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
VOID(* DrawBox)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.h:253

Referenced by TuiDrawMenuBox(), and UiInfoBox().

◆ UiDrawCenteredText()

VOID UiDrawCenteredText ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ PCSTR  TextString,
_In_ UCHAR  Attr 
)

Definition at line 275 of file ui.c.

282{
283 UiVtbl.DrawCenteredText(Left, Top, Right, Bottom, TextString, Attr);
284}
VOID(* DrawCenteredText)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: ui.h:256

Referenced by UiInfoBox().

◆ UiDrawProgressBar()

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

Definition at line 489 of file ui.c.

495{
496 UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, ProgressText);
497}
VOID(* DrawProgressBar)(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR ProgressText)
Definition: ui.h:265

◆ UiDrawProgressBarCenter()

VOID UiDrawProgressBarCenter ( _In_ PCSTR  ProgressText)

Definition at line 482 of file ui.c.

484{
485 UiVtbl.DrawProgressBarCenter(ProgressText);
486}
VOID(* DrawProgressBarCenter)(_In_ PCSTR ProgressText)
Definition: ui.h:262

Referenced by LoadAndBootWindows(), LoadReactOSSetup(), and RamDiskLoadVirtualFile().

◆ UiDrawShadow()

VOID UiDrawShadow ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom 
)

Definition at line 243 of file ui.c.

244{
245 UiVtbl.DrawShadow(Left, Top, Right, Bottom);
246}
VOID(* DrawShadow)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: ui.h:252

◆ UiDrawStatusText()

VOID UiDrawStatusText ( PCSTR  StatusText)

Definition at line 286 of file ui.c.

287{
288 UiVtbl.DrawStatusText(StatusText);
289}
VOID(* DrawStatusText)(PCSTR StatusText)
Definition: ui.h:257

Referenced by LoadAndBootWindows(), LoadReactOSSetup(), NtLdrOutputLoadMsg(), TuiEditBox(), TuiMessageBoxCritical(), UiUnInitialize(), and WinLdrSetupEms().

◆ UiDrawText()

VOID UiDrawText ( _In_ ULONG  X,
_In_ ULONG  Y,
_In_ PCSTR  Text,
_In_ UCHAR  Attr 
)

Definition at line 254 of file ui.c.

259{
260 UiVtbl.DrawText(X, Y, Text, Attr);
261}
char * Text
Definition: combotst.c:136
#define Y(I)
VOID(* DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.h:254

Referenced by DisplayBootTimeOptions(), TuiDrawMenuItem(), TuiDrawMenuTimeout(), TuiEditBox(), and TuiMessageBoxCritical().

◆ UiDrawText2()

VOID UiDrawText2 ( _In_ ULONG  X,
_In_ ULONG  Y,
_In_opt_ ULONG  MaxNumChars,
_In_reads_or_z_(MaxNumChars) PCSTR  Text,
_In_ UCHAR  Attr 
)

Definition at line 264 of file ui.c.

270{
271 UiVtbl.DrawText2(X, Y, MaxNumChars, Text, Attr);
272}
VOID(* DrawText2)(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: ui.h:255

Referenced by TuiEditBox().

◆ UiEditBox()

BOOLEAN UiEditBox ( PCSTR  MessageText,
PCHAR  EditTextBuffer,
ULONG  Length 
)

Definition at line 629 of file ui.c.

630{
631 return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
632}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
BOOLEAN(* EditBox)(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.h:278

Referenced by DoOptionsMenu(), and EditCustomBootReactOS().

◆ UiFadeInBackdrop()

VOID UiFadeInBackdrop ( VOID  )

Definition at line 619 of file ui.c.

620{
622}
VOID(* FadeInBackdrop)(VOID)
Definition: ui.h:281

Referenced by UiInitialize().

◆ UiFadeOut()

VOID UiFadeOut ( VOID  )

Definition at line 624 of file ui.c.

625{
626 UiVtbl.FadeOut();
627}
VOID(* FadeOut)(VOID)
Definition: ui.h:282

◆ UiFillArea()

VOID UiFillArea ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
CHAR  FillChar,
UCHAR  Attr 
)

Definition at line 238 of file ui.c.

239{
240 UiVtbl.FillArea(Left, Top, Right, Bottom, FillChar, Attr);
241}
VOID(* FillArea)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: ui.h:251

Referenced by TuiEditBox().

◆ UiIndicateProgress()

VOID UiIndicateProgress ( VOID  )

Definition at line 413 of file ui.c.

414{
415 ULONG Percentage;
416
417 /* Increase progress */
418 UiProgressBar.Indicator.Count++;
419
420 /* Compute the new percentage - Don't go over 100% */
421 Percentage = 100 * UiProgressBar.Indicator.Count /
422 UiProgressBar.Indicator.Expected;
423 Percentage = min(Percentage, 99);
424
425 if (Percentage != UiProgressBar.Indicator.Percentage)
426 {
427 /* Percentage has changed, update the progress bar */
428 UiProgressBar.Indicator.Percentage = Percentage;
429 UiUpdateProgressBar(Percentage, NULL);
430 }
431}
#define NULL
Definition: types.h:112
#define min(a, b)
Definition: monoChain.cc:55
struct _UI_PROGRESS_BAR::@175 Indicator
uint32_t ULONG
Definition: typedefs.h:59
UI_PROGRESS_BAR UiProgressBar
Definition: ui.c:62
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:449

Referenced by WinLdrLoadBootDrivers().

◆ UiInfoBox()

VOID UiInfoBox ( PCSTR  MessageText)

Definition at line 296 of file ui.c.

297{
298 SIZE_T TextLength;
299 ULONG BoxWidth;
300 ULONG BoxHeight;
301 ULONG LineBreakCount;
303 SIZE_T LastIndex;
304 ULONG Left;
305 ULONG Top;
306 ULONG Right;
308
309 TextLength = strlen(MessageText);
310
311 // Count the new lines and the box width
312 LineBreakCount = 0;
313 BoxWidth = 0;
314 LastIndex = 0;
315 for (Index=0; Index<TextLength; Index++)
316 {
317 if (MessageText[Index] == '\n')
318 {
319 LastIndex = Index;
320 LineBreakCount++;
321 }
322 else
323 {
324 if ((Index - LastIndex) > BoxWidth)
325 {
326 BoxWidth = (ULONG)(Index - LastIndex);
327 }
328 }
329 }
330
331 // Calc the box width & height
332 BoxWidth += 6;
333 BoxHeight = LineBreakCount + 4;
334
335 // Calc the box coordinates
336 Left = (UiScreenWidth / 2) - (BoxWidth / 2);
337 Top =(UiScreenHeight / 2) - (BoxHeight / 2);
338 Right = (UiScreenWidth / 2) + (BoxWidth / 2);
339 Bottom = (UiScreenHeight / 2) + (BoxHeight / 2);
340
341 // Draw the box
342 UiDrawBox(Left,
343 Top,
344 Right,
345 Bottom,
346 VERT,
347 HORZ,
348 TRUE,
349 TRUE,
351 );
352
353 // Draw the text
354 UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
355}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
ULONG_PTR SIZE_T
Definition: typedefs.h:80
ULONG UiScreenWidth
Definition: ui.c:54
UCHAR UiTextColor
Definition: ui.c:36
UCHAR UiMenuBgColor
Definition: ui.c:35
ULONG UiScreenHeight
Definition: ui.c:55
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.c:248
UCHAR UiMenuFgColor
Definition: ui.c:34
VOID UiDrawCenteredText(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
Definition: ui.c:275
#define VERT
Definition: ui.h:345
#define ATTR(cFore, cBack)
Definition: ui.h:314
#define HORZ
Definition: ui.h:343
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by UiUnInitialize().

◆ UiInit()

VOID UiInit ( const char CmdLine)

◆ UiInitialize()

BOOLEAN UiInitialize ( BOOLEAN  ShowUi)

Definition at line 92 of file ui.c.

93{
94 VIDEODISPLAYMODE UiDisplayMode; // Tells us if we are in text or graphics mode
95 BOOLEAN UiMinimal = FALSE; // Tells us if we are using a minimal console-like UI
96 ULONG_PTR SectionId;
98 CHAR SettingText[260];
99
100 if (!ShowUi)
101 {
102 if (!UiVtbl.Initialize())
103 {
105 return FALSE;
106 }
107 return TRUE;
108 }
109
110 TRACE("Initializing User Interface.\n");
111 TRACE("Reading UI settings from [Display] section.\n");
112
113 /* Open the [Display] section */
114 if (!IniOpenSection("Display", &SectionId))
115 SectionId = 0;
116
117 /* Select the video mode */
118 SettingText[0] = '\0';
119 if ((SectionId != 0) && !IniReadSettingByName(SectionId, "DisplayMode", SettingText, sizeof(SettingText)))
120 {
121 SettingText[0] = '\0';
122 }
123 UiDisplayMode = MachVideoSetDisplayMode(SettingText, TRUE);
125
126 /* Select the UI */
127 if ((SectionId != 0) && IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText)))
128 {
129 UiMinimal = (_stricmp(SettingText, "Yes") == 0);
130 }
131
132 if (UiDisplayMode == VideoGraphicsMode)
133#if 0 // We don't support a GUI mode yet.
134 UiVtbl = GuiVtbl;
135#else
136 {
137 // Switch back to text mode.
139 UiDisplayMode = VideoTextMode;
140 }
141#endif
142 else // if (UiDisplayMode == VideoTextMode)
143 UiVtbl = (UiMinimal ? MiniTuiVtbl : TuiVtbl);
144
145 /* Load the UI and initialize its default settings */
146 if (!UiVtbl.Initialize())
147 {
149 return FALSE;
150 }
151
152 /* Load the user UI settings */
153 if (SectionId != 0)
154 {
155 static const struct
156 {
157 PCSTR SettingName;
158 PVOID SettingVar;
159 SIZE_T SettingSize OPTIONAL; // Must be non-zero only for text buffers.
160 UCHAR SettingType; // 0: Text, 1: Yes/No, 2: Color, 3: Fill style
161 } Settings[] =
162 {
163 {"TitleText", &UiTitleBoxTitleText, sizeof(UiTitleBoxTitleText), 0},
164 {"TimeText" , &UiTimeText, sizeof(UiTimeText), 0},
165
166 {"ShowTime" , &UiShowTime , 0, 1},
167 {"MenuBox" , &UiMenuBox , 0, 1},
168 {"CenterMenu" , &UiCenterMenu , 0, 1},
169 {"SpecialEffects", &UiUseSpecialEffects, 0, 1},
170
171 {"BackdropColor" , &UiBackdropBgColor , 0, 2},
172 {"BackdropTextColor" , &UiBackdropFgColor , 0, 2},
173 {"StatusBarColor" , &UiStatusBarBgColor , 0, 2},
174 {"StatusBarTextColor" , &UiStatusBarFgColor , 0, 2},
175 {"TitleBoxColor" , &UiTitleBoxBgColor , 0, 2},
176 {"TitleBoxTextColor" , &UiTitleBoxFgColor , 0, 2},
177 {"MessageBoxColor" , &UiMessageBoxBgColor , 0, 2},
178 {"MessageBoxTextColor", &UiMessageBoxFgColor , 0, 2},
179 {"MenuColor" , &UiMenuBgColor , 0, 2},
180 {"MenuTextColor" , &UiMenuFgColor , 0, 2},
181 {"TextColor" , &UiTextColor , 0, 2},
182 {"SelectedColor" , &UiSelectedTextBgColor, 0, 2},
183 {"SelectedTextColor" , &UiSelectedTextColor , 0, 2},
184 {"EditBoxColor" , &UiEditBoxBgColor , 0, 2},
185 {"EditBoxTextColor" , &UiEditBoxTextColor , 0, 2},
186
187 {"BackdropFillStyle", &UiBackdropFillStyle, 0, 3},
188 };
189 ULONG i;
190
191 for (i = 0; i < RTL_NUMBER_OF(Settings); ++i)
192 {
193 if (!IniReadSettingByName(SectionId, Settings[i].SettingName, SettingText, sizeof(SettingText)))
194 continue;
195
196 switch (Settings[i].SettingType)
197 {
198 case 0: // Text
199 RtlStringCbCopyA((PCHAR)Settings[i].SettingVar,
200 Settings[i].SettingSize, SettingText);
201 break;
202 case 1: // Yes/No
203 *(PBOOLEAN)Settings[i].SettingVar = (_stricmp(SettingText, "Yes") == 0);
204 break;
205 case 2: // Color
206 *(PUCHAR)Settings[i].SettingVar = UiTextToColor(SettingText);
207 break;
208 case 3: // Fill style
209 *(PUCHAR)Settings[i].SettingVar = UiTextToFillStyle(SettingText);
210 break;
211 default:
212 break;
213 }
214 }
215 }
216
217 /* Draw the backdrop and fade it in if special effects are enabled */
219
220 TRACE("UiInitialize() returning TRUE.\n");
221 return TRUE;
222}
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
@ VideoTextMode
Definition: machine.h:35
@ VideoGraphicsMode
Definition: machine.h:36
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:94
#define MachVideoGetDisplaySize(W, H, D)
Definition: machine.h:96
enum tagVIDEODISPLAYMODE VIDEODISPLAYMODE
const UIVTBL GuiVtbl
Definition: gui.c:84
#define _stricmp
Definition: cat.c:22
#define FALSE
Definition: types.h:117
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
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
Definition: inifile.c:147
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
const UIVTBL MiniTuiVtbl
Definition: minitui.c:237
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
#define TRACE(s)
Definition: solgame.cpp:4
BOOLEAN(* Initialize)(VOID)
Definition: ui.h:247
const UIVTBL TuiVtbl
Definition: tui.c:1204
#define OPTIONAL
Definition: typedefs.h:41
unsigned char * PBOOLEAN
Definition: typedefs.h:53
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
char * PCHAR
Definition: typedefs.h:51
UCHAR UiMessageBoxFgColor
Definition: ui.c:32
UCHAR UiTextToFillStyle(PCSTR FillStyleText)
Definition: ui.c:378
UCHAR UiMessageBoxBgColor
Definition: ui.c:33
UCHAR UiTextToColor(PCSTR ColorText)
Definition: ui.c:373
UCHAR UiEditBoxTextColor
Definition: ui.c:39
UCHAR UiStatusBarBgColor
Definition: ui.c:26
BOOLEAN UiUseSpecialEffects
Definition: ui.c:45
BOOLEAN UiCenterMenu
Definition: ui.c:44
UCHAR UiTitleBoxBgColor
Definition: ui.c:31
CHAR UiTimeText[260]
Definition: ui.c:48
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:47
UCHAR UiTitleBoxFgColor
Definition: ui.c:30
UCHAR UiBackdropFgColor
Definition: ui.c:27
BOOLEAN UiShowTime
Definition: ui.c:42
UCHAR UiBackdropFillStyle
Definition: ui.c:29
UCHAR UiBackdropBgColor
Definition: ui.c:28
BOOLEAN UiMenuBox
Definition: ui.c:43
UCHAR UiStatusBarFgColor
Definition: ui.c:25
UCHAR UiSelectedTextColor
Definition: ui.c:37
UCHAR UiSelectedTextBgColor
Definition: ui.c:38
UCHAR UiEditBoxBgColor
Definition: ui.c:40
VOID UiFadeInBackdrop(VOID)
Definition: ui.c:619
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175

Referenced by BootMain(), RunLoader(), and UiResetForSOS().

◆ UiInitProgressBar()

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

Definition at line 384 of file ui.c.

390{
391 /* Progress bar area */
392 UiProgressBar.Left = Left;
394 UiProgressBar.Right = Right;
396 // UiProgressBar.Width = Right - Left + 1;
397
398 /* Set the progress bar ranges */
400 UiProgressBar.Indicator.Count = 0;
401 UiProgressBar.Indicator.Expected = 25;
402 UiProgressBar.Indicator.Percentage = 0;
403
404 /* Enable the progress bar */
406
407 /* Initial drawing: set the "Loading..." text and the original position */
408 UiVtbl.SetProgressBarText(ProgressText);
410}
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(* TickProgressBar)(_In_ ULONG SubPercentTimes100)
Definition: ui.h:275
VOID(* SetProgressBarText)(_In_ PCSTR ProgressText)
Definition: ui.h:272
VOID UiSetProgressBarSubset(_In_ ULONG Floor, _In_ ULONG Ceiling)
Definition: ui.c:434

Referenced by MiniTuiDrawProgressBar(), and TuiDrawProgressBar().

◆ UiMessageBox()

VOID UiMessageBox ( PCSTR  Format,
  ... 
)

◆ UiMessageBoxCritical()

VOID UiMessageBoxCritical ( PCSTR  MessageText)

◆ UiSetProgressBarSubset()

VOID UiSetProgressBarSubset ( _In_ ULONG  Floor,
_In_ ULONG  Ceiling 
)

Definition at line 434 of file ui.c.

437{
438 /* Sanity checks */
439 ASSERT(Floor < Ceiling);
440 ASSERT(Ceiling <= 100);
441
442 /* Update the progress bar state */
443 UiProgressBar.State.Floor = Floor * 100;
444 // UiProgressBar.State.Ceiling = Ceiling * 100;
445 UiProgressBar.State.Bias = Ceiling - Floor;
446}
#define ASSERT(a)
Definition: mode.c:44
struct _UI_PROGRESS_BAR::@174 State

Referenced by LoadAndBootWindowsCommon(), and UiInitProgressBar().

◆ UiSetProgressBarText()

VOID UiSetProgressBarText ( _In_ PCSTR  ProgressText)

Definition at line 471 of file ui.c.

473{
474 /* Make sure the progress bar is enabled */
475 if (!UiProgressBar.Show)
476 return;
477
478 UiVtbl.SetProgressBarText(ProgressText);
479}

Referenced by LoadAndBootWindowsCommon(), and UiUpdateProgressBar().

◆ UiShowMessageBoxesInArgv()

VOID UiShowMessageBoxesInArgv ( IN ULONG  Argc,
IN PCHAR  Argv[] 
)

Definition at line 563 of file ui.c.

566{
567 ULONG LastIndex;
568 PCSTR ArgValue;
569 PCHAR MessageBoxText;
570 SIZE_T MessageBoxTextSize;
571
572 /* Find all the message box settings and run them */
573 for (LastIndex = 0;
574 (ArgValue = GetNextArgumentValue(Argc, Argv, &LastIndex, "MessageBox")) != NULL;
575 ++LastIndex)
576 {
577 /* Get the real length of the MessageBox text */
578 MessageBoxTextSize = (strlen(ArgValue) + 1) * sizeof(CHAR);
579
580 /* Allocate enough memory to hold the text */
581 MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
582 if (!MessageBoxText)
583 continue;
584
585 /* Get the MessageBox text */
586 strcpy(MessageBoxText, ArgValue);
587
588 /* Fix it up */
589 UiEscapeString(MessageBoxText);
590
591 /* Display it */
592 UiMessageBox(MessageBoxText);
593
594 /* Free the memory */
595 FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
596 }
597}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
PCHAR GetNextArgumentValue(IN ULONG Argc, IN PCHAR Argv[], IN OUT PULONG LastIndex OPTIONAL, IN PCHAR ArgumentName)
Definition: arcsupp.c:15
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197
static VOID UiEscapeString(PCHAR String)
Definition: ui.c:500
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:357
#define TAG_UI_TEXT
Definition: ui.c:52

◆ UiShowMessageBoxesInSection()

VOID UiShowMessageBoxesInSection ( IN ULONG_PTR  SectionId)

Definition at line 519 of file ui.c.

521{
522 ULONG Idx;
523 CHAR SettingName[80];
524 CHAR SettingValue[80];
525 PCHAR MessageBoxText;
526 ULONG MessageBoxTextSize;
527
528 if (SectionId == 0)
529 return;
530
531 /* Find all the message box settings and run them */
532 for (Idx = 0; Idx < IniGetNumSectionItems(SectionId); Idx++)
533 {
534 IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue));
535 if (_stricmp(SettingName, "MessageBox") != 0)
536 continue;
537
538 /* Get the real length of the MessageBox text */
539 MessageBoxTextSize = IniGetSectionSettingValueSize(SectionId, Idx);
540 // if (MessageBoxTextSize <= 0)
541 // continue;
542
543 /* Allocate enough memory to hold the text */
544 MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
545 if (!MessageBoxText)
546 continue;
547
548 /* Get the MessageBox text */
549 IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), MessageBoxText, MessageBoxTextSize);
550
551 /* Fix it up */
552 UiEscapeString(MessageBoxText);
553
554 /* Display it */
555 UiMessageBox(MessageBoxText);
556
557 /* Free the memory */
558 FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
559 }
560}
ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:101
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
Definition: inifile.c:54
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
Definition: inifile.c:114

Referenced by RunLoader().

◆ UiTextToColor()

UCHAR UiTextToColor ( PCSTR  ColorText)

Definition at line 373 of file ui.c.

374{
375 return UiVtbl.TextToColor(ColorText);
376}
UCHAR(* TextToColor)(PCSTR ColorText)
Definition: ui.h:279

Referenced by UiInitialize().

◆ UiTextToFillStyle()

UCHAR UiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 378 of file ui.c.

379{
380 return UiVtbl.TextToFillStyle(FillStyleText);
381}
UCHAR(* TextToFillStyle)(PCSTR FillStyleText)
Definition: ui.h:280

Referenced by UiInitialize().

◆ UiUnInitialize()

VOID UiUnInitialize ( PCSTR  BootText)

Definition at line 224 of file ui.c.

225{
227 UiDrawStatusText(BootText);
228 UiInfoBox(BootText);
229
231}
VOID(* UnInitialize)(VOID)
Definition: ui.h:248
VOID UiInfoBox(PCSTR MessageText)
Definition: ui.c:296
VOID UiDrawBackdrop(VOID)
Definition: ui.c:233
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:286

Referenced by RunLoader().

◆ UiUpdateDateTime()

VOID UiUpdateDateTime ( VOID  )

Definition at line 291 of file ui.c.

292{
294}
VOID(* UpdateDateTime)(VOID)
Definition: ui.h:258

◆ UiUpdateProgressBar()

VOID UiUpdateProgressBar ( _In_ ULONG  Percentage,
_In_opt_ PCSTR  ProgressText 
)

Definition at line 449 of file ui.c.

452{
453 ULONG TotalProgress;
454
455 /* Make sure the progress bar is enabled */
456 if (!UiProgressBar.Show)
457 return;
458
459 /* Set the progress text if specified */
460 if (ProgressText)
461 UiSetProgressBarText(ProgressText);
462
463 /* Compute the total progress and tick the progress bar */
464 TotalProgress = UiProgressBar.State.Floor + (Percentage * UiProgressBar.State.Bias);
465 // TotalProgress /= (100 * 100);
466
467 UiVtbl.TickProgressBar(TotalProgress);
468}
VOID UiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: ui.c:471

Referenced by LoadAndBootWindows(), LoadAndBootWindowsCommon(), LoadModule(), LoadReactOSSetup(), RamDiskLoadVirtualFile(), and UiIndicateProgress().

Variable Documentation

◆ UiBackdropBgColor

UCHAR UiBackdropBgColor
extern

◆ UiBackdropFgColor

UCHAR UiBackdropFgColor
extern

◆ UiBackdropFillStyle

UCHAR UiBackdropFillStyle
extern

◆ UiCenterMenu

BOOLEAN UiCenterMenu
extern

◆ UiEditBoxBgColor

UCHAR UiEditBoxBgColor
extern

Definition at line 40 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), and UiInitialize().

◆ UiEditBoxTextColor

UCHAR UiEditBoxTextColor
extern

Definition at line 39 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), and UiInitialize().

◆ UiMenuBgColor

◆ UiMenuBox

BOOLEAN UiMenuBox
extern

◆ UiMenuFgColor

◆ UiMessageBoxBgColor

UCHAR UiMessageBoxBgColor
extern

Definition at line 33 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), TuiMessageBoxCritical(), and UiInitialize().

◆ UiMessageBoxFgColor

UCHAR UiMessageBoxFgColor
extern

Definition at line 32 of file ui.c.

Referenced by TuiEditBox(), TuiInitialize(), TuiMessageBoxCritical(), and UiInitialize().

◆ UiMonthNames

const PCSTR UiMonthNames[12]
extern

Definition at line 50 of file ui.c.

Referenced by TuiUpdateDateTime().

◆ UiProgressBar

◆ UiScreenHeight

◆ UiScreenWidth

◆ UiSelectedTextBgColor

UCHAR UiSelectedTextBgColor
extern

Definition at line 38 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawMenuItem(), TuiInitialize(), and UiInitialize().

◆ UiSelectedTextColor

UCHAR UiSelectedTextColor
extern

Definition at line 37 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawMenuItem(), TuiInitialize(), and UiInitialize().

◆ UiShowTime

BOOLEAN UiShowTime
extern

Definition at line 42 of file ui.c.

Referenced by MiniTuiInitialize(), TuiInitialize(), TuiUpdateDateTime(), and UiInitialize().

◆ UiStatusBarBgColor

UCHAR UiStatusBarBgColor
extern

Definition at line 26 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawStatusText(), TuiInitialize(), and UiInitialize().

◆ UiStatusBarFgColor

UCHAR UiStatusBarFgColor
extern

Definition at line 25 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawStatusText(), TuiInitialize(), and UiInitialize().

◆ UiTextColor

◆ UiTimeText

CHAR UiTimeText[260]
extern

Definition at line 48 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawMenuTimeout(), TuiInitialize(), and UiInitialize().

◆ UiTitleBoxBgColor

UCHAR UiTitleBoxBgColor
extern

◆ UiTitleBoxFgColor

UCHAR UiTitleBoxFgColor
extern

◆ UiTitleBoxTitleText

CHAR UiTitleBoxTitleText[260]
extern

Definition at line 47 of file ui.c.

Referenced by MiniTuiInitialize(), TuiDrawBackdrop(), TuiInitialize(), and UiInitialize().

◆ UiUseSpecialEffects

BOOLEAN UiUseSpecialEffects
extern

◆ UiVtbl