VOID UiDrawProgressBar(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN ULONG Position, IN ULONG Range, IN PCHAR ProgressText) { ULONG i, ProgressBarWidth; /* Calculate the width of the bar proper */ ProgressBarWidth = (Right - Left) - 3; /* First make sure the progress bar text fits */ UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4); if (Position > Range) Position = Range; /* Draw the "Loading..." text */ UiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(7, 0)); /* Draw the percent complete */ for (i = 0; i < (Position * ProgressBarWidth) / Range; i++) { /* Use the fill character */ UiDrawText(Left + 2 + i, Top + 2, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); } }
VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) { ULONG i; ULONG ProgressBarWidth = (Right - Left) - 4; // First make sure the progress bar text fits UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4); if (Position > Range) { Position = Range; } // // Draw the "Loading..." text // TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(7, 0)); // Draw the percent complete for (i=0; i<(Position*ProgressBarWidth)/Range; i++) { TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); } TuiUpdateDateTime(); VideoCopyOffScreenBufferToVRAM(); }