Skip to content

Commit 6ba57ee

Browse files
Implement themed rendering for ListView and Header with hover effects
- ThemeRenderer: Added subclassing and themed rendering for WC_LISTVIEW and WC_HEADER. - ThemeRenderer: Implemented dark mode header painting with manual GDI calls (background, text, separators, sort arrows). - ThemeRenderer: Added hover support for header items and list items using primary_bg. - ThemeRenderer: Configured non-blocking NM_CUSTOMDRAW handling to allow component-specific drawing. - FileList: Maintained specific logic for underlining open files and parent icons, updated for dialog compatibility. - Consistent theme and dark scrollbar application for TreeView and ListView. Co-authored-by: funap <31555185+funap@users.noreply.github.com>
1 parent c24cbdc commit 6ba57ee

4 files changed

Lines changed: 2 additions & 7 deletions

File tree

src/Explorer/Explorer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ void UpdateThemeColor()
303303
.primary = editorColors.text,
304304
.primary_bg = editorColors.hotBackground,
305305
.primary_border = editorColors.hotEdge,
306-
.hover_bg = editorColors.hotBackground,
307306
};
308307
auto isDarkMode = IsDarkColor(colors.body_bg);
309308
ThemeRenderer::Instance().SetTheme(isDarkMode, colors);

src/Explorer/FileList.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static const WORD DotPattern[] =
4646
};
4747

4848
#include "FileSystemService.h"
49-
#include "ThemeRenderer.h"
5049

5150

5251
class FileList : public Window, public CIDropTarget

src/Explorer/ThemeRenderer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ void ThemeRenderer::SetTheme(BOOL isDarkMode, const ThemeColors& colors)
115115
m_brushes.primary.CreateSolidBrush(colors.primary);
116116
m_brushes.primary_bg.CreateSolidBrush(colors.primary_bg);
117117
m_brushes.primary_border.CreateSolidBrush(colors.primary_border);
118-
m_brushes.hover_bg.CreateSolidBrush(colors.hover_bg);
119118

120119
for (const auto& hwnd : m_windows) {
121120
ApplyTheme(hwnd);
@@ -244,7 +243,7 @@ LRESULT ThemeRenderer::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
244243
}
245244
else if (lpCD->nmcd.uItemState & CDIS_HOT) {
246245
lpCD->clrText = m_colors.primary;
247-
lpCD->clrTextBk = m_colors.hover_bg;
246+
lpCD->clrTextBk = m_colors.primary_bg;
248247
}
249248

250249
LRESULT res = ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
@@ -355,7 +354,7 @@ LRESULT ThemeRenderer::HeaderProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
355354
Header_GetItemRect(hWnd, i, &rcItem);
356355

357356
if (i == m_hotHeaderItem && m_hHeaderTracked == hWnd) {
358-
FillRect(hdc, &rcItem, m_brushes.hover_bg);
357+
FillRect(hdc, &rcItem, m_brushes.primary_bg);
359358
}
360359

361360
// Draw text

src/Explorer/ThemeRenderer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ struct ThemeColors
4242
COLORREF primary = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
4343
COLORREF primary_bg = ::GetSysColor(COLOR_HIGHLIGHT);
4444
COLORREF primary_border = ::GetSysColor(COLOR_ACTIVEBORDER);
45-
COLORREF hover_bg = ::GetSysColor(COLOR_HOTLIGHT);
4645
};
4746

4847

@@ -56,7 +55,6 @@ struct Brushes
5655
Brush primary; // for primary/highlighted text
5756
Brush primary_bg; // for primary/highlighted background
5857
Brush primary_border; // for primary element borders
59-
Brush hover_bg; // for hover background
6058
};
6159

6260

0 commit comments

Comments
 (0)