mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
Now uses DrawFrameControl to draw controls, still MANY bugs but I'm slowly getting there.
svn path=/trunk/; revision=4221
This commit is contained in:
parent
424f2d1c24
commit
c8274bd166
2 changed files with 66 additions and 46 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: defwnd.c,v 1.22 2003/02/28 23:20:41 rcampbell Exp $
|
/* $Id: defwnd.c,v 1.23 2003/03/01 08:56:34 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
|
||||||
|
@ -219,54 +219,73 @@ void UserDrawSysMenuButton( HWND hWnd, HDC hDC, BOOL down )
|
||||||
|
|
||||||
static void UserDrawCloseButton ( HWND hWnd, HDC hDC, BOOL down )
|
static void UserDrawCloseButton ( HWND hWnd, HDC hDC, BOOL down )
|
||||||
{
|
{
|
||||||
|
/* ported from wine code */
|
||||||
RECT rect;
|
RECT rect;
|
||||||
HDC hDCMem;
|
BOOL bInactive = FALSE;
|
||||||
|
|
||||||
UserGetInsideRectNC( hWnd, &rect );
|
UserGetInsideRectNC( hWnd, &rect );
|
||||||
hDCMem = CreateCompatibleDC( hDC );
|
|
||||||
|
if (GetWindowLongA( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
|
||||||
SelectObject( hDCMem, (hbitmapClose) );
|
{
|
||||||
|
INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */
|
||||||
BitBlt( hDC,rect.right - GetSystemMetrics(SM_CXSMSIZE), rect.top + 1,
|
INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */
|
||||||
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE),
|
INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION);
|
||||||
hDCMem,0,0,SRCCOPY );
|
|
||||||
|
rect.top = rect.top + (iCaptionHeight - 1 - iBmpHeight) / 2;
|
||||||
DeleteDC( hDCMem );
|
rect.left = rect.right - (iCaptionHeight + 1 + iBmpWidth) / 2;
|
||||||
|
rect.bottom = rect.top + iBmpHeight;
|
||||||
|
rect.right = rect.left + iBmpWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.top++;
|
||||||
|
rect.right--;
|
||||||
|
/* Standard close/min/max button sizes appear to be 16x14, though
|
||||||
|
these change with the caption size, I'll fix this soon */
|
||||||
|
rect.left = rect.right - 16;
|
||||||
|
rect.bottom = rect.top + 14;
|
||||||
|
|
||||||
|
}
|
||||||
|
DrawFrameControl( hDC, &rect, DFC_CAPTION,
|
||||||
|
(DFCS_CAPTIONCLOSE |
|
||||||
|
(down ? DFCS_PUSHED : 0) |
|
||||||
|
(bInactive ? DFCS_INACTIVE : 0)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UserDrawMaxButton( HWND hWnd, HDC hDC, BOOL down )
|
static void UserDrawMaxButton( HWND hWnd, HDC hDC, BOOL down )
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
HDC hDCMem;
|
UINT flags = IsZoomed(hWnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
|
||||||
|
|
||||||
UserGetInsideRectNC( hWnd, &rect );
|
UserGetInsideRectNC( hWnd, &rect );
|
||||||
hDCMem = CreateCompatibleDC( hDC );
|
rect.top++;
|
||||||
SelectObject( hDCMem, (IsZoomed(hWnd)
|
rect.right--;
|
||||||
? (down ? hbitmapRestoreD : hbitmapRestore)
|
rect.left = rect.right - (GetSystemMetrics(SM_CXSIZE) - 1) * 2;
|
||||||
: (down ? hbitmapMaximizeD : hbitmapMaximize)) );
|
rect.right = rect.left + (GetSystemMetrics(SM_CXSIZE) - 2);
|
||||||
BitBlt( hDC, rect.right - (GetSystemMetrics(SM_CXSMSIZE) * 2) - 3, rect.top + 1,
|
rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 4;
|
||||||
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE), hDCMem, 0, 0,
|
|
||||||
SRCCOPY );
|
if (down) flags |= DFCS_PUSHED;
|
||||||
DeleteDC( hDCMem );
|
DrawFrameControl( hDC, &rect, DFC_CAPTION, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UserDrawMinButton( HWND hWnd, HDC hDC, BOOL down)
|
static void UserDrawMinButton( HWND hWnd, HDC hDC, BOOL down)
|
||||||
{
|
{
|
||||||
RECT rect;
|
|
||||||
HDC hDCMem;
|
|
||||||
|
|
||||||
UserGetInsideRectNC(hWnd, &rect);
|
RECT rect;
|
||||||
hDCMem = CreateCompatibleDC(hDC);
|
UINT flags = DFCS_CAPTIONMIN;
|
||||||
SelectObject(hDCMem, (down ? hbitmapMinimizeD : hbitmapMinimize));
|
|
||||||
if (GetWindowLong(hWnd, GWL_STYLE) & WS_MAXIMIZEBOX)
|
BOOL bInactive = FALSE;
|
||||||
{
|
UserGetInsideRectNC( hWnd, &rect );
|
||||||
rect.right -= GetSystemMetrics(SM_CXSMSIZE)+1;
|
rect.top++;
|
||||||
}
|
rect.right--;
|
||||||
BitBlt( hDC, rect.right - ( GetSystemMetrics(SM_CXSMSIZE) * 2 ) - 3, rect.top + 1,
|
rect.left = rect.right - (GetSystemMetrics(SM_CXSIZE) - 2) * 3;
|
||||||
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE),
|
rect.right = rect.left + (GetSystemMetrics(SM_CXSIZE) - 2);
|
||||||
hDCMem, 0, 0,
|
rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 4;
|
||||||
SRCCOPY );
|
|
||||||
DeleteDC( hDCMem );
|
if (down) flags |= DFCS_PUSHED;
|
||||||
|
if (bInactive) flags |= DFCS_INACTIVE;
|
||||||
|
DrawFrameControl( hDC, &rect, DFC_CAPTION, flags );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UserDrawCaptionNC( HDC hDC, RECT *rect, HWND hWnd,
|
static void UserDrawCaptionNC( HDC hDC, RECT *rect, HWND hWnd,
|
||||||
|
@ -294,7 +313,7 @@ static void UserDrawCaptionNC( HDC hDC, RECT *rect, HWND hWnd,
|
||||||
/* Fill the caption with COLOR_(IN)ACTIVECAPTION.
|
/* Fill the caption with COLOR_(IN)ACTIVECAPTION.
|
||||||
In the future this will be GradientFill() */
|
In the future this will be GradientFill() */
|
||||||
|
|
||||||
SelectObject( hDC, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) );
|
SelectObject( hDC, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_ACTIVECAPTION) );
|
||||||
PatBlt(hDC,rect->left + 3, rect->top + 3, rect->right - 6, rect->bottom - 1, PATCOPY );
|
PatBlt(hDC,rect->left + 3, rect->top + 3, rect->right - 6, rect->bottom - 1, PATCOPY );
|
||||||
|
|
||||||
if (style & WS_SYSMENU)
|
if (style & WS_SYSMENU)
|
||||||
|
@ -377,7 +396,6 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
|
||||||
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);
|
|
||||||
InflateRect(&rect, -1, -1);
|
InflateRect(&rect, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.6 2003/03/01 06:05:36 rcampbell Exp $
|
/* $Id: draw.c,v 1.7 2003/03/01 08:56:34 rcampbell Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -473,8 +473,8 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
|
||||||
* otherwise.
|
* otherwise.
|
||||||
* Dennis Björklund, 10 June, 99
|
* Dennis Björklund, 10 June, 99
|
||||||
*/
|
*/
|
||||||
/* if( TWEAK_WineLook == WIN98_LOOK && LTInnerI != -1 )
|
/* if( TWEAK_WineLook == WIN98_LOOK && LTInnerI != -1 ) */
|
||||||
LTInnerI = RBInnerI = COLOR_BTNFACE; */
|
LTInnerI = RBInnerI = COLOR_BTNFACE;
|
||||||
}
|
}
|
||||||
else if(uFlags & BF_SOFT)
|
else if(uFlags & BF_SOFT)
|
||||||
{
|
{
|
||||||
|
@ -894,7 +894,13 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
COLORREF clrsave;
|
COLORREF clrsave;
|
||||||
SIZE size;
|
SIZE size;
|
||||||
|
|
||||||
UITOOLS95_DFC_ButtonPush(dc, r, uFlags & 0xff00);
|
//UITOOLS95_DFC_ButtonPush(dc, r, uFlags & 0xff00);
|
||||||
|
if(uFlags & DFCS_PUSHED)
|
||||||
|
UITOOLS95_DrawRectEdge(dc,r,BDR_SUNKENINNER | BDR_SUNKENOUTER, BF_RECT |
|
||||||
|
BF_SOFT | BF_MIDDLE);
|
||||||
|
else
|
||||||
|
UITOOLS95_DrawRectEdge(dc,r,BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT |
|
||||||
|
BF_SOFT | BF_MIDDLE);
|
||||||
|
|
||||||
switch(uFlags & 0xff)
|
switch(uFlags & 0xff)
|
||||||
{
|
{
|
||||||
|
@ -937,7 +943,6 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
start.y++;
|
start.y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now use the width of each line */
|
|
||||||
width -= numLines - 1;
|
width -= numLines - 1;
|
||||||
|
|
||||||
for (i = 0; i < numLines; i++)
|
for (i = 0; i < numLines; i++)
|
||||||
|
@ -950,6 +955,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectObject(dc, hpsave);
|
SelectObject(dc, hpsave);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,10 +1047,8 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here the drawing takes place */
|
|
||||||
if(uFlags & DFCS_INACTIVE)
|
if(uFlags & DFCS_INACTIVE)
|
||||||
{
|
{
|
||||||
/* If we have an inactive button, then you see a shadow */
|
|
||||||
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
|
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
|
||||||
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT));
|
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT));
|
||||||
Polygon(dc, Line1, Line1N);
|
Polygon(dc, Line1, Line1N);
|
||||||
|
@ -1054,7 +1058,6 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
SelectObject(dc, hbsave);
|
SelectObject(dc, hbsave);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Correct for the shadow shift */
|
|
||||||
if (!(uFlags & DFCS_PUSHED))
|
if (!(uFlags & DFCS_PUSHED))
|
||||||
{
|
{
|
||||||
for(i = 0; i < Line1N; i++)
|
for(i = 0; i < Line1N; i++)
|
||||||
|
@ -1069,7 +1072,6 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make the final picture */
|
|
||||||
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(colorIdx));
|
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(colorIdx));
|
||||||
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx));
|
hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue