Fix dark mode applied correctely only for 1 project panel issue

pull/10093/head
Don Ho 2021-07-01 04:31:02 +02:00
parent 75643560a3
commit 4ae1063774
2 changed files with 8 additions and 8 deletions

View File

@ -815,16 +815,14 @@ void ProjectPanel::notified(LPNMHDR notification)
}
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
{
static bool becomeDarkMode = false;
static bool becomeLightMode = false;
if (NppDarkMode::isEnabled())
{
if (!becomeDarkMode)
if (!_becomeDarkMode)
{
NppDarkMode::setExplorerTheme(_hToolbarMenu, false);
becomeDarkMode = true;
_becomeDarkMode = true;
}
becomeLightMode = false;
_becomeLightMode = false;
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
nmtbcd->clrText = NppDarkMode::getTextColor();
@ -833,12 +831,12 @@ void ProjectPanel::notified(LPNMHDR notification)
}
else
{
if (!becomeLightMode)
if (!_becomeLightMode)
{
NppDarkMode::setExplorerTheme(_hToolbarMenu, true);
becomeLightMode = true;
_becomeLightMode = true;
}
becomeDarkMode = false;
_becomeDarkMode = false;
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_DODEFAULT);
}
}

View File

@ -117,6 +117,8 @@ protected:
generic_string _selDirOfFilesFromDirDlg;
bool _isDirty = false;
int _panelID = 0;
bool _becomeDarkMode = false;
bool _becomeLightMode = false;
void initMenus();
void destroyMenus();