[COMCTL32] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=66800
This commit is contained in:
Amine Khaldi 2015-03-19 12:07:32 +00:00
parent 42280af1d7
commit aa6974689d
18 changed files with 1352 additions and 197 deletions

View file

@ -22,6 +22,7 @@ list(APPEND SOURCE
flatsb.c
header.c
hotkey.c
icon.c
imagelist.c
ipaddress.c
listview.c
@ -41,6 +42,7 @@ list(APPEND SOURCE
theme_dialog.c
theme_edit.c
theme_listbox.c
theme_scrollbar.c
theming.c
toolbar.c
tooltips.c

File diff suppressed because it is too large Load diff

View file

@ -666,8 +666,8 @@ static HANDLE create_mru_list(LPWINEMRULIST mp)
/* get values from key 'MRUList' */
if (newkey) {
datasize = (mp->extview.uMax + 1) * sizeof(WCHAR);
if((err=RegQueryValueExW( newkey, strMRUList, 0, &type,
(LPBYTE)mp->realMRU, &datasize))) {
if (RegQueryValueExW( newkey, strMRUList, 0, &type,
(LPBYTE)mp->realMRU, &datasize)) {
/* not present - set size to 1 (will become 0 later) */
datasize = 1;
*mp->realMRU = 0;

View file

@ -1808,6 +1808,15 @@ HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnBu
return S_OK;
}
/***********************************************************************
* LoadIconWithScaleDown [COMCTL32.@]
*/
HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR name, int cx, int cy, HICON *icon)
{
FIXME("stub: %p %s %d %d %p\n", hinst, wine_dbgstr_w(name), cx, cy, icon);
return E_NOTIMPL;
}
/***********************************************************************
* RegisterClassNameW [COMCTL32.@]
*

View file

@ -378,10 +378,7 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
if (ret) return phdi->rect.right;
}
else
{
HEADER_FillItemFrame(infoPtr, hdc, &r, phdi, bHotTrack);
HEADER_DrawItemFrame(infoPtr, hdc, &r, phdi);
}
if (phdi->bDown) {
r.left += 2;
@ -399,7 +396,7 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
BITMAP bmp;
HEADER_PrepareCallbackItems(infoPtr, iItem, HDI_TEXT|HDI_IMAGE);
cw = tw = iw = bw = 0;
cw = iw = bw = 0;
rw = r.right - r.left;
rh = r.bottom - r.top;

View file

@ -586,6 +586,7 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
INT dxHotspot, INT dyHotspot)
{
INT cx, cy;
POINT src, dst;
TRACE("(himlTrack=%p iTrack=%d dx=%d dy=%d)\n", himlTrack, iTrack,
dxHotspot, dyHotspot);
@ -593,8 +594,11 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
if (!is_valid(himlTrack))
return FALSE;
if (iTrack >= himlTrack->cCurImage)
return FALSE;
if (InternalDrag.himl)
ImageList_EndDrag ();
return FALSE;
cx = himlTrack->cx;
cy = himlTrack->cy;
@ -609,10 +613,12 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
InternalDrag.dyHotspot = dyHotspot;
/* copy image */
BitBlt (InternalDrag.himl->hdcImage, 0, 0, cx, cy, himlTrack->hdcImage, iTrack * cx, 0, SRCCOPY);
/* copy mask */
BitBlt (InternalDrag.himl->hdcMask, 0, 0, cx, cy, himlTrack->hdcMask, iTrack * cx, 0, SRCCOPY);
imagelist_point_from_index(InternalDrag.himl, 0, &dst);
imagelist_point_from_index(himlTrack, iTrack, &src);
BitBlt(InternalDrag.himl->hdcImage, dst.x, dst.y, cx, cy, himlTrack->hdcImage, src.x, src.y,
SRCCOPY);
BitBlt(InternalDrag.himl->hdcMask, dst.x, dst.y, cx, cy, himlTrack->hdcMask, src.x, src.y,
SRCCOPY);
InternalDrag.himl->cCurImage = 1;

View file

@ -136,36 +136,64 @@ static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc)
static const WCHAR dotW[] = { '.', 0 };
RECT rect, rcPart;
COLORREF bgCol, fgCol;
int i;
HTHEME theme;
int i, state = ETS_NORMAL;
TRACE("\n");
GetClientRect (infoPtr->Self, &rect);
if (infoPtr->Enabled) {
bgCol = comctl32_color.clrWindow;
fgCol = comctl32_color.clrWindowText;
theme = OpenThemeData(infoPtr->Self, WC_EDITW);
if (theme) {
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
if (!infoPtr->Enabled)
state = ETS_DISABLED;
else if (dwStyle & ES_READONLY)
state = ETS_READONLY;
else if (GetFocus() == infoPtr->Self)
state = ETS_FOCUSED;
GetThemeColor(theme, EP_EDITTEXT, state, TMT_FILLCOLOR, &bgCol);
GetThemeColor(theme, EP_EDITTEXT, state, TMT_TEXTCOLOR, &fgCol);
if (IsThemeBackgroundPartiallyTransparent (theme, EP_EDITTEXT, state))
DrawThemeParentBackground(infoPtr->Self, hdc, &rect);
DrawThemeBackground (theme, hdc, EP_EDITTEXT, state, &rect, 0);
} else {
bgCol = comctl32_color.clr3dFace;
fgCol = comctl32_color.clrGrayText;
if (infoPtr->Enabled) {
bgCol = comctl32_color.clrWindow;
fgCol = comctl32_color.clrWindowText;
} else {
bgCol = comctl32_color.clr3dFace;
fgCol = comctl32_color.clrGrayText;
}
FillRect (hdc, &rect, (HBRUSH)(DWORD_PTR)(bgCol+1));
DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
}
FillRect (hdc, &rect, (HBRUSH)(DWORD_PTR)(bgCol+1));
DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
SetBkColor (hdc, bgCol);
SetTextColor(hdc, fgCol);
for (i = 0; i < 3; i++) {
GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart);
MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 );
rect.left = rcPart.right;
GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart);
rect.left = rcPart.right;
GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart);
MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 );
rect.right = rcPart.left;
DrawTextW(hdc, dotW, 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
rect.right = rcPart.left;
if (theme)
DrawThemeText(theme, hdc, EP_EDITTEXT, state, dotW, 1, DT_SINGLELINE | DT_CENTER | DT_BOTTOM, 0, &rect);
else
DrawTextW(hdc, dotW, 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
}
if (theme)
CloseThemeData(theme);
return 0;
}

View file

@ -3998,10 +3998,7 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
rect.top = rect.bottom = infoPtr->ptClickPos.y;
InflateRect(&rect, GetSystemMetrics(SM_CXDRAG), GetSystemMetrics(SM_CYDRAG));
}
if (infoPtr->bLButtonDown)
{
if (infoPtr->bMarqueeSelect)
{
POINT coords_orig;

View file

@ -269,23 +269,33 @@ static void draw_theme_bar_V (const ProgressDrawInfo* di, int start, int end)
/* draw themed horizontal background from 'start' to 'end' */
static void draw_theme_bkg_H (const ProgressDrawInfo* di, int start, int end)
{
RECT r;
RECT bgrect, r;
r.left = di->rect.left + start;
r.top = di->rect.top;
r.right = di->rect.left + end;
r.bottom = di->rect.bottom;
DrawThemeBackground (di->theme, di->hdc, PP_BAR, 0, &di->bgRect, &r);
bgrect = di->bgRect;
OffsetRect(&bgrect, -bgrect.left, -bgrect.top);
DrawThemeBackground (di->theme, di->hdc, PP_BAR, 0, &bgrect, &r);
}
/* draw themed vertical background from 'start' to 'end' */
static void draw_theme_bkg_V (const ProgressDrawInfo* di, int start, int end)
{
RECT r;
RECT bgrect, r;
r.left = di->rect.left;
r.top = di->rect.bottom - end;
r.right = di->rect.right;
r.bottom = di->rect.bottom - start;
DrawThemeBackground (di->theme, di->hdc, PP_BARVERT, 0, &di->bgRect, &r);
bgrect = di->bgRect;
OffsetRect(&bgrect, -bgrect.left, -bgrect.top);
DrawThemeBackground (di->theme, di->hdc, PP_BARVERT, 0, &bgrect, &r);
}
/* drawing functions for themed style */

View file

@ -2414,6 +2414,8 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON);
HWND hwndNext = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON);
HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON);
BOOL enable_finish = ((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH);
#ifdef __REACTOS__
HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL);
INT iDefItem = 0;
@ -2422,13 +2424,13 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
TRACE("%d\n", dwFlags);
EnableWindow(hwndBack, FALSE);
EnableWindow(hwndNext, FALSE);
EnableWindow(hwndFinish, FALSE);
EnableWindow(hwndBack, dwFlags & PSWIZB_BACK);
EnableWindow(hwndNext, dwFlags & PSWIZB_NEXT);
EnableWindow(hwndFinish, enable_finish);
#ifndef __REACTOS__
/* set the default pushbutton to an enabled button */
if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
if (enable_finish)
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
else if (dwFlags & PSWIZB_NEXT)
SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
@ -2438,13 +2440,6 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
#endif
if (dwFlags & PSWIZB_BACK)
EnableWindow(hwndBack, TRUE);
if (dwFlags & PSWIZB_NEXT)
EnableWindow(hwndNext, TRUE);
if (!psInfo->hasFinish)
{
if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH))
@ -2454,9 +2449,6 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
/* Show the Finish button */
ShowWindow(hwndFinish, SW_SHOW);
if (!(dwFlags & PSWIZB_DISABLEDFINISH))
EnableWindow(hwndFinish, TRUE);
}
else
{
@ -2466,8 +2458,6 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
ShowWindow(hwndNext, SW_SHOW);
}
}
else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
EnableWindow(hwndFinish, TRUE);
#ifdef __REACTOS__
/* set the default pushbutton to an enabled button */

View file

@ -275,7 +275,7 @@ LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
* PARAMS
* lpszStr [I] First string to compare
* lpszComp [I] Second string to compare
* iLen [I] Maximum number of chars to compare.
* iLen [I] Number of chars to compare
*
* RETURNS
* An integer less than, equal to or greater than 0, indicating that
@ -307,13 +307,15 @@ static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch,
INT (WINAPI *pStrCmpFn)(LPCSTR,LPCSTR,INT))
{
size_t iLen;
LPCSTR end;
if (!lpszStr || !lpszSearch || !*lpszSearch)
return NULL;
iLen = strlen(lpszSearch);
end = lpszStr + strlen(lpszStr);
while (*lpszStr)
while (lpszStr + iLen <= end)
{
if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
return (LPSTR)lpszStr;
@ -366,6 +368,7 @@ INT WINAPI StrToIntA (LPCSTR lpszStr)
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
{
int iLen;
LPCWSTR end;
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@ -373,8 +376,9 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
return NULL;
iLen = strlenW(lpszSearch);
end = lpszStr + strlenW(lpszStr);
while (*lpszStr)
while (lpszStr + iLen <= end)
{
if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
return (LPWSTR)lpszStr;
@ -464,7 +468,7 @@ LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
* PARAMS
* lpszStr [I] First string to compare
* lpszComp [I] Second string to compare
* iLen [I] Maximum number of chars to compare.
* iLen [I] Number of chars to compare
*
* RETURNS
* An integer less than, equal to or greater than 0, indicating that
@ -654,18 +658,20 @@ LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
if (!lpszStr || !lpszSearch || !*lpszSearch)
return NULL;
if (!lpszEnd)
lpszEnd = lpszStr + lstrlenA(lpszStr);
if (IsDBCSLeadByte(*lpszSearch))
ch1 = *lpszSearch << 8 | lpszSearch[1];
ch1 = *lpszSearch << 8 | (UCHAR)lpszSearch[1];
else
ch1 = *lpszSearch;
iLen = lstrlenA(lpszSearch);
while (lpszStr <= lpszEnd && *lpszStr)
if (!lpszEnd)
lpszEnd = lpszStr + lstrlenA(lpszStr);
else /* reproduce the broken behaviour on Windows */
lpszEnd += min(iLen - 1, lstrlenA(lpszEnd));
while (lpszStr + iLen <= lpszEnd && *lpszStr)
{
ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | (UCHAR)lpszStr[1] : *lpszStr;
if (!COMCTL32_ChrCmpIA(ch1, ch2))
{
if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
@ -691,12 +697,15 @@ LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
if (!lpszStr || !lpszSearch || !*lpszSearch)
return NULL;
if (!lpszEnd)
lpszEnd = lpszStr + strlenW(lpszStr);
iLen = strlenW(lpszSearch);
while (lpszStr <= lpszEnd && *lpszStr)
if (!lpszEnd)
lpszEnd = lpszStr + strlenW(lpszStr);
else /* reproduce the broken behaviour on Windows */
lpszEnd += min(iLen - 1, lstrlenW(lpszEnd));
while (lpszStr + iLen <= lpszEnd && *lpszStr)
{
if (!COMCTL32_ChrCmpIW(*lpszSearch, *lpszStr))
{
@ -839,16 +848,15 @@ int WINAPI StrCSpnW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
BOOL WINAPI IntlStrEqWorkerA(BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp,
int iLen)
{
DWORD dwFlags = LOCALE_USE_CP_ACP;
DWORD dwFlags;
int iRet;
TRACE("(%d,%s,%s,%d)\n", bCase,
debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
/* FIXME: This flag is undocumented and unknown by our CompareString.
* We need a define for it.
*/
dwFlags = 0x10000000;
dwFlags = LOCALE_RETURN_GENITIVE_NAMES;
if (!bCase) dwFlags |= NORM_IGNORECASE;
iRet = CompareStringA(GetThreadLocale(),
@ -875,9 +883,8 @@ BOOL WINAPI IntlStrEqWorkerW(BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp,
debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
/* FIXME: This flag is undocumented and unknown by our CompareString.
* We need a define for it.
*/
dwFlags = 0x10000000;
dwFlags = LOCALE_RETURN_GENITIVE_NAMES;
if (!bCase) dwFlags |= NORM_IGNORECASE;
iRet = CompareStringW(GetThreadLocale(),

View file

@ -173,6 +173,26 @@ static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr)
infoPtr->Items = NULL;
}
/***********************************************************************
* SYSLINK_StrCmpNIW
* Wrapper for StrCmpNIW to ensure 'len' is not too big.
*/
static INT SYSLINK_StrCmpNIW (LPCWSTR str, LPCWSTR comp, INT len)
{
INT i;
for(i = 0; i < len; i++)
{
if(!str[i])
{
len = i + 1;
break;
}
}
return StrCmpNIW(str, comp, len);
}
/***********************************************************************
* SYSLINK_ParseText
* Parses the window text string and creates a document. Returns the
@ -193,7 +213,7 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{
if(*current == '<')
{
if(!StrCmpNIW(current, SL_LINKOPEN, 2) && (CurrentType == slText))
if(!SYSLINK_StrCmpNIW(current, SL_LINKOPEN, 2) && (CurrentType == slText))
{
BOOL ValidParam = FALSE, ValidLink = FALSE;
@ -221,14 +241,14 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
CheckParameter:
/* compare the current position with all known parameters */
if(!StrCmpNIW(tmp, SL_HREF, 6))
if(!SYSLINK_StrCmpNIW(tmp, SL_HREF, 6))
{
taglen += 6;
ValidParam = TRUE;
CurrentParameter = &lpUrl;
CurrentParameterLen = &lenUrl;
}
else if(!StrCmpNIW(tmp, SL_ID, 4))
else if(!SYSLINK_StrCmpNIW(tmp, SL_ID, 4))
{
taglen += 4;
ValidParam = TRUE;
@ -302,7 +322,7 @@ CheckParameter:
}
}
}
else if(!StrCmpNIW(current, SL_LINKCLOSE, 4) && (CurrentType == slLink) && firsttag)
else if(!SYSLINK_StrCmpNIW(current, SL_LINKCLOSE, 4) && (CurrentType == slLink) && firsttag)
{
/* there's a <a...> tag opened, first add the previous text, if present */
if(textstart != NULL && textlen > 0 && firsttag > textstart)

View file

@ -20,6 +20,7 @@
*/
#include "comctl32.h"
WINE_DEFAULT_DEBUG_CHANNEL(theme_button);
#define BUTTON_TYPE 0x0f /* bit mask for the available button types */
@ -33,7 +34,7 @@ typedef enum
STATE_DEFAULTED
} ButtonState;
typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags);
typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused);
static UINT get_drawtext_flags(DWORD style, DWORD ex_style)
{
@ -86,7 +87,7 @@ static inline WCHAR *get_button_text(HWND hwnd)
return text;
}
static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags)
static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
{
static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
@ -108,10 +109,25 @@ static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
HeapFree(GetProcessHeap(), 0, text);
}
if (focused)
{
MARGINS margins;
RECT focusRect = bgRect;
GetThemeMargins(theme, hDC, BP_PUSHBUTTON, state, TMT_CONTENTMARGINS, NULL, &margins);
focusRect.left += margins.cxLeftWidth;
focusRect.top += margins.cyTopHeight;
focusRect.right -= margins.cxRightWidth;
focusRect.bottom -= margins.cyBottomHeight;
DrawFocusRect( hDC, &focusRect );
}
if (hPrevFont) SelectObject(hDC, hPrevFont);
}
static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags)
static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
{
static const int cb_states[3][5] =
{
@ -129,8 +145,7 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
static const int cb_size = 13;
RECT bgRect, textRect;
HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
HFONT font, hPrevFont = NULL;
LRESULT checkState = SendMessageW(hwnd, BM_GETCHECK, 0, 0);
DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
int part = ((dwStyle & BUTTON_TYPE) == BS_RADIOBUTTON) || ((dwStyle & BUTTON_TYPE) == BS_AUTORADIOBUTTON)
@ -140,6 +155,23 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
? cb_states[ checkState ][ drawState ]
: rb_states[ checkState ][ drawState ];
WCHAR *text = get_button_text(hwnd);
LOGFONTW lf;
BOOL created_font = FALSE;
HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
if (SUCCEEDED(hr)) {
font = CreateFontIndirectW(&lf);
if (!font)
TRACE("Failed to create font\n");
else {
TRACE("font = %s\n", debugstr_w(lf.lfFaceName));
hPrevFont = SelectObject(hDC, font);
created_font = TRUE;
}
} else {
font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
hPrevFont = SelectObject(hDC, font);
}
GetClientRect(hwnd, &bgRect);
GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
@ -152,27 +184,58 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
bgRect.right = bgRect.left + cb_size;
textRect.left = bgRect.right + 6;
if (IsThemeBackgroundPartiallyTransparent(theme, part, state))
DrawThemeParentBackground(hwnd, hDC, NULL);
DrawThemeParentBackground(hwnd, hDC, NULL);
DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
if (text)
{
DrawThemeText(theme, hDC, part, state, text, lstrlenW(text), dtFlags, 0, &textRect);
if (focused)
{
RECT focusRect;
focusRect = textRect;
DrawTextW(hDC, text, lstrlenW(text), &focusRect, dtFlags | DT_CALCRECT);
if (focusRect.right < textRect.right) focusRect.right++;
focusRect.bottom = textRect.bottom;
DrawFocusRect( hDC, &focusRect );
}
HeapFree(GetProcessHeap(), 0, text);
}
if (created_font) DeleteObject(font);
if (hPrevFont) SelectObject(hDC, hPrevFont);
}
static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags)
static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
{
static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
RECT bgRect, textRect, contentRect;
HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
int state = states[ drawState ];
WCHAR *text = get_button_text(hwnd);
LOGFONTW lf;
HFONT font, hPrevFont = NULL;
BOOL created_font = FALSE;
HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
if (SUCCEEDED(hr)) {
font = CreateFontIndirectW(&lf);
if (!font)
TRACE("Failed to create font\n");
else {
hPrevFont = SelectObject(hDC, font);
created_font = TRUE;
}
} else {
font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
hPrevFont = SelectObject(hDC, font);
}
GetClientRect(hwnd, &bgRect);
textRect = bgRect;
@ -206,6 +269,7 @@ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
HeapFree(GetProcessHeap(), 0, text);
}
if (created_font) DeleteObject(font);
if (hPrevFont) SelectObject(hDC, hPrevFont);
}
@ -253,7 +317,7 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
else drawState = STATE_DISABLED;
hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
paint(theme, hwnd, hDC, drawState, dtFlags);
paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS);
if (!hParamDC) EndPaint(hwnd, &ps);
return TRUE;
}

View file

@ -108,6 +108,8 @@ LRESULT CALLBACK THEMING_EditSubclassProc (HWND hwnd, UINT msg,
break;
case WM_ENABLE:
case WM_KILLFOCUS:
case WM_SETFOCUS:
theme = GetWindowTheme( hwnd );
if (theme) RedrawWindow (hwnd, NULL, NULL,
RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);

View file

@ -36,6 +36,8 @@ extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
static const WCHAR dialogClass[] = {'#','3','2','7','7','0',0};
static const WCHAR comboLboxClass[] = {'C','o','m','b','o','L','b','o','x',0};
@ -51,7 +53,8 @@ static const struct ThemingSubclass
{WC_COMBOBOXW, THEMING_ComboSubclassProc},
{comboLboxClass, THEMING_ListBoxSubclassProc},
{WC_EDITW, THEMING_EditSubclassProc},
{WC_LISTBOXW, THEMING_ListBoxSubclassProc}
{WC_LISTBOXW, THEMING_ListBoxSubclassProc},
{WC_SCROLLBARW, THEMING_ScrollbarSubclassProc}
};
#define NUM_SUBCLASSES (sizeof(subclasses)/sizeof(subclasses[0]))
@ -87,6 +90,7 @@ MAKE_SUBCLASS_PROC(2)
MAKE_SUBCLASS_PROC(3)
MAKE_SUBCLASS_PROC(4)
MAKE_SUBCLASS_PROC(5)
MAKE_SUBCLASS_PROC(6)
static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
subclass_proc0,
@ -94,7 +98,8 @@ static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
subclass_proc2,
subclass_proc3,
subclass_proc4,
subclass_proc5
subclass_proc5,
subclass_proc6
};
/***********************************************************************

View file

@ -5186,8 +5186,6 @@ TOOLBAR_SetHotItem2 (TOOLBAR_INFO *infoPtr, INT nHotItem, LPARAM lParam)
TOOLBAR_SetHotItemEx(infoPtr, nHotItem, lParam);
GetFocus();
return (nOldHotItem < 0) ? -1 : (LRESULT)nOldHotItem;
}

View file

@ -221,7 +221,7 @@ TOOLTIPS_customdraw_fill(const TOOLTIPS_INFO *infoPtr, NMTTCUSTOMDRAW *lpnmttcd,
static inline DWORD
TOOLTIPS_notify_customdraw (DWORD dwDrawStage, NMTTCUSTOMDRAW *lpnmttcd)
{
LRESULT result = CDRF_DODEFAULT;
LRESULT result;
lpnmttcd->nmcd.dwDrawStage = dwDrawStage;
TRACE("Notifying stage %d, flags %x, id %x\n", lpnmttcd->nmcd.dwDrawStage,
@ -471,12 +471,13 @@ TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
{
TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool];
if (IS_INTRESOURCE(toolPtr->lpszText) && toolPtr->hinst) {
/* load a resource */
TRACE("load res string %p %x\n",
toolPtr->hinst, LOWORD(toolPtr->lpszText));
LoadStringW (toolPtr->hinst, LOWORD(toolPtr->lpszText),
buffer, INFOTIPSIZE);
/* always NULL-terminate the buffer, just in case we fail to load the string */
buffer[0] = '\0';
if (IS_INTRESOURCE(toolPtr->lpszText)) {
HINSTANCE hinst = toolPtr->hinst ? toolPtr->hinst : GetModuleHandleW(NULL);
/* load a resource */
TRACE("load res string %p %x\n", hinst, LOWORD(toolPtr->lpszText));
LoadStringW (hinst, LOWORD(toolPtr->lpszText), buffer, INFOTIPSIZE);
}
else if (toolPtr->lpszText) {
if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) {
@ -492,7 +493,6 @@ TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
}
else {
/* no text available */
buffer[0] = '\0';
}
TRACE("%s\n", debugstr_w(buffer));

View file

@ -61,7 +61,7 @@ reactos/dll/win32/browseui # Out of sync
reactos/dll/win32/cabinet # Synced to WineStaging-1.7.37
reactos/dll/win32/clusapi # Synced to Wine-1.7.27
reactos/dll/win32/comcat # Synced to Wine-1.7.27
reactos/dll/win32/comctl32 # Synced to Wine-1.7.27
reactos/dll/win32/comctl32 # Synced to WineStaging-1.7.37
reactos/dll/win32/comdlg32 # Synced to Wine-1.7.27
reactos/dll/win32/compstui # Synced to Wine-1.7.27
reactos/dll/win32/credui # Synced to Wine-1.7.27