IDEALLY this should look like NT4 windows to the pixel. Problem is the client area is off...anyone know how to fix it?

svn path=/trunk/; revision=4299
This commit is contained in:
Richard Campbell 2003-03-14 07:24:35 +00:00
parent 4fd70f50be
commit 2be2440055
2 changed files with 51 additions and 63 deletions

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.34 2003/03/12 16:36:18 rcampbell Exp $ /* $Id: defwnd.c,v 1.35 2003/03/14 07:24:35 rcampbell Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -250,15 +250,13 @@ static void UserDrawCloseButton ( HWND hWnd, HDC hDC, BOOL bDown )
INT iBmpWidth = (bToolWindow ? GetSystemMetrics(SM_CXSMSIZE) : INT iBmpWidth = (bToolWindow ? GetSystemMetrics(SM_CXSMSIZE) :
GetSystemMetrics(SM_CXSIZE)) - 2; GetSystemMetrics(SM_CXSIZE)) - 2;
INT iBmpHeight = (bToolWindow ? GetSystemMetrics(SM_CYSMSIZE) : INT iBmpHeight = (bToolWindow ? GetSystemMetrics(SM_CYSMSIZE) :
GetSystemMetrics(SM_CYSIZE)) - 4; GetSystemMetrics(SM_CYSIZE) - 4);
UserGetInsideRectNC(hWnd, &rect);
UserGetInsideRectNC( hWnd, &rect );
SetRect(&rect, SetRect(&rect,
rect.right - iBmpWidth, rect.right - iBmpWidth - GetSystemMetrics(SM_CXFIXEDFRAME),
rect.top + 1, rect.top + GetSystemMetrics(SM_CYFIXEDFRAME),
rect.right, rect.right - GetSystemMetrics(SM_CXFIXEDFRAME),
rect.top + iBmpHeight + 1 ); rect.top + iBmpHeight + GetSystemMetrics(SM_CYFIXEDFRAME) );
DrawFrameControl( hDC, &rect, DFC_CAPTION, DrawFrameControl( hDC, &rect, DFC_CAPTION,
(DFCS_CAPTIONCLOSE | (DFCS_CAPTIONCLOSE |
@ -275,15 +273,15 @@ static void UserDrawMaxButton( HWND hWnd, HDC hDC, BOOL bDown )
if (!IsMinBoxActive(hWnd) && !IsMaxBoxActive(hWnd)) if (!IsMinBoxActive(hWnd) && !IsMaxBoxActive(hWnd))
return; return;
if ((GetWindowLongA( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) == TRUE) if ((GetWindowLongA( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) == TRUE)
return; /* ToolWindows don't have min/max buttons */ return; /* ToolWindows don't have min/max buttons */
UserGetInsideRectNC(hWnd, &rect ); UserGetInsideRectNC(hWnd, &rect );
SetRect(&rect, SetRect(&rect,
rect.right - (iBmpWidth * 2) - 2, rect.right - (iBmpWidth * 2) - (GetSystemMetrics(SM_CXFIXEDFRAME)) - 2,
rect.top + 1, rect.top + GetSystemMetrics(SM_CYFIXEDFRAME),
(rect.right - iBmpWidth) - 2, rect.right - iBmpWidth - GetSystemMetrics(SM_CXFIXEDFRAME) - 2,
rect.top + iBmpHeight + 1 ); rect.top + iBmpHeight + GetSystemMetrics(SM_CYFIXEDFRAME) );
DrawFrameControl( hDC, &rect, DFC_CAPTION, DrawFrameControl( hDC, &rect, DFC_CAPTION,
(IsZoomed(hWnd) ? DFCS_CAPTIONMAX : DFCS_CAPTIONRESTORE) | (IsZoomed(hWnd) ? DFCS_CAPTIONMAX : DFCS_CAPTIONRESTORE) |
@ -293,21 +291,23 @@ static void UserDrawMaxButton( HWND hWnd, HDC hDC, BOOL bDown )
static void UserDrawMinButton( HWND hWnd, HDC hDC, BOOL bDown ) static void UserDrawMinButton( HWND hWnd, HDC hDC, BOOL bDown )
{ {
RECT rect; RECT rect;
INT iBmpWidth = GetSystemMetrics(SM_CXSIZE) - 2; INT iBmpWidth = GetSystemMetrics(SM_CXSIZE) - 2;
INT iBmpHeight = GetSystemMetrics(SM_CYSIZE) - 4; INT iBmpHeight = GetSystemMetrics(SM_CYSIZE) - 4;
if (!IsMinBoxActive(hWnd) && !IsMaxBoxActive(hWnd)) if (!IsMinBoxActive(hWnd) && !IsMaxBoxActive(hWnd))
return; return;
if ((GetWindowLongA( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) == TRUE) if ((GetWindowLongA( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) == TRUE)
return; /* ToolWindows don't have min/max buttons */ return; /*ToolWindows don't have min/max buttons */
UserGetInsideRectNC(hWnd, &rect ); UserGetInsideRectNC(hWnd, &rect );
SetRect(&rect, SetRect(&rect,
rect.right - (iBmpWidth * 3) - 2, rect.right - (iBmpWidth * 3) - (GetSystemMetrics(SM_CXFIXEDFRAME)) - 2,
rect.top + 1, rect.top + GetSystemMetrics(SM_CYFIXEDFRAME),
(rect.right - iBmpWidth * 2) - 2, rect.right - (iBmpWidth * 2) - GetSystemMetrics(SM_CXFIXEDFRAME) - 2,
rect.top + iBmpHeight + 1 ); rect.top + iBmpHeight + GetSystemMetrics(SM_CYFIXEDFRAME) );
DrawFrameControl( hDC, &rect, DFC_CAPTION, DrawFrameControl( hDC, &rect, DFC_CAPTION,
(IsZoomed(hWnd) ? DFCS_CAPTIONMAX : DFCS_CAPTIONRESTORE) | (IsZoomed(hWnd) ? DFCS_CAPTIONMAX : DFCS_CAPTIONRESTORE) |
(bDown ? DFCS_PUSHED : 0) | (bDown ? DFCS_PUSHED : 0) |
@ -319,39 +319,37 @@ static void UserDrawCaptionNC( HDC hDC, RECT *rect, HWND hWnd,
{ {
RECT r = *rect; RECT r = *rect;
char buffer[256]; char buffer[256];
/* REWRITE IN PROGRESS: Don't touch -- rcampbell -- 03-12-2003 */
/* Implement and Use DrawCaption() */ /* Implement and Use DrawCaption() */
SelectObject( hDC, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) ); SelectObject( hDC, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) );
PatBlt(hDC,rect->left + GetSystemMetrics(SM_CXFIXEDFRAME), rect->top + 3, rect->right - (GetSystemMetrics(SM_CXFIXEDFRAME) * 2), rect->bottom - 1, PATCOPY ); PatBlt(hDC,rect->left + GetSystemMetrics(SM_CXFRAME), rect->top +
GetSystemMetrics(SM_CYFRAME), rect->right - (GetSystemMetrics(SM_CXFRAME) * 2) - 1, rect->top +
GetSystemMetrics(SM_CYCAPTION) - 1, PATCOPY );
if (style & WS_SYSMENU) if (style & WS_SYSMENU)
{ {
UserDrawSysMenuButton( hWnd, hDC, FALSE); UserDrawSysMenuButton( hWnd, hDC, FALSE);
r.left += GetSystemMetrics(SM_CXSIZE) + 1; r.left += GetSystemMetrics(SM_CXSIZE) + 1;
UserDrawCloseButton( hWnd, hDC, FALSE); UserDrawCloseButton( hWnd, hDC, FALSE);
r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1; r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
UserDrawMinButton(hWnd, hDC, FALSE); UserDrawMinButton(hWnd, hDC, FALSE);
UserDrawMaxButton(hWnd, hDC, FALSE); UserDrawMaxButton(hWnd, hDC, FALSE);
} }
if (GetWindowTextA( hWnd, buffer, sizeof(buffer) )) if (GetWindowTextA( hWnd, buffer, sizeof(buffer) ))
{ {
NONCLIENTMETRICS nclm; NONCLIENTMETRICS nclm;
HFONT hFont, hOldFont; HFONT hFont, hOldFont;
nclm.cbSize = sizeof(NONCLIENTMETRICS); nclm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
if (style & WS_EX_TOOLWINDOW) SetTextColor(hDC, SysColours[ active ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT]);
hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont); SetBkMode( hDC, TRANSPARENT );
else if (style & WS_EX_TOOLWINDOW)
hFont = CreateFontIndirectW(&nclm.lfCaptionFont); hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont);
hOldFont = SelectObject(hDC, hFont); else
SetTextColor(hDC, SysColours[ active ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT]); hFont = CreateFontIndirectW(&nclm.lfCaptionFont);
SetBkMode( hDC, TRANSPARENT ); hOldFont = SelectObject(hDC, hFont);
TextOutA(hDC, r.left, (r.top / 2) + (((int) nclm.lfCaptionFont.lfHeight) / 2), buffer, strlen(buffer));
/*FIXME: Need verticle centering code and other fixups */ DeleteObject (SelectObject (hDC, hOldFont));
TextOutA(hDC, r.left, (r.top / 2) + (((int) nclm.lfCaptionFont.lfHeight) / 2), buffer, strlen(buffer));
//TextOutA(hDC, r.left, (r.top / 2) + (6), buffer, strlen(buffer));
DeleteObject (SelectObject (hDC, hOldFont));
} }
} }
@ -372,7 +370,6 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
RECT rect; RECT rect;
ULONG Style; ULONG Style;
ULONG ExStyle; ULONG ExStyle;
Active = GetWindowLongW(hWnd, GWL_STYLE) & WIN_NCACTIVATED; Active = GetWindowLongW(hWnd, GWL_STYLE) & WIN_NCACTIVATED;
Style = GetWindowLong(hWnd, GWL_STYLE); Style = GetWindowLong(hWnd, GWL_STYLE);
ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
@ -390,14 +387,7 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
rect.right = rect.right - rect.left; rect.right = rect.right - rect.left;
rect.bottom = rect.bottom - rect.top; rect.bottom = rect.bottom - rect.top;
rect.top = rect.left = 0; rect.top = rect.left = 0;
SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME)); SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME));
if (UserHasAnyFrameStyle(Style, ExStyle))
{
SelectObject(hDC, GetStockObject(NULL_BRUSH));
InflateRect(&rect, -1, -1);
}
if (UserHasThickFrameStyle(Style, ExStyle)) if (UserHasThickFrameStyle(Style, ExStyle))
{ {
UserDrawFrameNC(hDC, &rect, FALSE, Active); UserDrawFrameNC(hDC, &rect, FALSE, Active);
@ -406,7 +396,6 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
{ {
UserDrawFrameNC(hDC, &rect, TRUE, Active); UserDrawFrameNC(hDC, &rect, TRUE, Active);
} }
if (Style & WS_CAPTION) if (Style & WS_CAPTION)
{ {
RECT r = rect; RECT r = rect;
@ -416,18 +405,19 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
UserDrawCaptionNC(hDC, &r, hWnd, Style, Active); UserDrawCaptionNC(hDC, &r, hWnd, Style, Active);
} }
/* FIXME: Draw menu bar. */ /* FIXME: Draw menu bar. */
DbgPrint("drawing scrollbars..\n"); DbgPrint("drawing scrollbars..\n");
/* Draw scrollbars */ /* Draw scrollbars */
if (Style & WS_VSCROLL) if (Style & WS_VSCROLL)
SCROLL_DrawScrollBar(hWnd, hDC, SB_VERT, TRUE, TRUE); SCROLL_DrawScrollBar(hWnd, hDC, SB_VERT, TRUE, TRUE);
if (Style & WS_HSCROLL) if (Style & WS_HSCROLL)
SCROLL_DrawScrollBar(hWnd, hDC, SB_HORZ, TRUE, TRUE); SCROLL_DrawScrollBar(hWnd, hDC, SB_HORZ, TRUE, TRUE);
/* FIXME: Draw size box. */ /* FIXME: Draw size box.*/
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
} }
LRESULT LRESULT
@ -1037,6 +1027,7 @@ User32DefWindowProc(HWND hWnd,
HDC hDC = BeginPaint(hWnd, &Ps); HDC hDC = BeginPaint(hWnd, &Ps);
if (hDC) if (hDC)
{ {
HICON hIcon; HICON hIcon;
if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE && if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE &&
(hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL) (hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL)
@ -1049,7 +1040,7 @@ User32DefWindowProc(HWND hWnd,
y = (WindowRect.bottom - WindowRect.top - y = (WindowRect.bottom - WindowRect.top -
GetSystemMetrics(SM_CYICON)) / 2; GetSystemMetrics(SM_CYICON)) / 2;
DrawIcon(hDC, x, y, hIcon); DrawIcon(hDC, x, y, hIcon);
} }
EndPaint(hWnd, &Ps); EndPaint(hWnd, &Ps);
} }
return(0); return(0);
@ -1136,6 +1127,7 @@ User32DefWindowProc(HWND hWnd,
case WM_ERASEBKGND: case WM_ERASEBKGND:
case WM_ICONERASEBKGND: case WM_ICONERASEBKGND:
{ {
RECT Rect; RECT Rect;
HBRUSH hBrush = (HBRUSH)GetClassLongW(hWnd, GCL_HBRBACKGROUND); HBRUSH hBrush = (HBRUSH)GetClassLongW(hWnd, GCL_HBRBACKGROUND);
GetClipBox((HDC)wParam, &Rect); GetClipBox((HDC)wParam, &Rect);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: draw.c,v 1.8 2003/03/02 16:30:07 rcampbell Exp $ /* $Id: draw.c,v 1.9 2003/03/14 07:24:35 rcampbell Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c * FILE: lib/user32/windows/input.c
@ -450,7 +450,6 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER
|| (uType & BDR_OUTER) == BDR_OUTER) || (uType & BDR_OUTER) == BDR_OUTER)
&& !(uFlags & (BF_FLAT|BF_MONO)) ); && !(uFlags & (BF_FLAT|BF_MONO)) );
/* Init some vars */ /* Init some vars */
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN); LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, LTInnerPen); SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
@ -1358,9 +1357,6 @@ BOOL WINAPI DrawFrameControl( HDC hdc, LPRECT rc, UINT uType,
/* Ported from WINE20020904 */ /* Ported from WINE20020904 */
BOOL WINAPI DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags ) BOOL WINAPI DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags )
{ {
DbgPrint("%04x %d,%d-%d,%d %04x %04x\n",
hdc, rc->left, rc->top, rc->right, rc->bottom, edge, flags );
if(flags & BF_DIAGONAL) if(flags & BF_DIAGONAL)
return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags); return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags);
else else