diff options
Diffstat (limited to 'c')
-rw-r--r-- | c/datalistview.cpp | 3 | ||||
-rw-r--r-- | c/datalistview.h | 2 | ||||
-rw-r--r-- | c/episodelistview.cpp | 6 | ||||
-rw-r--r-- | c/episodelistview.h | 2 | ||||
-rw-r--r-- | c/listview.cpp | 7 | ||||
-rw-r--r-- | c/listview.h | 3 | ||||
-rw-r--r-- | c/main.cpp | 4 |
7 files changed, 14 insertions, 13 deletions
diff --git a/c/datalistview.cpp b/c/datalistview.cpp index b730993..2920c0c 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -12,7 +12,8 @@ extern EpisodeListView *g_lpElv; -DataListView::DataListView() : ListView((HMENU)IDC_DATALISTVIEW, LVS_NOCOLUMNHEADER) +DataListView::DataListView(HWND hWndParent) + : ListView(hWndParent, (HMENU)IDC_DATALISTVIEW, LVS_NOCOLUMNHEADER) { LVCOLUMN lvc; diff --git a/c/datalistview.h b/c/datalistview.h index 011f067..7dd0447 100644 --- a/c/datalistview.h +++ b/c/datalistview.h @@ -5,7 +5,7 @@ struct DataListView : public ListView { - DataListView(void); + DataListView(HWND); void ShowEpisode(int); }; diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index a126649..1a41986 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -13,7 +13,8 @@ extern DataListView *g_lpDlv; int CALLBACK ElvSort(LPARAM, LPARAM, LPARAM); -EpisodeListView::EpisodeListView() : ListView((HMENU)IDC_EPISODELISTVIEW, 0) +EpisodeListView::EpisodeListView(HWND hWndParent) + : ListView(hWndParent, (HMENU)IDC_EPISODELISTVIEW, 0) { LVCOLUMN lvc; @@ -129,12 +130,11 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam) } case NM_RCLICK: { - extern HWND g_hWnd; extern HMENU g_hPopupMenu; DWORD dwPos = GetMessagePos(); TrackPopupMenu(g_hPopupMenu, TPM_RIGHTBUTTON, LOWORD(dwPos), HIWORD(dwPos), 0, - g_hWnd, NULL); + m_hWndParent, NULL); break; } } diff --git a/c/episodelistview.h b/c/episodelistview.h index 8befc14..141bf84 100644 --- a/c/episodelistview.h +++ b/c/episodelistview.h @@ -8,7 +8,7 @@ struct EpisodeListView : public ListView { - EpisodeListView(void); + EpisodeListView(HWND); void DoSort(void); void EnsureFocusVisible(void); LRESULT HandleNotify(LPARAM); diff --git a/c/listview.cpp b/c/listview.cpp index 4e9d754..0f4cbc1 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -7,20 +7,19 @@ #include "main.h" extern HFONT g_hfNormal; -extern HWND g_hWnd; static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -ListView::ListView(HMENU hMenu, DWORD dwStyle) +ListView::ListView(HWND hWndParent, HMENU hMenu, DWORD dwStyle) { + m_hWndParent = hWndParent; m_bHeader = !(dwStyle & LVS_NOCOLUMNHEADER); - m_hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, WC_LISTVIEW, TEXT(""), dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, 0, 0, 0, 0, - g_hWnd, hMenu, GetModuleHandle(NULL), this + m_hWndParent, hMenu, GetModuleHandle(NULL), this ); if (SetProp(m_hWnd, TEXT("this"), (HANDLE)this)) diff --git a/c/listview.h b/c/listview.h index 369c4ec..cf5dc26 100644 --- a/c/listview.h +++ b/c/listview.h @@ -5,7 +5,7 @@ struct ListView { - ListView(HMENU, DWORD); + ListView(HWND, HMENU, DWORD); int Height(int = -1); HWND HWnd(void) const; virtual void UpdateTheme(BOOL); @@ -14,6 +14,7 @@ protected: int m_bHeader = 1; WNDPROC m_prevProc; HWND m_hWnd; + HWND m_hWndParent; }; #endif @@ -169,8 +169,8 @@ static LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam) g_iDPI = GetDpiForWindow(g_hWnd); /* Create child windows. */ - g_lpDlv = new DataListView; - g_lpElv = new EpisodeListView; + g_lpDlv = new DataListView(g_hWnd); + g_lpElv = new EpisodeListView(g_hWnd); /* Get saved view settings. */ char *sz; |