From 9842cef13f6a5ff8b524f6676f65fb3495846e7f Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Wed, 3 Aug 2016 15:03:18 +0000 Subject: [PATCH] GameListCtrl: Reimplement Custom Paint to remove column lines. This leaves system themes enabled and instead just repaints the list view background to eliminate the column ruler lines. --- Source/Core/DolphinWX/GameListCtrl.cpp | 39 +++++++++++++++++++++----- Source/Core/DolphinWX/GameListCtrl.h | 4 +++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 0f629d70b0..a86d54c406 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -30,6 +30,11 @@ #include #include +#ifdef __WXMSW__ +#include +#include +#endif + #include "Common/CDUtils.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" @@ -173,13 +178,6 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoin Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC); wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CGameListCtrl::OnLocalIniModified, this); - -#ifdef _WIN32 - // Default Windows Themes (Aero, Win10) draw column separators which do not appear when - // using the default unthemed appearance. This is a new behavior in wx3.1 since wx3.0 - // and lower did not support themes at all. - EnableSystemTheme(false); -#endif } CGameListCtrl::~CGameListCtrl() @@ -1396,3 +1394,30 @@ bool CGameListCtrl::WiiCompressWarning() "by removing padding data. Your disc image will still work. Continue?"), _("Warning"), wxYES_NO) == wxYES; } + +#ifdef __WXMSW__ +// Windows draws vertical rules between columns when using UXTheme (e.g. Aero, Win10) +// This function paints over those lines which removes them. +// [The repaint background idea is ripped off from Eclipse SWT which does the same thing] +bool CGameListCtrl::MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result) +{ + NMLVCUSTOMDRAW* nmlv = reinterpret_cast(lparam); + // Intercept the NM_CUSTOMDRAW[CDDS_PREPAINT] + // This event occurs after the background has been painted before the content of the list + // is painted. We can repaint the background to eliminate the column lines here. + if (nmlv->nmcd.hdr.hwndFrom == GetHWND() && nmlv->nmcd.hdr.code == NM_CUSTOMDRAW && + nmlv->nmcd.dwDrawStage == CDDS_PREPAINT) + { + // The column separators have already been painted, paint over them. + wxDCTemp dc(nmlv->nmcd.hdc); + dc.SetBrush(GetBackgroundColour()); + dc.SetPen(*wxTRANSPARENT_PEN); + dc.DrawRectangle(nmlv->nmcd.rc.left, nmlv->nmcd.rc.top, + nmlv->nmcd.rc.right - nmlv->nmcd.rc.left, + nmlv->nmcd.rc.bottom - nmlv->nmcd.rc.top); + } + + // Defer to wxWidgets for normal processing. + return wxListCtrl::MSWOnNotify(id, lparam, result); +} +#endif diff --git a/Source/Core/DolphinWX/GameListCtrl.h b/Source/Core/DolphinWX/GameListCtrl.h index 4c23aa5941..5031b411c2 100644 --- a/Source/Core/DolphinWX/GameListCtrl.h +++ b/Source/Core/DolphinWX/GameListCtrl.h @@ -61,6 +61,10 @@ public: NUMBER_OF_COLUMN }; +#ifdef __WXMSW__ + bool MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result) override; +#endif + private: std::vector m_FlagImageIndex; std::vector m_PlatformImageIndex;