mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-12-02 22:28:14 +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);
|
RedrawWindow(m_hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case WM_COMMAND:
|
||||||
|
return onCommand(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
|
||||||
default:
|
default:
|
||||||
return CWindow::handleMessage(uMsg, wParam, lParam);
|
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);
|
pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 24);
|
||||||
return 0;
|
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 onCreate() override;
|
||||||
virtual LRESULT onFinal() override;
|
virtual LRESULT onFinal() override;
|
||||||
LRESULT onResize(DWORD width, DWORD height);
|
LRESULT onResize(DWORD width, DWORD height);
|
||||||
|
LRESULT onCommand(WORD id, WORD code, HWND hwnd);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CConfigWindow();
|
CConfigWindow();
|
||||||
|
|||||||
@@ -28,3 +28,13 @@ int CListBox::addItem(const std::wstring &display, LPARAM data)
|
|||||||
ListBox_SetItemData(m_hwnd, result, data);
|
ListBox_SetItemData(m_hwnd, result, data);
|
||||||
return result;
|
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);
|
CListBox(DWORD style, HWND parent);
|
||||||
void initStorage(DWORD count, size_t perItem);
|
void initStorage(DWORD count, size_t perItem);
|
||||||
int addItem(const std::wstring &display, LPARAM data);
|
int addItem(const std::wstring &display, LPARAM data);
|
||||||
|
int getSel();
|
||||||
|
int getSelData();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user