Make plugins' toolbar icons display in light/dark mode
The plugins' toolbar icons can be displayed in both light/dark mode by using their original icons. Though using new API NPPM_ADDTOOLBARICON_FORDARKMODE to have better look & feel is recommanded. Fix #9959, fix #10388, fix #9809
This commit is contained in:
parent
5e899f2a6c
commit
302bab894f
|
@ -381,7 +381,35 @@ void ToolBar::registerDynBtn(UINT messageID, toolbarIcons* iconHandles, HICON ab
|
|||
DynamicCmdIcoBmp dynList;
|
||||
dynList._message = messageID;
|
||||
dynList._hBmp = iconHandles->hToolbarBmp;
|
||||
dynList._hIcon = iconHandles->hToolbarIcon ? iconHandles->hToolbarIcon : absentIco;
|
||||
|
||||
if (iconHandles->hToolbarIcon)
|
||||
{
|
||||
dynList._hIcon = iconHandles->hToolbarIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
BITMAP bmp;
|
||||
int nbByteBmp = ::GetObject(dynList._hBmp, sizeof(BITMAP), &bmp);
|
||||
if (!nbByteBmp)
|
||||
{
|
||||
dynList._hIcon = absentIco;
|
||||
}
|
||||
else
|
||||
{
|
||||
HBITMAP hbmMask = ::CreateCompatibleBitmap(::GetDC(NULL), bmp.bmWidth, bmp.bmHeight);
|
||||
|
||||
ICONINFO iconinfoDest = { 0 };
|
||||
iconinfoDest.fIcon = TRUE;
|
||||
iconinfoDest.hbmColor = iconHandles->hToolbarBmp;
|
||||
iconinfoDest.hbmMask = hbmMask;
|
||||
|
||||
dynList._hIcon = ::CreateIconIndirect(&iconinfoDest);
|
||||
::DeleteObject(hbmMask);
|
||||
}
|
||||
}
|
||||
|
||||
dynList._hIcon_DM = dynList._hIcon;
|
||||
|
||||
_vDynBtnReg.push_back(dynList);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue