[USETUP] Implement CreateProgressBarEx() (#791)

Improve the progress bar functions:
- Add a member in the struct, which will be used as a bar colour parameter for the new CreateProgressBarEx().
- CreateProgressBar() which will now invoke the Ex variant without the additional parameter.
This commit is contained in:
Bișoc George 2018-08-21 15:49:54 +02:00 committed by Hermès BÉLUSCA - MAÏTO
parent afe5ecb6b7
commit ee6bc66318
2 changed files with 36 additions and 2 deletions

View file

@ -219,7 +219,7 @@ DrawProgressBar(
for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++)
{
FillConsoleOutputAttribute(StdOutput,
FOREGROUND_YELLOW | BACKGROUND_BLUE,
Bar->ProgressColour,
Bar->Width - 2,
coPos,
&Written);
@ -234,7 +234,7 @@ DrawProgressBar(
PPROGRESSBAR
CreateProgressBar(
CreateProgressBarEx(
SHORT Left,
SHORT Top,
SHORT Right,
@ -242,6 +242,7 @@ CreateProgressBar(
SHORT TextTop,
SHORT TextRight,
IN BOOLEAN DoubleEdge,
SHORT ProgressColour,
CHAR *Text)
{
PPROGRESSBAR Bar;
@ -259,6 +260,7 @@ CreateProgressBar(
Bar->TextTop = TextTop;
Bar->TextRight = TextRight;
Bar->Double = DoubleEdge;
Bar->ProgressColour = ProgressColour;
Bar->Text = Text;
Bar->Width = Bar->Right - Bar->Left + 1;
@ -274,6 +276,25 @@ CreateProgressBar(
return Bar;
}
PPROGRESSBAR
CreateProgressBar(
SHORT Left,
SHORT Top,
SHORT Right,
SHORT Bottom,
SHORT TextTop,
SHORT TextRight,
IN BOOLEAN DoubleEdge,
CHAR *Text)
{
/* Call the Ex variant of the function */
return CreateProgressBarEx(Left, Top, Right, Bottom,
TextTop, TextRight,
DoubleEdge,
FOREGROUND_YELLOW | BACKGROUND_BLUE,
Text);
}
VOID
DestroyProgressBar(

View file

@ -44,11 +44,24 @@ typedef struct _PROGRESS
ULONG CurrentStep;
BOOLEAN Double;
SHORT ProgressColour;
CHAR *Text;
} PROGRESSBAR, *PPROGRESSBAR;
/* FUNCTIONS ****************************************************************/
PPROGRESSBAR
CreateProgressBarEx(
SHORT Left,
SHORT Top,
SHORT Right,
SHORT Bottom,
SHORT TextTop,
SHORT TextRight,
IN BOOLEAN DoubleEdge,
SHORT ProgressColour,
CHAR *Text);
PPROGRESSBAR
CreateProgressBar(
SHORT Left,