aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-17 18:07:40 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-17 18:07:40 +0200
commite1906e8f45b732d83aca0935c59852c7aa64def9 (patch)
tree9456f5629d68c1bae7251cb44e2b01cd49532565 /c/main.cpp
parentbb22bc506676fd268ded3b3d6c7b7acea5dc2db9 (diff)
downloadEpisodeBrowser-e1906e8f45b732d83aca0935c59852c7aa64def9.tar.gz
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.
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 1950295..ddfd490 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -181,7 +181,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
{
UpdateTheme();
SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOMOVE);
- SetFocus(g_pElv->Handle());
+ SetFocus(g_pElv->hWnd);
/* Set menu item checkmarks according to saved settings. */
CheckMenuItem(GetMenu(hWnd), IDM_VIEW_WATCHED,
@@ -317,13 +317,13 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
MF_CHECKED);
g_szLimitScreenwriter[0] = 0;
} else {
- const int iEpFocus = ListView_GetNextItem(g_pElv->Handle(), -1, LVNI_FOCUSED);
+ const int iEpFocus = ListView_GetNextItem(g_pElv->hWnd, -1, LVNI_FOCUSED);
if (iEpFocus == -1) break;
LVITEM lvi;
lvi.iItem = iEpFocus;
lvi.mask = LVIF_PARAM;
- if (!ListView_GetItem(g_pElv->Handle(), &lvi)) break;
+ if (!ListView_GetItem(g_pElv->hWnd, &lvi)) break;
char* sz;
if (!Pl("episode_data","episode_datum",lvi.lParam,"Screenwriter",&sz))
@@ -364,8 +364,8 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
lvi.mask = LVIF_PARAM;
lvi.iItem = -1;
while ((lvi.iItem = ListView_GetNextItem(
- g_pElv->Handle(), lvi.iItem, LVNI_SELECTED)) != -1) {
- if (!ListView_GetItem(g_pElv->Handle(), &lvi)) goto b;
+ g_pElv->hWnd, lvi.iItem, LVNI_SELECTED)) != -1) {
+ if (!ListView_GetItem(g_pElv->hWnd, &lvi)) goto b;
switch (LOWORD(wParam)) {
case IDM_WATCH_LOCALLY:
@@ -503,24 +503,24 @@ void UpdateLayout()
yStatus = rcStatus.bottom-rcStatus.top;
/* Resize data list view. */
- SendMessage(g_pDlv->Handle(), WM_SETREDRAW, FALSE, 0);
- SendMessage(g_pElv->Handle(), WM_SETREDRAW, FALSE, 0);
+ SendMessage(g_pDlv->hWnd, WM_SETREDRAW, FALSE, 0);
+ SendMessage(g_pElv->hWnd, WM_SETREDRAW, FALSE, 0);
cyDlv = rc.bottom-yStatus-g_pDlv->Height();
- MoveWindow(g_pDlv->Handle(), 0, cyDlv, rc.right, rc.bottom-yStatus-cyDlv, TRUE);
- ListView_SetColumnWidth(g_pDlv->Handle(), DLVSIKEY, LVSCW_AUTOSIZE);
- cxColumn = ListView_GetColumnWidth(g_pDlv->Handle(), 0)+4;
- ListView_SetColumnWidth(g_pDlv->Handle(), DLVSIKEY, cxColumn);
- ListView_SetColumnWidth(g_pDlv->Handle(), DLVSIVALUE, rc.right-cxColumn-g_cxVScroll-4);
+ MoveWindow(g_pDlv->hWnd, 0, cyDlv, rc.right, rc.bottom-yStatus-cyDlv, TRUE);
+ ListView_SetColumnWidth(g_pDlv->hWnd, DLVSIKEY, LVSCW_AUTOSIZE);
+ cxColumn = ListView_GetColumnWidth(g_pDlv->hWnd, 0)+4;
+ ListView_SetColumnWidth(g_pDlv->hWnd, DLVSIKEY, cxColumn);
+ ListView_SetColumnWidth(g_pDlv->hWnd, DLVSIVALUE, rc.right-cxColumn-g_cxVScroll-4);
/* Resize episode list view. */
- MoveWindow(g_pElv->Handle(), 0, 0, rc.right, cyDlv+1, TRUE);
- ListView_SetColumnWidth(g_pElv->Handle(), ELVSIEPISODE, LVSCW_AUTOSIZE);
- cxColumn = ListView_GetColumnWidth(g_pElv->Handle(), ELVSIEPISODE)+4;
- ListView_SetColumnWidth(g_pElv->Handle(), ELVSIEPISODE, cxColumn);
- cxColumn += ListView_GetColumnWidth(g_pElv->Handle(), ELVSIRATING);
- ListView_SetColumnWidth(g_pElv->Handle(), ELVSITITLE, rc.right-cxColumn-g_cxVScroll-4);
- SendMessage(g_pElv->Handle(), WM_SETREDRAW, TRUE, 0);
- SendMessage(g_pDlv->Handle(), WM_SETREDRAW, TRUE, 0);
+ MoveWindow(g_pElv->hWnd, 0, 0, rc.right, cyDlv+1, TRUE);
+ ListView_SetColumnWidth(g_pElv->hWnd, ELVSIEPISODE, LVSCW_AUTOSIZE);
+ cxColumn = ListView_GetColumnWidth(g_pElv->hWnd, ELVSIEPISODE)+4;
+ ListView_SetColumnWidth(g_pElv->hWnd, ELVSIEPISODE, cxColumn);
+ cxColumn += ListView_GetColumnWidth(g_pElv->hWnd, ELVSIRATING);
+ ListView_SetColumnWidth(g_pElv->hWnd, ELVSITITLE, rc.right-cxColumn-g_cxVScroll-4);
+ SendMessage(g_pElv->hWnd, WM_SETREDRAW, TRUE, 0);
+ SendMessage(g_pDlv->hWnd, WM_SETREDRAW, TRUE, 0);
/* Resize status bar parts. */
const int aParts[] = {rc.right-Dpi(55), rc.right};