aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-04-28 02:40:53 +0300
committerJoursoir <chat@joursoir.net>2022-04-28 02:40:53 +0300
commited16f7bcc206125924de6dbe20ebed723459962b (patch)
tree6d7dfd5b4e0ac96bc579024d45ffedfb3d56f223
parent57d79ef9a6febfcf913e3c6d67796c278a1b3e2d (diff)
downloadumt-ed16f7bcc206125924de6dbe20ebed723459962b.tar.gz
umt-ed16f7bcc206125924de6dbe20ebed723459962b.tar.bz2
umt-ed16f7bcc206125924de6dbe20ebed723459962b.zip
main menu: implement initialization
-rw-r--r--UefiMonitorTest/MainMenu.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/UefiMonitorTest/MainMenu.c b/UefiMonitorTest/MainMenu.c
index 13b5915..c271e0d 100644
--- a/UefiMonitorTest/MainMenu.c
+++ b/UefiMonitorTest/MainMenu.c
@@ -1,10 +1,72 @@
+#include <Library/HiiLib.h>
+
#include "MainMenu.h"
+#define INDENT 15
+#define CHAR_PER_COLUMN 24
+#define RECT_HALF_WIDTH 300
+#define RECT_HALF_HEIGHT 130
+
VOID
MainMenuInit (
IN UMT_CONTEXT *Ctx
)
{
+ GRAPHICS_CONTEXT *Graphics;
+ UINT32 Width;
+ UINT32 Height;
+ UINTN FontHeight;
+ UINTN FontWidth;
+ UINTN LeftColX;
+ UINTN MiddleColX;
+ UINTN RightColX;
+ UINTN Y;
+
+ Graphics = Ctx->Graphics;
+ Width = Graphics->Width;
+ Height = Graphics->Height;
+ GetFontParameters (Graphics, &FontWidth, &FontHeight);
+ LeftColX = (Width - (CHAR_PER_COLUMN * 3) * FontWidth) / 2;
+ MiddleColX = LeftColX + (CHAR_PER_COLUMN * FontWidth);
+ RightColX = MiddleColX + (CHAR_PER_COLUMN * FontWidth);
+
+ // Background
+ PutRect (Graphics, 0, 0, Width, Height, &gUmtColors[UMT_COLOR_NAVY]);
+ DrawHiiStringF (Graphics,
+ (Width - 24 * FontWidth) / 2,
+ Height / 2 - RECT_HALF_HEIGHT - (INDENT * 2),
+ &gUmtColors[UMT_COLOR_WHITE],
+ STRING_TOKEN (STR_MM_TITLE), gUmtHiiHandle, UMT_VERSION);
+
+ // Menu
+ DrawRoundedRect (Graphics,
+ Width / 2 - RECT_HALF_WIDTH,
+ Height / 2 - RECT_HALF_HEIGHT,
+ Width / 2 + RECT_HALF_WIDTH,
+ Height / 2 + RECT_HALF_HEIGHT,
+ 20,
+ &gUmtColors[UMT_COLOR_WHITE]
+ );
+
+ Y = Height / 2 - RECT_HALF_HEIGHT + INDENT + 5;
+ DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ STRING_TOKEN (STR_MM_SUBTITLE), gUmtHiiHandle);
+
+ Y += FontHeight + INDENT;
+ DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ STRING_TOKEN (STR_MM_MENU), gUmtHiiHandle);
+
+ Y += (FontHeight * 4) + (INDENT * 2);
+ DrawHiiStringF (Graphics, (Width - 9 * FontWidth) / 2, Y, &gUmtColors[UMT_COLOR_BLACK],
+ STRING_TOKEN (STR_MM_TIP_TITLE), gUmtHiiHandle);
+
+ Y += FontHeight + INDENT;
+ DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ STRING_TOKEN (STR_MM_TIP_FIRST), gUmtHiiHandle);
+ DrawHiiStringF (Graphics, MiddleColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ STRING_TOKEN (STR_MM_TIP_SECOND), gUmtHiiHandle);
+ DrawHiiStringF (Graphics, RightColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ STRING_TOKEN (STR_MM_TIP_THIRD), gUmtHiiHandle);
}