Apply dark mode on document switcher

Fix #10285, close #10286
This commit is contained in:
ozone10 2021-07-28 20:08:19 +02:00 committed by Don Ho
parent 7c9f4204ea
commit bf6cb36d48
3 changed files with 17 additions and 7 deletions

View File

@ -61,7 +61,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf);
exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT ;
exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT | LVS_EX_DOUBLEBUFFER;
ListView_SetExtendedListViewStyle(_hSelf, exStyle);
@ -76,7 +76,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem
ListView_SetImageList(_hSelf, hImaLst, LVSIL_SMALL);
ListView_SetItemState(_hSelf, _currentIndex, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
ListView_SetBkColor(_hSelf, lightYellow);
ListView_SetBkColor(_hSelf, NppDarkMode::isEnabled() ? NppDarkMode::getBackgroundColor() : lightYellow);
}
void TaskList::destroy()
@ -276,4 +276,3 @@ LRESULT TaskList::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
return ::CallWindowProc(_defaultProc, hwnd, Message, wParam, lParam);
}
}

View File

@ -62,6 +62,8 @@ INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
{
case WM_INITDIALOG :
{
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
::SendMessage(_hParent, WM_GETTASKLISTINFO, reinterpret_cast<WPARAM>(&_taskListInfo), 0);
int nbTotal = static_cast<int32_t>(_taskListInfo._tlfsLst.size());
@ -92,6 +94,16 @@ INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lP
return FALSE;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_DESTROY :
{
_taskList.destroy();
@ -184,13 +196,13 @@ void TaskListDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
const int aSpaceWidth = ListView_GetStringWidth(_taskList.getHSelf(), TEXT(" "));
COLORREF textColor = darkGrey;
COLORREF textColor = NppDarkMode::isEnabled() ? NppDarkMode::getDarkerTextColor() : darkGrey;
int imgStyle = ILD_SELECTED;
if (lpDrawItemStruct->itemState & ODS_SELECTED)
{
imgStyle = ILD_TRANSPARENT;
textColor = black;
textColor = NppDarkMode::isEnabled() ? NppDarkMode::getTextColor() : black;
::SelectObject(hDC, _taskList.GetFontSelected());
}

View File

@ -46,7 +46,7 @@ static HWND hWndServer = NULL;
static HHOOK hook = NULL;
static winVer windowsVersion = WV_UNKNOWN;
static LRESULT CALLBACK hookProc(UINT nCode, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK hookProc(int nCode, WPARAM wParam, LPARAM lParam);
class TaskListDlg : public StaticDialog
{
@ -74,4 +74,3 @@ private :
public:
static int _instanceCount;
};