mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-11-17 23:42:20 +00:00
[idd] helper: detect mode listbox selection change
This commit is contained in:
@@ -74,6 +74,8 @@ LRESULT CConfigWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
RedrawWindow(m_hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
return 0;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
return onCommand(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
|
||||
default:
|
||||
return CWindow::handleMessage(uMsg, wParam, lParam);
|
||||
}
|
||||
@@ -113,3 +115,12 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
|
||||
pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 24);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
|
||||
{
|
||||
if (hwnd == *m_modeBox && code == LBN_SELCHANGE && m_modes)
|
||||
{
|
||||
DEBUG_INFO(L"Selection changed to: %s", (*m_modes)[m_modeBox->getSelData()].toString().c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class CConfigWindow : public CWindow
|
||||
virtual LRESULT onCreate() override;
|
||||
virtual LRESULT onFinal() override;
|
||||
LRESULT onResize(DWORD width, DWORD height);
|
||||
LRESULT onCommand(WORD id, WORD code, HWND hwnd);
|
||||
|
||||
public:
|
||||
CConfigWindow();
|
||||
|
||||
@@ -28,3 +28,13 @@ int CListBox::addItem(const std::wstring &display, LPARAM data)
|
||||
ListBox_SetItemData(m_hwnd, result, data);
|
||||
return result;
|
||||
}
|
||||
|
||||
int CListBox::getSel()
|
||||
{
|
||||
return ListBox_GetCurSel(m_hwnd);
|
||||
}
|
||||
|
||||
int CListBox::getSelData()
|
||||
{
|
||||
return ListBox_GetItemData(m_hwnd, getSel());
|
||||
}
|
||||
|
||||
@@ -8,4 +8,6 @@ public:
|
||||
CListBox(DWORD style, HWND parent);
|
||||
void initStorage(DWORD count, size_t perItem);
|
||||
int addItem(const std::wstring &display, LPARAM data);
|
||||
int getSel();
|
||||
int getSelData();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user