Fix dark mode tab left-right control for floating docking containers
Fix #11683, close #11684
This commit is contained in:
parent
c72dac69c5
commit
def3aba4e6
|
@ -1326,6 +1326,24 @@ namespace NppDarkMode
|
|||
RemoveWindowSubclass(hWnd, TabSubclass, g_tabSubclassID);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PARENTNOTIFY:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
auto hwndUpdown = reinterpret_cast<HWND>(lParam);
|
||||
if (NppDarkMode::subclassTabUpDownControl(hwndUpdown))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
@ -1725,32 +1743,20 @@ namespace NppDarkMode
|
|||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void subclassTabUpDownControl(HWND hwnd)
|
||||
{
|
||||
auto pButtonData = reinterpret_cast<DWORD_PTR>(new ButtonData());
|
||||
SetWindowSubclass(hwnd, TabUpDownSubclass, g_tabUpDownSubclassID, pButtonData);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemeTabUpDownControl(HWND hwndParent, HWND hwndUpdown)
|
||||
{
|
||||
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA{
|
||||
auto && hwndUpdown = *reinterpret_cast<HWND*>(lParam);
|
||||
if (hwndUpdown == nullptr)
|
||||
bool subclassTabUpDownControl(HWND hwnd)
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
GetClassName(hwnd, className, classNameLen);
|
||||
if (wcscmp(className, UPDOWN_CLASS) == 0)
|
||||
{
|
||||
hwndUpdown = hwnd;
|
||||
NppDarkMode::subclassTabUpDownControl(hwndUpdown);
|
||||
NppDarkMode::setDarkExplorerTheme(hwndUpdown);
|
||||
::InvalidateRect(hwndUpdown, nullptr, TRUE);
|
||||
::UpdateWindow(hwndUpdown);
|
||||
auto pButtonData = reinterpret_cast<DWORD_PTR>(new ButtonData());
|
||||
SetWindowSubclass(hwnd, TabUpDownSubclass, g_tabUpDownSubclassID, pButtonData);
|
||||
NppDarkMode::setDarkExplorerTheme(hwnd);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}, reinterpret_cast<LPARAM>(&hwndUpdown));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void setDarkTitleBar(HWND hwnd)
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace NppDarkMode
|
|||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
|
||||
void autoThemeChildControls(HWND hwndParent);
|
||||
|
||||
void autoSubclassAndThemeTabUpDownControl(HWND hwndParent, HWND hwndUpdown);
|
||||
bool subclassTabUpDownControl(HWND hwnd);
|
||||
|
||||
void setDarkTitleBar(HWND hwnd);
|
||||
void setDarkExplorerTheme(HWND hwnd);
|
||||
|
|
|
@ -952,6 +952,25 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PARENTNOTIFY:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
auto hwndUpdown = reinterpret_cast<HWND>(lParam);
|
||||
if (NppDarkMode::subclassTabUpDownControl(hwndUpdown))
|
||||
{
|
||||
_hTabUpdown = hwndUpdown;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1225,7 +1244,11 @@ void DockingCont::onSize()
|
|||
rcTemp.left, rcTemp.top, rcTemp.right, rcTemp.bottom,
|
||||
SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeTabUpDownControl(_hContTab, _hTabUpdown);
|
||||
if (_hTabUpdown != nullptr)
|
||||
{
|
||||
::InvalidateRect(_hTabUpdown, nullptr, TRUE);
|
||||
::UpdateWindow(_hTabUpdown);
|
||||
}
|
||||
}
|
||||
|
||||
// resize client area for plugin
|
||||
|
@ -1246,8 +1269,6 @@ void DockingCont::onSize()
|
|||
::SetWindowPos(::GetDlgItem(_hSelf, IDC_CLIENT_TAB), NULL,
|
||||
rcTemp.left, rcTemp.top, rcTemp.right, rcTemp.bottom,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeTabUpDownControl(_hContTab, _hTabUpdown);
|
||||
}
|
||||
// resize to float window
|
||||
else
|
||||
|
@ -1269,6 +1290,12 @@ void DockingCont::onSize()
|
|||
::SetWindowPos(_hContTab, NULL,
|
||||
rcTemp.left, rcTemp.top, rcTemp.right, rcTemp.bottom,
|
||||
SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||
|
||||
if (_hTabUpdown != nullptr)
|
||||
{
|
||||
::InvalidateRect(_hTabUpdown, nullptr, TRUE);
|
||||
::UpdateWindow(_hTabUpdown);
|
||||
}
|
||||
}
|
||||
|
||||
// resize client area for plugin
|
||||
|
|
|
@ -241,8 +241,6 @@ void TabBar::reSizeTo(RECT & rc2Ajust)
|
|||
rc2Ajust.top += tabsHight;
|
||||
rc2Ajust.bottom -= tabsHight;
|
||||
}
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeTabUpDownControl(_hSelf, _hTabUpdown);
|
||||
}
|
||||
|
||||
|
||||
|
@ -982,6 +980,23 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
|||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_PARENTNOTIFY:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
auto hwndUpdown = reinterpret_cast<HWND>(lParam);
|
||||
if (NppDarkMode::subclassTabUpDownControl(hwndUpdown))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ::CallWindowProc(_tabBarDefaultProc, hwnd, Message, wParam, lParam);
|
||||
|
|
|
@ -114,8 +114,6 @@ protected:
|
|||
long getRowCount() const {
|
||||
return long(::SendMessage(_hSelf, TCM_GETROWCOUNT, 0, 0));
|
||||
}
|
||||
private:
|
||||
HWND _hTabUpdown = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue