ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

minitui.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         FreeLoader
00004  * FILE:            freeldr/ui/minitui.c
00005  * PURPOSE:         Mini Text UI interface
00006  * PROGRAMMERS:     Brian Palmer <brianp@sginet.com>
00007  *                  Hervé Poussineau
00008  */
00009 #ifndef _M_ARM
00010 #include <freeldr.h>
00011 
00012 VOID MiniTuiDrawBackdrop(VOID)
00013 {
00014     //
00015     // Fill in a black background
00016     //
00017     TuiFillArea(0,
00018                 0,
00019                 UiScreenWidth - 1,
00020                 UiScreenHeight - 1,
00021                 0,
00022                 0);
00023     
00024     //
00025     // Update the screen buffer
00026     //
00027     VideoCopyOffScreenBufferToVRAM();
00028 }
00029 
00030 VOID MiniTuiDrawStatusText(PCSTR StatusText)
00031 {
00032     //
00033     // Minimal UI doesn't have a status bar
00034     //
00035 }
00036 
00037 VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
00038 {
00039     ULONG       Left, Top, Right, Bottom;
00040     ULONG       Width = 50; // Allow for 50 "bars"
00041     ULONG       Height = 2;
00042 
00043     Width = 80;
00044     Left = 0;
00045     Right = Left + Width;
00046     Top = UiScreenHeight - Height - 4;
00047     Bottom = Top + Height + 1;
00048 
00049     MiniTuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
00050 }
00051 
00052 VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
00053 {
00054     ULONG       i;
00055     ULONG       ProgressBarWidth = (Right - Left) - 4;
00056 
00057     // First make sure the progress bar text fits
00058     UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4);
00059 
00060     if (Position > Range)
00061     {
00062         Position = Range;
00063     }
00064 
00065     //
00066     //  Draw the "Loading..." text
00067     //
00068     TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(7, 0));
00069 
00070     // Draw the percent complete
00071     for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
00072     {
00073         TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
00074     }
00075 
00076     TuiUpdateDateTime();
00077     VideoCopyOffScreenBufferToVRAM();
00078 }
00079 
00080 VOID
00081 MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo)
00082 {
00083     ULONG i;
00084 
00085     //
00086     // Draw the backdrop
00087     //
00088     UiDrawBackdrop();
00089 
00090     //
00091     // No GUI status bar text, just minimal text. first to tell the user to
00092     // choose.
00093     //
00094     UiVtbl.DrawText(0,
00095                     MenuInfo->Top - 2,
00096                     "Please select the operating system to start:",
00097                     ATTR(UiMenuFgColor, UiMenuBgColor));
00098 
00099     //
00100     // Now tell him how to choose
00101     //
00102     UiVtbl.DrawText(0,
00103                     MenuInfo->Bottom + 1,
00104                     "Use the up and down arrow keys to move the highlight to "
00105                     "your choice.",
00106                     ATTR(UiMenuFgColor, UiMenuBgColor));
00107     UiVtbl.DrawText(0,
00108                     MenuInfo->Bottom + 2,
00109                     "Press ENTER to choose.",
00110                     ATTR(UiMenuFgColor, UiMenuBgColor));
00111 
00112     //
00113     // And offer F8 options
00114     //
00115     UiVtbl.DrawText(0,
00116                     UiScreenHeight - 4,
00117                     "For troubleshooting and advanced startup options for "
00118                     "ReactOS, press F8.",
00119                     ATTR(UiMenuFgColor, UiMenuBgColor));
00120 
00121     //
00122     // Draw the menu box
00123     //
00124     TuiDrawMenuBox(MenuInfo);
00125 
00126     //
00127     // Draw each line of the menu
00128     //
00129     for (i = 0; i < MenuInfo->MenuItemCount; i++) TuiDrawMenuItem(MenuInfo, i);
00130     VideoCopyOffScreenBufferToVRAM();
00131 }
00132 
00133 const UIVTBL MiniTuiVtbl =
00134 {
00135     TuiInitialize,
00136     TuiUnInitialize,
00137     MiniTuiDrawBackdrop,
00138     TuiFillArea,
00139     TuiDrawShadow,
00140     TuiDrawBox,
00141     TuiDrawText,
00142     TuiDrawCenteredText,
00143     MiniTuiDrawStatusText,
00144     TuiUpdateDateTime,
00145     TuiMessageBox,
00146     TuiMessageBoxCritical,
00147     MiniTuiDrawProgressBarCenter,
00148     MiniTuiDrawProgressBar,
00149     TuiEditBox,
00150     TuiTextToColor,
00151     TuiTextToFillStyle,
00152     MiniTuiDrawBackdrop, /* no FadeIn */ 
00153     TuiFadeOut,
00154     TuiDisplayMenu,
00155     MiniTuiDrawMenu,
00156 };
00157 #endif

Generated on Sun May 27 2012 04:19:18 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.