diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-11 00:04:35 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-11 00:04:35 +0200 |
commit | ca56ce2c32b4479af32bf7fb5d065ee9a3a45d8a (patch) | |
tree | 50699f37a3ab7ded0faca02b2783132042f65844 /c/episodelistview.cpp | |
parent | 295d423cc47f9ee8a72134dc544892a03b279311 (diff) | |
download | EpisodeBrowser-ca56ce2c32b4479af32bf7fb5d065ee9a3a45d8a.tar.gz |
Refactor, adjust minimum window size.
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r-- | c/episodelistview.cpp | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 8fb3ec7..7c79043 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -155,6 +155,16 @@ EpisodeListView::Redraw() } void +EpisodeListView::SaveFocus() +{ + LVITEM lvi; + lvi.mask = LVIF_PARAM; + if ((lvi.iItem = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED)) != -1 + && ListView_GetItem(m_hWnd, &lvi)) + Pl("cfg","set_focus","I",lvi.lParam); +} + +void EpisodeListView::SetTop(int iItem) { int iLast; @@ -165,7 +175,7 @@ EpisodeListView::SetTop(int iItem) /* Select previously focused episode. */ void -EpisodeListView::SelectFocus() +EpisodeListView::RestoreFocus() { int i, iEpisode, iItem; LVFINDINFO lvfi; @@ -388,6 +398,30 @@ r: if (!Pl("episode_data","episode_rating","Ii",lpLvi->lParam,&iRating)) { f: if (tszName) free(tszName); } +LRESULT CALLBACK +EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) { + case WM_GETDLGCODE: + { + LRESULT lResult; + + /* For the episode list view, the Enter key should not + * be handled by the dialog manager, but instead be sent + * along to the main window procedure, so that it may be + * handled by the NM_RETURN case in ElvHandleNotify. */ + + lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam); + if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN + && ((MSG *)lParam)->wParam == VK_RETURN) + return DLGC_WANTMESSAGE; + return lResult; + } + } + + return ListView::WndProc(hWnd, uMsg, wParam, lParam); +} + /* Sort list view items, iSort being the 1-based index of the column * to sort by. If iSort is negative, the order is descending. */ int CALLBACK @@ -434,27 +468,3 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort) return 0; } } - -LRESULT CALLBACK -EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uMsg) { - case WM_GETDLGCODE: - { - LRESULT lResult; - - /* For the episode list view, the Enter key should not - * be handled by the dialog manager, but instead be sent - * along to the main window procedure, so that it may be - * handled by the NM_RETURN case in ElvHandleNotify. */ - - lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam); - if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN - && ((MSG *)lParam)->wParam == VK_RETURN) - return DLGC_WANTMESSAGE; - return lResult; - } - } - - return ListView::WndProc(hWnd, uMsg, wParam, lParam); -} |