mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[SHELL32][COMCTL32][BROWSEUI][EXPLORER] Update color usage on WM_SYSCOLORCHANGE (#7325)
This commit is contained in:
parent
e2fc578f6d
commit
751641c2be
6 changed files with 38 additions and 20 deletions
|
@ -2542,6 +2542,11 @@ ChangePos:
|
|||
return (LRESULT) GetStockObject(HOLLOW_BRUSH);
|
||||
}
|
||||
|
||||
LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return SendMessageW(m_Rebar, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
RECT rcClient;
|
||||
|
@ -3403,6 +3408,7 @@ HandleTrayContextMenu:
|
|||
MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint)
|
||||
MESSAGE_HANDLER(WM_NCACTIVATE, OnNcActivate)
|
||||
MESSAGE_HANDLER(WM_CTLCOLORBTN, OnCtlColorBtn)
|
||||
MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
|
||||
MESSAGE_HANDLER(WM_MOVING, OnMoving)
|
||||
MESSAGE_HANDLER(WM_SIZING, OnSizing)
|
||||
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging)
|
||||
|
|
|
@ -714,7 +714,8 @@ LRESULT CBaseBarSite::OnCustomDraw(LPNMCUSTOMDRAW pnmcd)
|
|||
REBARBANDINFO info;
|
||||
WCHAR wszTitle[MAX_PATH];
|
||||
DWORD index;
|
||||
RECT rt;
|
||||
UINT pad = GetSystemMetrics(SM_CXEDGE), leftpad = max(pad * 2, 4);
|
||||
UINT btnw = 20, btnh = 18, btnarea = 1 + btnw + 1;
|
||||
HFONT newFont, oldFont;
|
||||
|
||||
index = SendMessage(RB_IDTOINDEX, fCurrentActiveBar->fBandID , 0);
|
||||
|
@ -722,20 +723,22 @@ LRESULT CBaseBarSite::OnCustomDraw(LPNMCUSTOMDRAW pnmcd)
|
|||
ZeroMemory(wszTitle, sizeof(wszTitle));
|
||||
DrawEdge(pnmcd->hdc, &pnmcd->rc, EDGE_ETCHED, BF_BOTTOM);
|
||||
// We also resize our close button
|
||||
::SetWindowPos(toolbarWnd, HWND_TOP, pnmcd->rc.right - 22, 0, 20, 18, SWP_SHOWWINDOW);
|
||||
::SetWindowPos(toolbarWnd, HWND_TOP, pnmcd->rc.right - btnarea, 0, btnw, btnh, SWP_SHOWWINDOW);
|
||||
// Draw the text
|
||||
info.cch = MAX_PATH;
|
||||
info.lpText = wszTitle;
|
||||
rt = pnmcd->rc;
|
||||
rt.right -= 24;
|
||||
rt.left += 2;
|
||||
RECT rt = pnmcd->rc;
|
||||
rt.right -= btnarea;
|
||||
rt.left += leftpad;
|
||||
rt.bottom -= 1;
|
||||
if (FAILED_UNEXPECTEDLY(GetInternalBandInfo(index, &info, RBBIM_TEXT)))
|
||||
return CDRF_SKIPDEFAULT;
|
||||
newFont = GetTitleFont();
|
||||
if (newFont)
|
||||
oldFont = (HFONT)SelectObject(pnmcd->hdc, newFont);
|
||||
COLORREF orgclrtxt = SetTextColor(pnmcd->hdc, GetSysColor(COLOR_BTNTEXT));
|
||||
DrawText(pnmcd->hdc, info.lpText, -1, &rt, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
|
||||
SetTextColor(pnmcd->hdc, orgclrtxt);
|
||||
SelectObject(pnmcd->hdc, oldFont);
|
||||
DeleteObject(newFont);
|
||||
return CDRF_SKIPDEFAULT;
|
||||
|
|
|
@ -613,6 +613,7 @@ public:
|
|||
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||
LRESULT RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||
LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||
LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
LRESULT OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
|
||||
|
@ -664,6 +665,7 @@ public:
|
|||
MESSAGE_HANDLER(WM_DRAWITEM, RelayMsgToShellView)
|
||||
MESSAGE_HANDLER(WM_MENUSELECT, RelayMsgToShellView)
|
||||
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
|
||||
MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
|
||||
COMMAND_ID_HANDLER(IDM_FILE_CLOSE, OnClose)
|
||||
COMMAND_ID_HANDLER(IDM_TOOLS_FOLDEROPTIONS, OnFolderOptions)
|
||||
COMMAND_ID_HANDLER(IDM_TOOLS_MAPNETWORKDRIVE, OnMapNetworkDrive)
|
||||
|
@ -3796,6 +3798,12 @@ LRESULT CShellBrowser::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
|||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CShellBrowser::OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||
{
|
||||
SHPropagateMessage(m_hWnd, uMsg, wParam, lParam, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CShellBrowser::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||
{
|
||||
return SendMessage(WM_CLOSE);
|
||||
|
|
|
@ -2548,10 +2548,15 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, INT iIndex, const REBARBANDINFOW *lprbbi,
|
|||
|
||||
/* initialize band */
|
||||
memset(lpBand, 0, sizeof(*lpBand));
|
||||
#ifdef __REACTOS__
|
||||
lpBand->clrFore = infoPtr->clrText == CLR_NONE ? CLR_DEFAULT : infoPtr->clrText;
|
||||
lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? CLR_DEFAULT : infoPtr->clrBk;
|
||||
#else
|
||||
lpBand->clrFore = infoPtr->clrText == CLR_NONE ? infoPtr->clrBtnText :
|
||||
infoPtr->clrText;
|
||||
lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? infoPtr->clrBtnFace :
|
||||
infoPtr->clrBk;
|
||||
#endif
|
||||
lpBand->iImage = -1;
|
||||
|
||||
REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand);
|
||||
|
|
|
@ -212,6 +212,11 @@ static UINT CalculateCharWidth(HWND hwnd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline COLORREF GetViewColor(COLORREF Clr, UINT SysFallback)
|
||||
{
|
||||
return Clr != CLR_INVALID ? Clr : GetSysColor(SysFallback);
|
||||
}
|
||||
|
||||
class CDefView :
|
||||
public CWindowImpl<CDefView, CWindow, CControlWinTraits>,
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
|
@ -592,8 +597,8 @@ CDefView::CDefView() :
|
|||
ZeroMemory(&m_FolderSettings, sizeof(m_FolderSettings));
|
||||
ZeroMemory(&m_ptLastMousePos, sizeof(m_ptLastMousePos));
|
||||
ZeroMemory(&m_Category, sizeof(m_Category));
|
||||
m_viewinfo_data.clrText = GetSysColor(COLOR_WINDOWTEXT);
|
||||
m_viewinfo_data.clrTextBack = GetSysColor(COLOR_WINDOW);
|
||||
m_viewinfo_data.clrText = CLR_INVALID;
|
||||
m_viewinfo_data.clrTextBack = CLR_INVALID;
|
||||
m_viewinfo_data.hbmBack = NULL;
|
||||
|
||||
m_sortInfo.Reset();
|
||||
|
@ -934,18 +939,8 @@ void CDefView::UpdateListColors()
|
|||
}
|
||||
else
|
||||
{
|
||||
// text background color
|
||||
COLORREF clrTextBack = m_viewinfo_data.clrTextBack;
|
||||
m_ListView.SetTextBkColor(clrTextBack);
|
||||
|
||||
// text color
|
||||
COLORREF clrText;
|
||||
if (m_viewinfo_data.clrText != CLR_INVALID)
|
||||
clrText = m_viewinfo_data.clrText;
|
||||
else
|
||||
clrText = GetSysColor(COLOR_WINDOWTEXT);
|
||||
|
||||
m_ListView.SetTextColor(clrText);
|
||||
m_ListView.SetTextBkColor(GetViewColor(m_viewinfo_data.clrTextBack, COLOR_WINDOW));
|
||||
m_ListView.SetTextColor(GetViewColor(m_viewinfo_data.clrText, COLOR_WINDOWTEXT));
|
||||
|
||||
// Background is painted by the parent via WM_PRINTCLIENT
|
||||
m_ListView.SetExtendedListViewStyle(LVS_EX_TRANSPARENTBKGND, LVS_EX_TRANSPARENTBKGND);
|
||||
|
@ -1663,7 +1658,7 @@ LRESULT CDefView::OnPrintClient(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
|||
}
|
||||
else
|
||||
{
|
||||
FillRect(hDC, &rc, GetSysColorBrush(COLOR_WINDOW));
|
||||
SHFillRectClr(hDC, &rc, GetViewColor(m_viewinfo_data.clrTextBack, COLOR_WINDOW));
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
|
|
|
@ -129,6 +129,7 @@ static INT_PTR ConfirmMsgBox_Paint(HWND hDlg)
|
|||
BeginPaint(hDlg, &ps);
|
||||
hdc = ps.hdc;
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
|
||||
|
||||
GetClientRect(GetDlgItem(hDlg, IDC_YESTOALL_MESSAGE), &r);
|
||||
/* this will remap the rect to dialog coords */
|
||||
|
|
Loading…
Reference in a new issue