[idd] helper: add mode edit labels

This commit is contained in:
Quantum
2025-10-04 03:12:22 -04:00
committed by Geoffrey McRae
parent 1d7cb35de8
commit 569619384c
3 changed files with 21 additions and 2 deletions

View File

@@ -53,7 +53,9 @@ void CConfigWindow::updateFont()
return; return;
} }
for (HWND child : std::initializer_list<HWND>({ *m_version, *m_modeGroup, *m_modeBox })) for (HWND child : std::initializer_list<HWND>({
*m_version, *m_modeGroup, *m_modeBox, *m_widthLabel, *m_heightLabel, *m_refreshLabel,
}))
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1); SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
} }
@@ -95,6 +97,11 @@ LRESULT CConfigWindow::onCreate()
for (size_t i = 0; i < modes.size(); ++i) for (size_t i = 0; i < modes.size(); ++i)
m_modeBox->addItem(modes[i].toString(), i); m_modeBox->addItem(modes[i].toString(), i);
} }
m_widthLabel.reset(new CStaticWidget(L"Width:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
m_heightLabel.reset(new CStaticWidget(L"Height:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
m_refreshLabel.reset(new CStaticWidget(L"Refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
updateFont(); updateFont();
return 0; return 0;
@@ -112,7 +119,10 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
WidgetPositioner pos(m_scale, width, height); WidgetPositioner pos(m_scale, width, height);
pos.pinTopLeftRight(*m_version, 12, 12, 12, 20); pos.pinTopLeftRight(*m_version, 12, 12, 12, 20);
pos.pinLeftTopBottom(*m_modeGroup, 12, 40, 200, 12); pos.pinLeftTopBottom(*m_modeGroup, 12, 40, 200, 12);
pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 24); pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 96);
pos.pinBottomLeft(*m_widthLabel, 24, 72, 50, 20);
pos.pinBottomLeft(*m_heightLabel, 24, 48, 50, 20);
pos.pinBottomLeft(*m_refreshLabel, 24, 24, 50, 20);
return 0; return 0;
} }

View File

@@ -19,6 +19,10 @@ class CConfigWindow : public CWindow
std::unique_ptr<CGroupBox> m_modeGroup; std::unique_ptr<CGroupBox> m_modeGroup;
std::unique_ptr<CListBox> m_modeBox; std::unique_ptr<CListBox> m_modeBox;
std::unique_ptr<CStaticWidget> m_widthLabel;
std::unique_ptr<CStaticWidget> m_heightLabel;
std::unique_ptr<CStaticWidget> m_refreshLabel;
std::function<void()> m_onDestroy; std::function<void()> m_onDestroy;
double m_scale; double m_scale;
Microsoft::WRL::Wrappers::HandleT<FontTraits> m_font; Microsoft::WRL::Wrappers::HandleT<FontTraits> m_font;

View File

@@ -44,4 +44,9 @@ public:
{ {
move(child, scale(x), scale(y), scale(cx), height - scale(y + by)); move(child, scale(x), scale(y), scale(cx), height - scale(y + by));
} }
void pinBottomLeft(HWND child, int x, int by, int cx, int cy)
{
move(child, scale(x), height - scale(by + cy), scale(cx), scale(cy));
}
}; };