From 19959a047bc54ee8a9e788bf9a6912845daa9404 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Mon, 3 Aug 1998 22:28:00 +0000 Subject: [PATCH] Added the method SetUpForPaint for setting up the proper foreground and background colors for the WM_CTLCOLORXXXX messages git-svn-id: svn://10.0.0.236/trunk@7163 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsWindow.cpp | 16 ++++++++++------ mozilla/widget/src/windows/nsWindow.h | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index f51e2d06937..c9c98f89e32 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -1318,6 +1318,13 @@ PRBool nsWindow::OnKey(PRUint32 aEventType, PRUint32 aKeyCode) return(DispatchEvent(&event)); } +//------------------------------------------------------------------------- +void nsWindow::SetUpForPaint(HDC aHDC) +{ + ::SetBkColor (aHDC, NSRGB_2_COLOREF(mBackground)); + ::SetTextColor(aHDC, NSRGB_2_COLOREF(mForeground)); + ::SetBkMode (aHDC, TRANSPARENT); +} //------------------------------------------------------------------------- // @@ -1488,20 +1495,17 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } break; + case WM_CTLCOLORLISTBOX: case WM_CTLCOLOREDIT: case WM_CTLCOLORBTN: - case WM_CTLCOLORLISTBOX: case WM_CTLCOLORSCROLLBAR: case WM_CTLCOLORSTATIC: if (lParam) { nsWindow* control = (nsWindow*)::GetWindowLong((HWND)lParam, GWL_USERDATA); if (control) { - HDC hDC = (HDC)wParam; - ::SetBkColor (hDC, NSRGB_2_COLOREF(mBackground)); - ::SetTextColor(hDC, NSRGB_2_COLOREF(mForeground)); - ::SetBkMode (hDC, TRANSPARENT); + control->SetUpForPaint((HDC)wParam); *aRetValue = (LPARAM)control->OnControlColor(); - } + } } result = PR_TRUE; diff --git a/mozilla/widget/src/windows/nsWindow.h b/mozilla/widget/src/windows/nsWindow.h index 16a96e479ed..fbf4cf6101e 100644 --- a/mozilla/widget/src/windows/nsWindow.h +++ b/mozilla/widget/src/windows/nsWindow.h @@ -115,6 +115,8 @@ public: virtual void BeginResizingChildren(void); virtual void EndResizingChildren(void); + virtual void SetUpForPaint(HDC aHDC); + // nsSwitchToUIThread interface virtual BOOL CallMethod(MethodInfo *info); @@ -136,7 +138,7 @@ protected: virtual DWORD WindowStyle(); virtual DWORD WindowExStyle(); - void SubclassWindow(BOOL bState); + virtual void SubclassWindow(BOOL bState); virtual void OnDestroy(); virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);