diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-02 02:11:49 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-02 02:14:11 +0200 |
commit | 90c7bc237c9cf964c16f0cb48c308a92a8193a5c (patch) | |
tree | 53f165056dffa061a9dfe39b76913edab87056f4 /c/listview.cpp | |
parent | bb9280267bfb78a8d69adea02f5ed7894833b19d (diff) | |
download | EpisodeBrowser-90c7bc237c9cf964c16f0cb48c308a92a8193a5c.tar.gz |
Use global Window object.
This makes it easier to control initialization and maintain RAII.
Diffstat (limited to 'c/listview.cpp')
-rw-r--r-- | c/listview.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/c/listview.cpp b/c/listview.cpp index 41f68a7..6074707 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -3,24 +3,24 @@ #include "listview.h" #include "layout.h" +#include "main.h" #include "win.h" /* Actual window procedure for all list views, which calls the * appropriate WndProc member function. */ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle) +ListView::ListView(Window& parent, const HMENU hMenu, const DWORD dwStyle) : parent(parent) { extern HFONT g_hfNormal; - m_hWndParent = hWndParent; hWnd = Require(CreateWindowExW( WS_EX_CLIENTEDGE, WC_LISTVIEW, L"", dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, 0, 0, 0, 0, - hWndParent, hMenu, GetModuleHandle(nullptr), this)); + parent.hWnd, hMenu, GetModuleHandle(nullptr), this)); m_proc0 = reinterpret_cast<WNDPROC>(SetWindowLongPtr( hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(::WndProc))); @@ -41,7 +41,7 @@ void ListView::UpdateTheme(const bool bThemeActive) { const wchar_t* theme; WORD action; - extern BOOL (*SetWindowTheme)(HWND, const wchar_t*, const wchar_t*); + extern HRESULT (__stdcall *SetWindowTheme)(HWND, const wchar_t*, const wchar_t*); if (!SetWindowTheme) return; if (bThemeActive) { @@ -62,7 +62,6 @@ void ListView::UpdateTheme(const bool bThemeActive) LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { - extern DlvDragger g_dragDlv; switch (uMsg) { case WM_NOTIFY: switch (reinterpret_cast<NMHDR*>(lParam)->code) { @@ -73,7 +72,7 @@ LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, break; case WM_LBUTTONDOWN: case WM_NCLBUTTONDOWN: - if (g_dragDlv.HandleLButtonDown()) + if (parent.dragDlv.HandleLButtonDown()) return 0; break; } |