Dim loader buttons while installing

This commit is contained in:
paravis committed 2026-11-08 22:15:09 +03:00
1 parent d8f4cb691b
commit c9f01a52c1
4 files changed
+43 -10

No files matched your search

+36 -10
View File
@@ -18,6 +18,12 @@ const DWORD CLR_BORDER = 0xBFC9D6;
const DWORD CLR_HOVER = 0xE4EEFF;
const DWORD CLR_PRESS = 0xCFE0FF;
const DWORD CLR_TEXT = 0x14202E;
const DWORD CLR_BUSY_BG = 0xE9ECF1;
const DWORD CLR_BUSY_BORDER = 0xD5DAE2;
const DWORD CLR_BUSY_TEXT = 0xA7AEBA;
const DWORD CLR_ACTIVE_BG = 0xD8E4F8;
const DWORD CLR_ACTIVE_BORDER = 0x9BB8E8;
const DWORD CLR_ACTIVE_TEXT = 0x2E4A78;
const wchar_t* kButtonNames[7] = {
L"XorBoot", L"Bootmgr", L"Grub4Dos", L"Grub2",
@@ -239,11 +245,25 @@ void App::Paint(HDC dc)
int bw = kButtonPos[i][2];
int bh = kButtonPos[i][3];
FillRectColor(memory, x - 1, y - 1, bw + 2, bh + 2,
ColorFromHex(CLR_BORDER));
FillRectColor(memory, x, y, bw, bh, buttonBg[i]);
COLORREF background = buttonBg[i];
COLORREF border = ColorFromHex(CLR_BORDER);
COLORREF text = ColorFromHex(CLR_TEXT);
if (busy) {
if (i == activeButton) {
background = ColorFromHex(CLR_ACTIVE_BG);
border = ColorFromHex(CLR_ACTIVE_BORDER);
text = ColorFromHex(CLR_ACTIVE_TEXT);
} else {
background = ColorFromHex(CLR_BUSY_BG);
border = ColorFromHex(CLR_BUSY_BORDER);
text = ColorFromHex(CLR_BUSY_TEXT);
}
}
FillRectColor(memory, x - 1, y - 1, bw + 2, bh + 2, border);
FillRectColor(memory, x, y, bw, bh, background);
DrawTextRect(memory, kButtonNames[i], fontButton, x, y, bw, bh,
ColorFromHex(CLR_TEXT), DT_CENTER | DT_VCENTER);
text, DT_CENTER | DT_VCENTER);
}
BitBlt(dc, 0, 0, w, h, memory, 0, 0, SRCCOPY);
@@ -265,6 +285,18 @@ void App::OnPoll()
ScreenToClient(hwnd, &client);
HitResult hit = HitTest(client);
if (busy) {
downButton = -1;
for (int i = 0; i < 7; ++i) {
buttonBg[i] = (i == activeButton) ? ColorFromHex(CLR_ACTIVE_BG)
: ColorFromHex(CLR_BUSY_BG);
}
minBg = ColorFromHex(CLR_HEAD);
closeBg = ColorFromHex(CLR_HEAD);
InvalidateRect(hwnd, nullptr, FALSE);
return;
}
COLORREF minColor = ColorFromHex(CLR_HEAD);
COLORREF closeColor = ColorFromHex(CLR_HEAD);
if (hit.kind == HitKind::Min) {
@@ -324,12 +356,6 @@ void App::OnPoll()
buttonBg[i] = background;
}
if (busy) {
downButton = -1;
InvalidateRect(hwnd, nullptr, FALSE);
return;
}
if (leftDown) {
if (hit.kind == HitKind::Button) {
downButton = hit.index;