ReactOS  0.4.15-dev-492-ga1108f6
minitui.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: FreeLoader
4  * FILE: boot/freeldr/freeldr/ui/minitui.c
5  * PURPOSE: Mini Text UI interface
6  * PROGRAMMERS: Brian Palmer <brianp@sginet.com>
7  * HervĂ© Poussineau
8  */
9 #ifndef _M_ARM
10 #include <freeldr.h>
11 
13 {
14  //
15  // Fill in a black background
16  //
17  TuiFillArea(0, 0, UiScreenWidth - 1, UiScreenHeight - 1, 0, 0);
18 
19  //
20  // Update the screen buffer
21  //
23 }
24 
26 {
27  //
28  // Minimal UI doesn't have a status bar
29  //
30 }
31 
33 {
34  ULONG Left, Top, Right, Bottom, Width, Height;
35 
36  /* Build the coordinates and sizes */
37  Height = 2;
38  Width = UiScreenWidth;
39  Left = 0;
40  Right = (Left + Width) - 1;
41  Top = UiScreenHeight - Height - 4;
42  Bottom = Top + Height + 1;
43 
44  /* Draw the progress bar */
45  MiniTuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
46 }
47 
49 {
50  ULONG i;
51  ULONG ProgressBarWidth = (Right - Left) - 3;
52 
53  // First make sure the progress bar text fits
54  UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4);
55 
56  if (Position > Range)
57  {
58  Position = Range;
59  }
60 
61  //
62  // Draw the "Loading..." text
63  //
64  TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(7, 0));
65 
66  // Draw the percent complete
67  for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
68  {
69  TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
70  }
71 
74 }
75 
76 VOID
78 {
79  ULONG i;
80 
81  //
82  // Draw the backdrop
83  //
85 
86  //
87  // No GUI status bar text, just minimal text. Show the menu header.
88  //
89  if (MenuInfo->MenuHeader)
90  {
91  UiVtbl.DrawText(0,
92  MenuInfo->Top - 2,
93  MenuInfo->MenuHeader,
95  }
96 
97  //
98  // Now tell the user how to choose
99  //
100  UiVtbl.DrawText(0,
101  MenuInfo->Bottom + 1,
102  "Use \x18 and \x19 to move the highlight to your choice.",
104  UiVtbl.DrawText(0,
105  MenuInfo->Bottom + 2,
106  "Press ENTER to choose.",
108 
109  //
110  // And show the menu footer
111  //
112  if (MenuInfo->MenuFooter)
113  {
114  UiVtbl.DrawText(0,
115  UiScreenHeight - 4,
116  MenuInfo->MenuFooter,
118  }
119 
120  //
121  // Draw the menu box
122  //
124 
125  //
126  // Draw each line of the menu
127  //
128  for (i = 0; i < MenuInfo->MenuItemCount; i++)
129  {
131  }
132 
133  //
134  // Display the boot options if needed
135  //
136  if (MenuInfo->ShowBootOptions)
137  {
139  }
140 
142 }
143 
145 {
149  TuiFillArea,
151  TuiDrawBox,
152  TuiDrawText,
153  TuiDrawText2,
161  TuiEditBox,
164  MiniTuiDrawBackdrop, /* no FadeIn */
165  TuiFadeOut,
168 };
169 #endif
signed char * PCHAR
Definition: retypes.h:7
UCHAR TuiTextToColor(PCSTR ColorText)
Definition: tui.c:700
UCHAR UiTextColor
Definition: ui.c:42
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:562
VOID(* DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.h:154
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:428
static COORD Position
Definition: mouse.c:34
VOID TuiMessageBox(PCSTR MessageText)
Definition: tui.c:545
VOID TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:270
BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: tui.c:815
ULONG UiScreenHeight
Definition: ui.c:29
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
VOID MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo)
Definition: minitui.c:77
VOID TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
Definition: tuimenu.c:395
static ULONG ProgressBarWidth
Definition: inbv.c:87
struct tagRange Range
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
UIVTBL UiVtbl
Definition: ui.c:58
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: tui.c:188
#define ATTR(cFore, cBack)
Definition: ui.h:192
VOID TuiUnInitialize(VOID)
Definition: tui.c:67
UCHAR UiMenuBgColor
Definition: ui.c:41
VOID MiniTuiDrawBackdrop(VOID)
Definition: minitui.c:12
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:320
BOOLEAN TuiInitialize(VOID)
Definition: tui.c:52
Definition: ui.h:145
Definition: range.c:39
VOID UiDrawBackdrop(VOID)
Definition: ui.c:214
menu info structure
Definition: window.h:275
UCHAR TuiTextToFillStyle(PCSTR FillStyleText)
Definition: tui.c:736
const UIVTBL MiniTuiVtbl
Definition: minitui.c:144
VOID TuiFadeOut(VOID)
Definition: tui.c:785
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:17
VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars)
Definition: ui.c:455
static LPHIST_ENTRY Bottom
Definition: history.c:54
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: tui.c:352
VOID TuiDrawText2(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: tui.c:339
VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: minitui.c:48
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:153
VOID DisplayBootTimeOptions(VOID)
Definition: options.c:181
unsigned int ULONG
Definition: retypes.h:1
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:248
UCHAR UiMenuFgColor
Definition: ui.c:40
const char * PCSTR
Definition: typedefs.h:52
VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: minitui.c:32
ULONG UiScreenWidth
Definition: ui.c:28
static LPHIST_ENTRY Top
Definition: history.c:53
VOID MiniTuiDrawStatusText(PCSTR StatusText)
Definition: minitui.c:25