Added the method SetUpForPaint for setting up the proper foreground

and background colors for the WM_CTLCOLORXXXX messages
This commit is contained in:
rods%netscape.com 1998-08-03 22:28:00 +00:00
Родитель eefb22bc87
Коммит cea9db392f
2 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);