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.
This commit is contained in:
EmptyChaos 2016-08-03 15:03:18 +00:00
parent 50756d69c0
commit 9842cef13f
2 changed files with 36 additions and 7 deletions

View File

@ -30,6 +30,11 @@
#include <wx/tipwin.h>
#include <wx/wxcrt.h>
#ifdef __WXMSW__
#include <CommCtrl.h>
#include <wx/msw/dc.h>
#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<NMLVCUSTOMDRAW*>(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

View File

@ -61,6 +61,10 @@ public:
NUMBER_OF_COLUMN
};
#ifdef __WXMSW__
bool MSWOnNotify(int id, WXLPARAM lparam, WXLPARAM* result) override;
#endif
private:
std::vector<int> m_FlagImageIndex;
std::vector<int> m_PlatformImageIndex;