Richard Campbell's Win9x/NT4/5 window style patch.

svn path=/trunk/; revision=4180
This commit is contained in:
Marty Dill 2003-02-19 22:44:57 +00:00
parent 331ea2e7ba
commit b556b6e5a6
2 changed files with 131 additions and 162 deletions

View file

@ -36,11 +36,21 @@ BEGIN
END END
END END
// Close Box
OBM_CLOSE BITMAP "resources/obm_close.bmp" OBM_CLOSE BITMAP "resources/obm_close.bmp"
OBM_REDUCE BITMAP "resources/obm_reduce.bmp" OBM_CLOSED BITMAP "resources/obm_closed.bmp"
OBM_ZOOM BITMAP "resources/obm_zoom.bmp"
OBM_RESTORE BITMAP "resources/obm_restore.bmp"
// Minimize Box
OBM_REDUCE BITMAP "resources/obm_reduce.bmp"
OBM_REDUCED BITMAP "resources/obm_reduced.bmp"
// Maximize Box
OBM_ZOOM BITMAP "resources/obm_zoom.bmp"
OBM_ZOOMD BITMAP "resources/obm_zoomd.bmp"
// Restore Box
OBM_RESTORE BITMAP "resources/obm_restore.bmp"
OBM_RESTORED BITMAP "resources/obm_restored.bmp"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Dialog // Dialog

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.18 2003/01/25 23:05:36 ei Exp $ /* $Id: defwnd.c,v 1.19 2003/02/19 22:44:57 mdill 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
@ -21,6 +21,7 @@
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
static HBITMAP hbitmapClose; static HBITMAP hbitmapClose;
static HBITMAP hbitmapCloseD;
static HBITMAP hbitmapMinimize; static HBITMAP hbitmapMinimize;
static HBITMAP hbitmapMinimizeD; static HBITMAP hbitmapMinimizeD;
static HBITMAP hbitmapMaximize; static HBITMAP hbitmapMaximize;
@ -31,12 +32,12 @@ static HBITMAP hbitmapRestoreD;
static COLORREF SysColours[] = static COLORREF SysColours[] =
{ {
RGB(224, 224, 224) /* COLOR_SCROLLBAR */, RGB(224, 224, 224) /* COLOR_SCROLLBAR */,
RGB(192, 192, 192) /* COLOR_BACKGROUND */, RGB(58, 110, 165) /* COLOR_BACKGROUND */,
RGB(0, 64, 128) /* COLOR_ACTIVECAPTION */, RGB(0, 0, 128) /* COLOR_ACTIVECAPTION */,
RGB(255, 255, 255) /* COLOR_INACTIVECAPTION */, RGB(128, 128, 128) /* COLOR_INACTIVECAPTION */,
RGB(255, 255, 255) /* COLOR_MENU */, RGB(192, 192, 192) /* COLOR_MENU */,
RGB(255, 255, 255) /* COLOR_WINDOW */, RGB(192, 192, 192) /* COLOR_WINDOW */,
RGB(0, 0, 0) /* COLOR_WINDOWFRAME */, RGB(192, 192, 192) /* COLOR_WINDOWFRAME */,
RGB(0, 0, 0) /* COLOR_MENUTEXT */, RGB(0, 0, 0) /* COLOR_MENUTEXT */,
RGB(0, 0, 0) /* COLOR_WINDOWTEXT */, RGB(0, 0, 0) /* COLOR_WINDOWTEXT */,
RGB(255, 255, 255) /* COLOR_CAPTIONTEXT */, RGB(255, 255, 255) /* COLOR_CAPTIONTEXT */,
@ -44,12 +45,12 @@ static COLORREF SysColours[] =
RGB(255, 255, 255) /* COLOR_INACTIVEBORDER */, RGB(255, 255, 255) /* COLOR_INACTIVEBORDER */,
RGB(255, 255, 232) /* COLOR_APPWORKSPACE */, RGB(255, 255, 232) /* COLOR_APPWORKSPACE */,
RGB(224, 224, 224) /* COLOR_HILIGHT */, RGB(224, 224, 224) /* COLOR_HILIGHT */,
RGB(0, 0, 0) /* COLOR_HILIGHTTEXT */, RGB(0, 0, 128) /* COLOR_HILIGHTTEXT */,
RGB(192, 192, 192) /* COLOR_BTNFACE */, RGB(192, 192, 192) /* COLOR_BTNFACE */,
RGB(128, 128, 128) /* COLOR_BTNSHADOW */, RGB(128, 128, 128) /* COLOR_BTNSHADOW */,
RGB(192, 192, 192) /* COLOR_GRAYTEXT */, RGB(192, 192, 192) /* COLOR_GRAYTEXT */,
RGB(0, 0, 0) /* COLOR_BTNTEXT */, RGB(0, 0, 0) /* COLOR_BTNTEXT */,
RGB(0, 0, 0) /* COLOR_INACTIVECAPTIONTEXT */, RGB(192, 192, 192) /* COLOR_INACTIVECAPTIONTEXT */,
RGB(255, 255, 255) /* COLOR_BTNHILIGHT */, RGB(255, 255, 255) /* COLOR_BTNHILIGHT */,
RGB(32, 32, 32) /* COLOR_3DDKSHADOW */, RGB(32, 32, 32) /* COLOR_3DDKSHADOW */,
RGB(192, 192, 192) /* COLOR_3DLIGHT */, RGB(192, 192, 192) /* COLOR_3DLIGHT */,
@ -166,15 +167,15 @@ UserHasBigFrameStyle(ULONG Style, ULONG ExStyle)
(ExStyle & WS_EX_DLGMODALFRAME)); (ExStyle & WS_EX_DLGMODALFRAME));
} }
void UserGetInsideRectNC( HWND hwnd, RECT *rect ) void UserGetInsideRectNC( HWND hWnd, RECT *rect )
{ {
RECT WindowRect; RECT WindowRect;
ULONG Style; ULONG Style;
ULONG ExStyle; ULONG ExStyle;
Style = GetWindowLong(hwnd, GWL_STYLE); Style = GetWindowLong(hWnd, GWL_STYLE);
ExStyle = GetWindowLong(hwnd, GWL_EXSTYLE); ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
GetWindowRect(hwnd, &WindowRect); GetWindowRect(hWnd, &WindowRect);
rect->top = rect->left = 0; rect->top = rect->left = 0;
rect->right = WindowRect.right - WindowRect.left; rect->right = WindowRect.right - WindowRect.left;
rect->bottom = WindowRect.bottom - WindowRect.top; rect->bottom = WindowRect.bottom - WindowRect.top;
@ -211,68 +212,72 @@ void UserGetInsideRectNC( HWND hwnd, RECT *rect )
} }
} }
void UserDrawSysButton( HWND hwnd, HDC hdc, BOOL down ) void UserDrawSysMenuButton( HWND hWnd, HDC hDC, BOOL down )
{ {
RECT rect; /* FIXME: Implement AppIcon loading/displaying, if AppIcon isn't present,
HDC hdcMem; load default (OIC_SAMPLE I believe, not sure */
HBITMAP hbitmap;
ULONG Style;
Style = GetWindowLong(hwnd, GWL_STYLE);
UserGetInsideRectNC( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc );
hbitmap = SelectObject( hdcMem, hbitmapClose );
BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hdcMem,
(Style & WS_CHILD) ? GetSystemMetrics(SM_CXSIZE) : 0, 0,
down ? NOTSRCCOPY : SRCCOPY );
SelectObject( hdcMem, hbitmap );
DeleteDC( hdcMem );
} }
static void UserDrawMaxButton( HWND hwnd, HDC hdc, BOOL down ) static void UserDrawCloseButton ( HWND hWnd, HDC hDC, BOOL down )
{ {
RECT rect; RECT rect;
HDC hdcMem; HDC hDCMem;
UserGetInsideRectNC( hWnd, &rect );
hDCMem = CreateCompatibleDC( hDC );
SelectObject( hDCMem, (down ? hbitmapCloseD : hbitmapClose) );
BitBlt( hDC,rect.right - GetSystemMetrics(SM_CXSMSIZE), rect.top + 1,
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE),
hDCMem,0,0,SRCCOPY );
DeleteDC( hDCMem );
}
UserGetInsideRectNC( hwnd, &rect ); static void UserDrawMaxButton( HWND hWnd, HDC hDC, BOOL down )
hdcMem = CreateCompatibleDC( hdc ); {
SelectObject( hdcMem, (IsZoomed(hwnd) RECT rect;
HDC hDCMem;
UserGetInsideRectNC( hWnd, &rect );
hDCMem = CreateCompatibleDC( hDC );
SelectObject( hDCMem, (IsZoomed(hWnd)
? (down ? hbitmapRestoreD : hbitmapRestore) ? (down ? hbitmapRestoreD : hbitmapRestore)
: (down ? hbitmapMaximizeD : hbitmapMaximize)) ); : (down ? hbitmapMaximizeD : hbitmapMaximize)) );
BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSMSIZE) - 1, rect.top, BitBlt( hDC, rect.right - (GetSystemMetrics(SM_CXSMSIZE) * 2) - 3, rect.top + 1,
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE), hdcMem, 0, 0, GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE), hDCMem, 0, 0,
SRCCOPY ); SRCCOPY );
DeleteDC( hdcMem ); DeleteDC( hDCMem );
} }
static void UserDrawMinButton( HWND hwnd, HDC hdc, BOOL down) static void UserDrawMinButton( HWND hWnd, HDC hDC, BOOL down)
{ {
RECT rect; RECT rect;
HDC hdcMem; HDC hDCMem;
UserGetInsideRectNC(hwnd, &rect); UserGetInsideRectNC(hWnd, &rect);
hdcMem = CreateCompatibleDC(hdc); hDCMem = CreateCompatibleDC(hDC);
SelectObject(hdcMem, (down ? hbitmapMinimizeD : hbitmapMinimize)); SelectObject(hDCMem, (down ? hbitmapMinimizeD : hbitmapMinimize));
if (GetWindowLong(hwnd, GWL_STYLE) & WS_MAXIMIZEBOX) if (GetWindowLong(hWnd, GWL_STYLE) & WS_MAXIMIZEBOX)
{ {
rect.right -= GetSystemMetrics(SM_CXSMSIZE)+1; rect.right -= GetSystemMetrics(SM_CXSMSIZE)+1;
} }
BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSMSIZE) - 1, rect.top, BitBlt( hDC, rect.right - ( GetSystemMetrics(SM_CXSMSIZE) * 2 ) - 3, rect.top + 1,
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE), GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE),
hdcMem, 0, 0, hDCMem, 0, 0,
SRCCOPY ); SRCCOPY );
DeleteDC( hdcMem ); DeleteDC( hDCMem );
} }
static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd, static void UserDrawCaptionNC( HDC hDC, RECT *rect, HWND hWnd,
DWORD style, BOOL active ) DWORD style, BOOL active )
{ {
RECT r = *rect; RECT r = *rect;
char buffer[256]; char buffer[256];
if (!hbitmapClose) if (!hbitmapClose)
{ {
hbitmapClose = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_CLOSE)); hbitmapClose = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_CLOSE));
hbitmapMinimize = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCE) ); hbitmapMinimize = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCE) );
hbitmapMinimizeD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCED) ); hbitmapMinimizeD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCED) );
@ -280,44 +285,38 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
hbitmapMaximizeD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_ZOOMD) ); hbitmapMaximizeD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_ZOOMD) );
hbitmapRestore = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORE) ); hbitmapRestore = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORE) );
hbitmapRestoreD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORED) ); hbitmapRestoreD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORED) );
} }
if (GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_DLGMODALFRAME)
{
HBRUSH hbrushOld = SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW) );
PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY );
PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY );
PatBlt( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY );
r.left++;
r.right--;
SelectObject( hdc, hbrushOld );
}
MoveToEx( hdc, r.left, r.bottom, NULL );
LineTo( hdc, r.right, r.bottom );
if (GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_DLGMODALFRAME)
{
/* Unimplemented */
}
/* Fill the caption with COLOR_(IN)ACTIVECAPTION.
In the future this will be GradientFill() */
SelectObject( hDC, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) );
PatBlt(hDC,rect->left + 3, rect->top + 3, rect->right - 6, rect->bottom - 1, PATCOPY );
if (style & WS_SYSMENU) if (style & WS_SYSMENU)
{ {
UserDrawSysButton( hwnd, hdc, FALSE ); UserDrawSysMenuButton( hWnd, hDC, FALSE );
r.left += GetSystemMetrics(SM_CXSIZE) + 1; r.left += GetSystemMetrics(SM_CXSIZE) + 1;
MoveToEx( hdc, r.left - 1, r.top, NULL ); UserDrawCloseButton( hWnd, hDC, FALSE );
LineTo( hdc, r.left - 1, r.bottom );
} }
if (style & WS_MAXIMIZEBOX) if (style & WS_MAXIMIZEBOX)
{ {
UserDrawMaxButton( hwnd, hdc, FALSE ); UserDrawMaxButton( hWnd, hDC, FALSE );
r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1; r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
} }
if (style & WS_MINIMIZEBOX) if (style & WS_MINIMIZEBOX)
{ {
UserDrawMinButton( hwnd, hdc, FALSE ); UserDrawMinButton( hWnd, hDC, FALSE );
r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1; r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
} }
FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION :
COLOR_INACTIVECAPTION) );
if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) if (GetWindowTextA( hWnd, buffer, sizeof(buffer) ))
{ {
NONCLIENTMETRICS nclm; NONCLIENTMETRICS nclm;
HFONT hFont, hOldFont; HFONT hFont, hOldFont;
@ -328,96 +327,56 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont); hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont);
else else
hFont = CreateFontIndirectW(&nclm.lfCaptionFont); hFont = CreateFontIndirectW(&nclm.lfCaptionFont);
hOldFont = SelectObject(hdc, hFont); hOldFont = SelectObject(hDC, hFont);
if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); SetTextColor(hDC, GetSysColor( (active ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT ) ) );
else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); SetBkMode( hDC, TRANSPARENT );
SetBkMode( hdc, TRANSPARENT );
/*DrawTextA( hdc, buffer, -1, &r, /*FIXME: Need verticle centering code and other fixups */
DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );*/ TextOutA(hDC, r.left+5, r.top+5, buffer, strlen(buffer));
TextOutA(hdc, r.left+5, r.top+2, buffer, strlen(buffer)); DeleteObject (SelectObject (hDC, hOldFont));
DeleteObject (SelectObject (hdc, hOldFont));
} }
} }
VOID VOID
UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active) UserDrawFrameNC(HDC hDC, RECT* rect, BOOL dlgFrame, BOOL active)
{ {
INT width, height;
if (dlgFrame) if (dlgFrame)
{ {
width = GetSystemMetrics(SM_CXDLGFRAME) - 1; /* Unimplemented */
height = GetSystemMetrics(SM_CYDLGFRAME) - 1;
SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVECAPTION :
COLOR_INACTIVECAPTION) );
} }
else else
{ {
width = GetSystemMetrics(SM_CXFRAME) - 2; /* Unimplemented */
height = GetSystemMetrics(SM_CYFRAME) - 2;
SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER :
COLOR_INACTIVEBORDER) );
} }
/* Draw frame */ SelectObject( hDC, GetSysColorBrush(COLOR_WINDOW) );
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, height, PATCOPY ); PatBlt( hDC, rect->left, rect->top, rect->right, rect->bottom, PATCOPY);
PatBlt( hdc, rect->left, rect->top,
width, rect->bottom - rect->top, PATCOPY );
PatBlt( hdc, rect->left, rect->bottom - 1,
rect->right - rect->left, -height, PATCOPY );
PatBlt( hdc, rect->right - 1, rect->top,
-width, rect->bottom - rect->top, PATCOPY );
if (dlgFrame) SelectObject( hDC, GetStockObject( WHITE_BRUSH ) );
{
InflateRect( rect, -width, -height ); PatBlt( hDC, rect->left + 1, rect->top + 1, rect->right - 2, 1, PATCOPY );
} PatBlt( hDC, rect->left + 1, rect->top + 1, 1, rect->bottom - 2, PATCOPY );
else
{
INT decYOff = GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXSIZE) - 1;
INT decXOff = GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CYSIZE) - 1;
/* Draw inner rectangle */ SelectObject( hDC, GetStockObject( GRAY_BRUSH ) );
SelectObject( hdc, GetStockObject(NULL_BRUSH) ); PatBlt( hDC, rect->left + 1, rect->bottom - 1, rect->right - 2, 1, PATCOPY );
Rectangle( hdc, rect->left + width, rect->top + height, PatBlt( hDC, rect->right - 1, rect->top + 1, 1, rect->bottom - 2, PATCOPY );
rect->right - width , rect->bottom - height );
SelectObject( hDC, GetStockObject( DKGRAY_BRUSH ) );
/* Draw the decorations */
PatBlt( hDC, rect->left, rect->bottom, rect->right, 1, PATCOPY );
MoveToEx( hdc, rect->left, rect->top + decYOff, NULL ); PatBlt( hDC, rect->right, rect->top, 1, rect->bottom, PATCOPY );
LineTo( hdc, rect->left + width, rect->top + decYOff );
MoveToEx( hdc, rect->right - 1, rect->top + decYOff, NULL );
LineTo( hdc, rect->right - width - 1, rect->top + decYOff );
MoveToEx( hdc, rect->left, rect->bottom - decYOff, NULL );
LineTo( hdc, rect->left + width, rect->bottom - decYOff );
MoveToEx( hdc, rect->right - 1, rect->bottom - decYOff, NULL );
LineTo( hdc, rect->right - width - 1, rect->bottom - decYOff );
MoveToEx( hdc, rect->left + decXOff, rect->top, NULL );
LineTo( hdc, rect->left + decXOff, rect->top + height);
MoveToEx( hdc, rect->left + decXOff, rect->bottom - 1, NULL );
LineTo( hdc, rect->left + decXOff, rect->bottom - height - 1 );
MoveToEx( hdc, rect->right - decXOff, rect->top, NULL );
LineTo( hdc, rect->right - decXOff, rect->top + height );
MoveToEx( hdc, rect->right - decXOff, rect->bottom - 1, NULL );
LineTo( hdc, rect->right - decXOff, rect->bottom - height - 1 );
InflateRect( rect, -width - 1, -height - 1 );
}
} }
void SCROLL_DrawScrollBar (HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior); void SCROLL_DrawScrollBar (HWND hWnd, HDC hDC, INT nBar, BOOL arrows, BOOL interior);
VOID VOID
DefWndDoPaintNC(HWND hWnd, HRGN clip) DefWndDoPaintNC(HWND hWnd, HRGN clip)
{ {
ULONG Active; ULONG Active;
HDC hDc; HDC hDC;
RECT rect; RECT rect;
ULONG Style; ULONG Style;
ULONG ExStyle; ULONG ExStyle;
@ -426,9 +385,9 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
Style = GetWindowLong(hWnd, GWL_STYLE); Style = GetWindowLong(hWnd, GWL_STYLE);
ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
hDc = GetDCEx(hWnd, (clip > (HRGN)1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | hDC = GetDCEx(hWnd, (clip > (HRGN)1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
((clip > (HRGN)1) ? (DCX_INTERSECTRGN | DCX_KEEPCLIPRGN) : 0)); ((clip > (HRGN)1) ? (DCX_INTERSECTRGN | DCX_KEEPCLIPRGN) : 0));
if (hDc == 0) if (hDC == 0)
{ {
return; return;
} }
@ -440,21 +399,21 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
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)) if (UserHasAnyFrameStyle(Style, ExStyle))
{ {
SelectObject(hDc, GetStockObject(NULL_BRUSH)); SelectObject(hDC, GetStockObject(NULL_BRUSH));
Rectangle(hDc, 0, 0, rect.right, rect.bottom); //Rectangle(hDC, 0, 0, rect.right, rect.bottom);
InflateRect(&rect, -1, -1); InflateRect(&rect, -1, -1);
} }
if (UserHasThickFrameStyle(Style, ExStyle)) if (UserHasThickFrameStyle(Style, ExStyle))
{ {
UserDrawFrameNC(hDc, &rect, FALSE, Active); UserDrawFrameNC(hDC, &rect, FALSE, Active);
} }
else if (UserHasDlgFrameStyle(Style, ExStyle)) else if (UserHasDlgFrameStyle(Style, ExStyle))
{ {
UserDrawFrameNC(hDc, &rect, TRUE, Active); UserDrawFrameNC(hDC, &rect, TRUE, Active);
} }
if (Style & WS_CAPTION) if (Style & WS_CAPTION)
@ -463,7 +422,7 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
r.bottom = rect.top + GetSystemMetrics(SM_CYSIZE); r.bottom = rect.top + GetSystemMetrics(SM_CYSIZE);
rect.top += GetSystemMetrics(SM_CYSIZE) + rect.top += GetSystemMetrics(SM_CYSIZE) +
GetSystemMetrics(SM_CYBORDER); GetSystemMetrics(SM_CYBORDER);
UserDrawCaptionNC(hDc, &r, hWnd, Style, Active); UserDrawCaptionNC(hDC, &r, hWnd, Style, Active);
} }
/* FIXME: Draw menu bar. */ /* FIXME: Draw menu bar. */
@ -471,13 +430,13 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
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
@ -749,18 +708,18 @@ VOID
DefWndDrawSysButton(HWND hWnd, HDC hDC, BOOL Down) DefWndDrawSysButton(HWND hWnd, HDC hDC, BOOL Down)
{ {
RECT Rect; RECT Rect;
HDC hDcMem; HDC hDCMem;
HBITMAP hSavedBitmap; HBITMAP hSavedBitmap;
UserGetInsideRectNC(hWnd, &Rect); UserGetInsideRectNC(hWnd, &Rect);
hDcMem = CreateCompatibleDC(hDC); hDCMem = CreateCompatibleDC(hDC);
hSavedBitmap = SelectObject(hDcMem, hbitmapClose); hSavedBitmap = SelectObject(hDCMem, hbitmapClose);
BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE), BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hDcMem, GetSystemMetrics(SM_CYSIZE), hDCMem,
(GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ? (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ?
GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY); GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY);
SelectObject(hDcMem, hSavedBitmap); SelectObject(hDCMem, hSavedBitmap);
DeleteDC(hDcMem); DeleteDC(hDCMem);
} }
LRESULT LRESULT
@ -1125,8 +1084,8 @@ User32DefWindowProc(HWND hWnd,
case WM_PAINT: case WM_PAINT:
{ {
PAINTSTRUCT Ps; PAINTSTRUCT Ps;
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 &&
@ -1139,7 +1098,7 @@ User32DefWindowProc(HWND hWnd,
GetSystemMetrics(SM_CXICON)) / 2; GetSystemMetrics(SM_CXICON)) / 2;
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);
} }