From e1906e8f45b732d83aca0935c59852c7aa64def9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 17 Jul 2022 18:07:40 +0200 Subject: Make ListView hWnd public. A getter offers encapsulation, but it is also less transparent in a sense. Thinking of ListView as a struct, it is natural to expose hWnd as a public member variable. --- c/datalistview.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'c/datalistview.cpp') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index 6262c41..c83c65f 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -23,17 +23,17 @@ DataListView::DataListView(const HWND hWndParent) lvc.pszText = TEXT("Key"); lvc.cx = Dpi(42); - ListView_InsertColumn(m_hWnd, DLVSIKEY, &lvc); + ListView_InsertColumn(hWnd, DLVSIKEY, &lvc); lvc.iSubItem = DLVSIVALUE; lvc.pszText = TEXT("Value"); lvc.cx = 500; - ListView_InsertColumn(m_hWnd, DLVSIVALUE, &lvc); + ListView_InsertColumn(hWnd, DLVSIVALUE, &lvc); } void DataListView::ShowEpisode(const int iEpisode) { - ListView_DeleteAllItems(m_hWnd); + ListView_DeleteAllItems(hWnd); LVITEM lviKey, lviValue; lviKey.mask = LVIF_TEXT; @@ -55,12 +55,12 @@ void DataListView::ShowEpisode(const int iEpisode) lviKey.iItem = i; lviKey.iSubItem = 0; lviKey.pszText = tszKey; - ListView_InsertItem(m_hWnd, &lviKey); + ListView_InsertItem(hWnd, &lviKey); lviValue.iItem = i; lviValue.iSubItem = 1; lviValue.pszText = tszValue; - ListView_SetItem(m_hWnd, &lviValue); + ListView_SetItem(hWnd, &lviValue); } PL_cut_query(q); @@ -69,7 +69,7 @@ void DataListView::ShowEpisode(const int iEpisode) LVFINDINFO lvfi; lvfi.flags = LVFI_PARAM; lvfi.lParam = iEpisode; - int iItem = ListView_FindItem(g_pElv->Handle(), -1, &lvfi); + int iItem = ListView_FindItem(g_pElv->hWnd, -1, &lvfi); if (iItem != -1) - ListView_EnsureVisible(g_pElv->Handle(), iItem, TRUE); + ListView_EnsureVisible(g_pElv->hWnd, iItem, TRUE); } -- cgit v1.2.3