Added DrawCaption[16/32] and DrawCaptionTemp[16/32A/32W].

Fixed handling of WS_EX_TOOLWINDOW.
This commit is contained in:
Eric Kohl 1998-10-11 13:06:35 +00:00 committed by Alexandre Julliard
parent 98dfbe1558
commit 8e517b5ce1
4 changed files with 203 additions and 16 deletions

View File

@ -498,10 +498,10 @@ file user.exe
654 stub UnloadKeyboardLayout
655 stub PostPostedMessages
656 pascal16 DrawFrameControl(word ptr word word) DrawFrameControl16
657 stub DrawCaptionTemp
657 pascal16 DrawCaptionTemp(word word ptr word word ptr word) DrawCaptionTemp16
658 stub DispatchInput
659 pascal16 DrawEdge(word ptr word word) DrawEdge16
660 stub DrawCaption
660 pascal16 DrawCaption(word word ptr word) DrawCaption16
661 stub SetSysColorsTemp
662 stub DrawMenubarTemp
663 stub GetMenuDefaultItem

View File

@ -3565,6 +3565,13 @@ DECL_WINELIB_TYPE_AW(LPMENUITEMINFO)
#define DT_NOPREFIX 2048
#define DT_INTERNAL 4096
/* DrawCaption()/DrawCaptionTemp() flags */
#define DC_ACTIVE 0x0001
#define DC_SMALLCAP 0x0002
#define DC_ICON 0x0004
#define DC_TEXT 0x0008
#define DC_INBUTTON 0x0010
/* DrawEdge() flags */
#define BDR_RAISEDOUTER 0x0001
#define BDR_SUNKENOUTER 0x0002
@ -7450,6 +7457,13 @@ BOOL32 WINAPI DragDetect32(HWND32,POINT32);
DWORD WINAPI DragObject16(HWND16,HWND16,UINT16,HANDLE16,WORD,HCURSOR16);
DWORD WINAPI DragObject32(HWND32,HWND32,UINT32,DWORD,HCURSOR32);
#define DragObject WINELIB_NAME(DragObject)
BOOL16 WINAPI DrawCaption16(HWND16,HDC16,const RECT16*,UINT16);
BOOL32 WINAPI DrawCaption32(HWND32,HDC32,const RECT32*,UINT32);
#define DrawCaption WINELIB_NAME(DrawCaption)
BOOL16 WINAPI DrawCaptionTemp16(HWND16,HDC16, const RECT16*,HFONT16,HICON16,LPCSTR,UINT16);
BOOL32 WINAPI DrawCaptionTemp32A(HWND32,HDC32,const RECT32*,HFONT32,HICON32,LPCSTR,UINT32);
BOOL32 WINAPI DrawCaptionTemp32W(HWND32,HDC32,const RECT32*,HFONT32,HICON32,LPCWSTR,UINT32);
#define DrawCaptionTemp WINELIB_NAME_AW(DrawCaptionTemp)
BOOL16 WINAPI DrawEdge16(HDC16,LPRECT16,UINT16,UINT16);
BOOL32 WINAPI DrawEdge32(HDC32,LPRECT32,UINT32,UINT32);
#define DrawEdge WINELIB_NAME(DrawEdge)

View File

@ -154,7 +154,7 @@ type win32
151 stdcall DragDetect(long long long) DragDetect32
152 stub DragObject
153 stdcall DrawAnimatedRects(long long ptr ptr) DrawAnimatedRects32
154 stub DrawCaption
154 stdcall DrawCaption(long long ptr long) DrawCaption32
155 stdcall DrawEdge(long ptr long long) DrawEdge32
156 stdcall DrawFocusRect(long ptr) DrawFocusRect32
157 stub DrawFrame
@ -603,7 +603,7 @@ type win32
599 stdcall DrawCaptionTempA(long long ptr long long str long) DrawCaptionTemp32A
600 stub RegisterNetworkCapabilities
601 stub WNDPROC_CALLBACK
602 stub DrawCaptionTempW
602 stdcall DrawCaptionTempW(long long ptr long long wstr long) DrawCaptionTemp32W
603 stub IsHungAppWindow
604 stub ChangeDisplaySettingsA
605 stub ChangeDisplaySettingsW

View File

@ -24,7 +24,7 @@
#include "tweak.h"
#include "debug.h"
#include "options.h"
#include "cache.h"
static HBITMAP16 hbitmapClose = 0;
static HBITMAP16 hbitmapCloseD = 0;
@ -217,20 +217,186 @@ NC_AdjustRectInner95 (LPRECT16 rect, DWORD style, DWORD exStyle)
/***********************************************************************
* DrawCaptionTempA [USER32.599]
* DrawCaption16 [USER.660] Draws a caption bar
*
* PARAMS
* hwnd [I]
* hdc [I]
* lpRect [I]
* uFlags [I]
*
*/
DWORD WINAPI
DrawCaptionTemp32A (HWND32 hwnd, HDC32 hdc, LPRECT32 rect,
HFONT32 hfont,DWORD x1,LPCSTR str,DWORD x2)
BOOL16 WINAPI
DrawCaption16 (HWND16 hwnd, HDC16 hdc, const RECT16 *lpRect, UINT16 uFlags)
{
FIXME (nonclient, "(%08x,%08x,%p,%08x,%08x,\"%s\",%08x): stub\n",
hwnd, hdc, rect, hfont, x1, str, x2);
FIXME (nonclient, " stub!\n");
// return DrawCaptionTemp32A (hwnd, hdc, lpRect, 0, 0, NULL, uFlags & 0x1F);
return 0;
}
/***********************************************************************
* DrawCaption32 [USER32.154] Draws a caption bar
*
* PARAMS
* hwnd [I]
* hdc [I]
* lpRect [I]
* uFlags [I]
*
*/
BOOL32 WINAPI
DrawCaption32 (HWND32 hwnd, HDC32 hdc, const RECT32 *lpRect, UINT32 uFlags)
{
return DrawCaptionTemp32A (hwnd, hdc, lpRect, 0, 0, NULL, uFlags & 0x1F);
}
/***********************************************************************
* DrawCaptionTemp16 [USER.657]
*
*/
BOOL16 WINAPI
DrawCaptionTemp16 (HWND16 hwnd, HDC16 hdc, const RECT16 *rect, HFONT16 hFont,
HICON16 hIcon, LPCSTR str, UINT16 uFlags)
{
FIXME (nonclient, " stub!\n");
// return DrawCaptionTemp32A (hwnd, hdc, lpRect, 0, 0, NULL, uFlags & 0x1F);
return 0;
}
/***********************************************************************
* DrawCaptionTemp32A [USER32.599]
*
*/
BOOL32 WINAPI
DrawCaptionTemp32A (HWND32 hwnd, HDC32 hdc, const RECT32 *rect, HFONT32 hFont,
HICON32 hIcon, LPCSTR str, UINT32 uFlags)
{
RECT32 rc = *rect;
TRACE (nonclient, "(%08x,%08x,%p,%08x,%08x,\"%s\",%08x)\n",
hwnd, hdc, rect, hFont, hIcon, str, uFlags);
/* drawing background */
if (uFlags & DC_INBUTTON) {
FillRect32 (hdc, &rc, GetSysColorBrush32 (COLOR_3DFACE));
if (uFlags & DC_ACTIVE) {
HBRUSH32 hbr = SelectObject32 (hdc, CACHE_GetPattern55AABrush ());
PatBlt32 (hdc, rc.left, rc.top,
rc.right-rc.left, rc.bottom-rc.top, 0xFA0089);
SelectObject32 (hdc, hbr);
}
}
else {
FillRect32 (hdc, &rc, GetSysColorBrush32 ((uFlags & DC_ACTIVE) ?
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
}
/* drawing icon */
if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP)) {
POINT32 pt;
pt.x = rc.left + 2;
pt.y = (rc.bottom + rc.top - sysMetrics[SM_CYSMICON]) / 2;
if (hIcon) {
DrawIconEx32 (hdc, pt.x, pt.y, hIcon, sysMetrics[SM_CXSMICON],
sysMetrics[SM_CYSMICON], 0, 0, DI_NORMAL);
}
else {
WND *wndPtr = WIN_FindWndPtr(hwnd);
HICON32 hAppIcon = 0;
if (wndPtr->class->hIconSm)
hAppIcon = wndPtr->class->hIconSm;
else if (wndPtr->class->hIcon)
hAppIcon = wndPtr->class->hIcon;
DrawIconEx32 (hdc, pt.x, pt.y, hAppIcon, sysMetrics[SM_CXSMICON],
sysMetrics[SM_CYSMICON], 0, 0, DI_NORMAL);
}
rc.left += (rc.bottom - rc.top);
}
/* drawing text */
if (uFlags & DC_TEXT) {
HFONT32 hOldFont;
if (uFlags & DC_INBUTTON)
SetTextColor32 (hdc, GetSysColor32 (COLOR_BTNTEXT));
else if (uFlags & DC_ACTIVE)
SetTextColor32 (hdc, GetSysColor32 (COLOR_CAPTIONTEXT));
else
SetTextColor32 (hdc, GetSysColor32 (COLOR_INACTIVECAPTIONTEXT));
SetBkMode32 (hdc, TRANSPARENT);
if (hFont)
hOldFont = SelectObject32 (hdc, hFont);
else {
NONCLIENTMETRICS32A nclm;
HFONT32 hNewFont;
nclm.cbSize = sizeof(NONCLIENTMETRICS32A);
SystemParametersInfo32A (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
hNewFont = CreateFontIndirect32A ((uFlags & DC_SMALLCAP) ?
&nclm.lfSmCaptionFont : &nclm.lfCaptionFont);
hOldFont = SelectObject32 (hdc, hNewFont);
}
if (str)
DrawText32A (hdc, str, -1, &rc,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
else {
CHAR szText[128];
INT32 nLen;
nLen = GetWindowText32A (hwnd, szText, 128);
DrawText32A (hdc, szText, nLen, &rc,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
}
if (hFont)
SelectObject32 (hdc, hOldFont);
else
DeleteObject32 (SelectObject32 (hdc, hOldFont));
}
/* drawing focus ??? */
if (uFlags & 0x2000)
FIXME (nonclient, "undocumented flag (0x2000)!\n");
return 0;
}
/***********************************************************************
* DrawCaptionTemp32W [USER32.602]
*
*/
BOOL32 WINAPI
DrawCaptionTemp32W (HWND32 hwnd, HDC32 hdc, const RECT32 *rect, HFONT32 hFont,
HICON32 hIcon, LPCWSTR str, UINT32 uFlags)
{
LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, str);
BOOL32 res = DrawCaptionTemp32A (hwnd, hdc, rect, hFont, hIcon, p, uFlags);
HeapFree (GetProcessHeap (), 0, p);
return res;
}
/***********************************************************************
* AdjustWindowRect16 (USER.102)
*/
@ -1252,10 +1418,11 @@ static void NC_DrawCaption( HDC32 hdc, RECT32 *rect, HWND32 hwnd,
static void NC_DrawCaption95(
HDC32 hdc,
RECT32 *rect,
RECT32 *rect,
HWND32 hwnd,
DWORD style,
BOOL32 active )
DWORD exStyle,
BOOL32 active )
{
RECT32 r = *rect;
WND *wndPtr = WIN_FindWndPtr( hwnd );
@ -1282,9 +1449,11 @@ static void NC_DrawCaption95(
hbitmapRestoreD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORED) );
}
if (style & WS_SYSMENU) {
if ((style & WS_SYSMENU) && !(exStyle & WS_EX_TOOLWINDOW)) {
if (NC_DrawSysButton95 (hwnd, hdc, FALSE))
r.left += sysMetrics[SM_CYCAPTION] - 1;
}
if (style & WS_SYSMENU) {
NC_DrawCloseButton95 (hwnd, hdc, FALSE);
r.right -= sysMetrics[SM_CYCAPTION] - 1;
}
@ -1302,7 +1471,10 @@ static void NC_DrawCaption95(
HFONT32 hFont, hOldFont;
nclm.cbSize = sizeof(NONCLIENTMETRICS32A);
SystemParametersInfo32A (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
hFont = CreateFontIndirect32A (&nclm.lfCaptionFont);
if (exStyle & WS_EX_TOOLWINDOW)
hFont = CreateFontIndirect32A (&nclm.lfSmCaptionFont);
else
hFont = CreateFontIndirect32A (&nclm.lfCaptionFont);
hOldFont = SelectObject32 (hdc, hFont);
if (active) SetTextColor32( hdc, GetSysColor32( COLOR_CAPTIONTEXT ) );
else SetTextColor32( hdc, GetSysColor32( COLOR_INACTIVECAPTIONTEXT ) );
@ -1488,7 +1660,8 @@ void NC_DoNCPaint95(
r.bottom = rect.top + sysMetrics[SM_CYCAPTION];
rect.top += sysMetrics[SM_CYCAPTION];
}
NC_DrawCaption95( hdc, &r, hwnd, wndPtr->dwStyle, active );
NC_DrawCaption95( hdc, &r, hwnd, wndPtr->dwStyle,
wndPtr->dwExStyle,active );
}
}