From ae3225a4e7ef86d159fdf27834c453ffcd4da76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 2 Aug 2022 20:10:35 +0200 Subject: Implement draggable split. Next step is to allow a double click to reset the split to be automatically resized. --- c/listview.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index 6dfa888..b10ae88 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -4,7 +4,7 @@ #include "common.h" #include "listview.h" -#include "main.h" +#include "layout.h" extern HFONT g_hfNormal; static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); @@ -25,7 +25,7 @@ ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle m_proc0 = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)::WndProc); - ListView_SetExtendedListViewStyle(hWnd, LVS_EX_FULLROWSELECT); + ListView_SetExtendedListViewStyle(hWnd, LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER); SendMessage(hWnd, WM_SETFONT, (WPARAM)g_hfNormal, MAKELPARAM(FALSE, 0)); } @@ -50,18 +50,15 @@ void ListView::ResizeColumns(int) {} void ListView::UpdateTheme(const BOOL bThemeActive) { - DWORD dwStyle; const wchar_t* theme; WORD action; extern int g_bThemes; if (!g_bThemes) return; if (bThemeActive) { - dwStyle = LVS_EX_DOUBLEBUFFER; theme = L"Explorer"; action = UIS_SET; } else { - dwStyle = 0; theme = NULL; action = UIS_CLEAR; } @@ -69,9 +66,6 @@ void ListView::UpdateTheme(const BOOL bThemeActive) /* Use modern "Explorer" theme. */ SetWindowTheme(hWnd, theme, NULL); - /* The modern theme requires double buffering. */ - ListView_SetExtendedListViewStyleEx(hWnd, LVS_EX_DOUBLEBUFFER, dwStyle); - /* Hide focus rectangles. */ SendMessage(hWnd, WM_UPDATEUISTATE, MAKEWPARAM(action, UISF_HIDEFOCUS), 0); } @@ -79,6 +73,7 @@ void ListView::UpdateTheme(const BOOL bThemeActive) LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { + extern Dragger g_dragDlv; switch (uMsg) { case WM_NOTIFY: switch (((NMHDR*)lParam)->code) { @@ -87,6 +82,11 @@ LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, return TRUE; } break; + case WM_LBUTTONDOWN: + case WM_NCLBUTTONDOWN: + if (g_dragDlv.HandleDown()) + return 0; + break; } return CallWindowProc(m_proc0, hWnd, uMsg, wParam, lParam); -- cgit v1.2.3