aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest/tests/SolidColors.c
blob: 14fe23ba15c52f68ad688937657a4e024a3cb09b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include <Library/DebugLib.h>
#include <Library/HiiLib.h>
#include <Library/MemoryAllocationLib.h>

#include "SolidColors.h"

STATIC enum UMT_COLORS CurrentColor = 0;

VOID
SolidColorsTestInit (
  IN UMT_CONTEXT *Ctx
  )
{
  GRAPHICS_CONTEXT *Graphics = Ctx->Graphics;

  PutRect (Graphics, 0, 0, Graphics->Width, Graphics->Height, &gUmtColors[CurrentColor]);
  if (Ctx->ShowTip)
    SolidColorsTestTip (Ctx);
} 

VOID
SolidColorsTestDoit (
  IN UMT_CONTEXT *Ctx
  )
{

}

VOID
SolidColorsTestTip (
  IN UMT_CONTEXT *Ctx
  )
{
  GRAPHICS_CONTEXT *Graphics;
  EFI_STRING_ID     TitleToken;
  EFI_STRING_ID     MsgToken;
  CHAR16            *Title;
  CHAR16            *Msg;

  Graphics = Ctx->Graphics;

  if (Ctx->ShowTip == FALSE) {
    // Restore
    PutRect (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15, &gUmtColors[CurrentColor]);
    return;
  }

  // TODO: or use CatSPrint()?
  switch (CurrentColor) {
    case UMT_COLOR_BLACK:
      TitleToken = STRING_TOKEN (STR_SOLID_COLORS_BLACK_TITLE);
      MsgToken = STRING_TOKEN (STR_SOLID_COLORS_BLACK_MSG);
      break;
    case UMT_COLOR_WHITE:
      TitleToken = STRING_TOKEN (STR_SOLID_COLORS_WHITE_TITLE);
      MsgToken = STRING_TOKEN (STR_SOLID_COLORS_WHITE_MSG);
      break;
    case UMT_COLOR_RED:
      TitleToken = STRING_TOKEN (STR_SOLID_COLORS_RED_TITLE);
      MsgToken = STRING_TOKEN (STR_SOLID_COLORS_RED_MSG);
      break;
    case UMT_COLOR_LIME:
      TitleToken = STRING_TOKEN (STR_SOLID_COLORS_GREEN_TITLE);
      MsgToken = STRING_TOKEN (STR_SOLID_COLORS_GREEN_MSG);
      break;
    case UMT_COLOR_BLUE:
      TitleToken = STRING_TOKEN (STR_SOLID_COLORS_BLUE_TITLE);
      MsgToken = STRING_TOKEN (STR_SOLID_COLORS_BLUE_MSG);
      break;
    default:
      ASSERT (FALSE);
      break;
  }

  Title = HiiGetString (gUmtHiiHandle, TitleToken, NULL);
  Msg = HiiGetString (gUmtHiiHandle, MsgToken, NULL);

  DrawRectWithBorder (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15,
    3, &gUmtColors[UMT_COLOR_WHITE], &gUmtColors[UMT_COLOR_NAVY]);
  DrawStringF (Graphics, 25, Graphics->Height - 15 - 94, &gUmtColors[UMT_COLOR_NAVY], Title);
  DrawStringF (Graphics, 25, Graphics->Height - 15 - 74, &gUmtColors[UMT_COLOR_BLACK], Msg);

  FreePool (Title);
  FreePool (Msg);
}

VOID
SolidColorsTestChangeValue (
  IN  UMT_CONTEXT *Ctx,
  IN  INT8        ValueStep
  )
{
  if (CurrentColor == 0 && ValueStep < 0)
    CurrentColor = UMT_COLOR_BLUE;
  else {
    CurrentColor += ValueStep;
    if (CurrentColor >= UMT_COLOR_BLUE)
      CurrentColor = 0;
  }

  SolidColorsTestInit (Ctx);
}

VOID
SolidColorsTestChangeParam (
  IN  UMT_CONTEXT *Ctx,
  IN  INT8        ParamStep
  )
{
  
}

VOID
SolidColorsTestChangeVar (
  IN  UMT_CONTEXT *Ctx,
  IN  INT8        VariableStep // -1, +1
  )
{

}