Skip to content

Commit 70da98c

Browse files
quantum5gnif
authored andcommitted
[idd] helper: implement UI for default refresh rate
The UI is not yet hooked up to anything.
1 parent ed1602f commit 70da98c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

idd/LGIddHelper/CConfigWindow.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void CConfigWindow::updateFont()
5858
for (HWND child : std::initializer_list<HWND>({
5959
*m_version, *m_modeGroup, *m_modeBox, *m_widthLabel, *m_heightLabel, *m_refreshLabel,
6060
*m_modeWidth, *m_modeHeight, *m_modeRefresh, *m_modeUpdate, *m_modeDelete,
61+
*m_autosizeGroup, *m_defRefreshLabel, *m_defRefresh, *m_defRefreshHz,
6162
}))
6263
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
6364
}
@@ -119,6 +120,15 @@ LRESULT CConfigWindow::onCreate()
119120
EnableWindow(*m_modeUpdate, FALSE);
120121
EnableWindow(*m_modeDelete, FALSE);
121122

123+
m_autosizeGroup.reset(new CGroupBox(L"Autosizing", WS_CHILD | WS_VISIBLE, m_hwnd));
124+
m_defRefreshLabel.reset(new CStaticWidget(L"Default refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
125+
m_defRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
126+
m_defRefreshHz.reset(new CStaticWidget(L"Hz", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
127+
128+
RECT client = { 0, 0, (LONG)(436 * m_scale), (LONG)(300 * m_scale) };
129+
AdjustWindowRect(&client, WS_OVERLAPPEDWINDOW, FALSE);
130+
SetWindowPos(m_hwnd, NULL, 0, 0, client.right - client.left, client.bottom - client.top, SWP_NOMOVE | SWP_NOZORDER);
131+
122132
updateFont();
123133

124134
return 0;
@@ -135,6 +145,7 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
135145
{
136146
WidgetPositioner pos(m_scale, width, height);
137147
pos.pinTopLeftRight(*m_version, 12, 12, 12, 20);
148+
138149
pos.pinLeftTopBottom(*m_modeGroup, 12, 40, 200, 12);
139150
pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 120);
140151
pos.pinBottomLeft(*m_widthLabel, 24, 96, 50, 20);
@@ -145,6 +156,11 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
145156
pos.pinBottomLeft(*m_modeRefresh, 75, 48, 50, 20);
146157
pos.pinBottomLeft(*m_modeUpdate, 24, 20, 50, 24);
147158
pos.pinBottomLeft(*m_modeDelete, 75, 20, 50, 24);
159+
160+
pos.pinTopLeft(*m_autosizeGroup, 224, 40, 200, 52);
161+
pos.pinTopLeft(*m_defRefreshLabel, 236, 64, 95, 20);
162+
pos.pinTopLeft(*m_defRefresh, 331, 64, 63, 20);
163+
pos.pinTopLeft(*m_defRefreshHz, 398, 64, 16, 20);
148164
return 0;
149165
}
150166

idd/LGIddHelper/CConfigWindow.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ class CConfigWindow : public CWindow
3232
std::unique_ptr<CButton> m_modeUpdate;
3333
std::unique_ptr<CButton> m_modeDelete;
3434

35+
std::unique_ptr<CGroupBox> m_autosizeGroup;
36+
std::unique_ptr<CStaticWidget> m_defRefreshLabel;
37+
std::unique_ptr<CEditWidget> m_defRefresh;
38+
std::unique_ptr<CStaticWidget> m_defRefreshHz;
39+
3540
std::function<void()> m_onDestroy;
3641
double m_scale;
3742
Microsoft::WRL::Wrappers::HandleT<FontTraits> m_font;

0 commit comments

Comments
 (0)