- Print function name in Wine debugging macros.

- Updated COMCTL32 to Wine 20031212 release.

svn path=/trunk/; revision=7098
This commit is contained in:
Filip Navara
2003-12-17 18:09:54 +00:00
parent c98a386e26
commit 7127873aac
15 changed files with 323 additions and 261 deletions
+12 -4
View File
@@ -2,15 +2,23 @@
#define __WINE_DEBUG_H
#include "../roscfg.h"
#if ! defined(DBG) || ! defined(YDEBUG)
#define NDEBUG
#endif
#include "../debug.h"
#include <stdarg.h>
#include <wchar.h>
ULONG DbgPrint(PCH Format,...);
#define DPRINT1 DbgPrint("(%s:%d:%s) ",__FILE__,__LINE__,__FUNCTION__), DbgPrint
#if !defined(DBG) || !defined(YDEBUG)
#ifdef __GNUC__
#define DPRINT(args...)
#else
#define DPRINT
#endif
#else
#define DPRINT DbgPrint("(%s:%d:%s) ",__FILE__,__LINE__,__FUNCTION__), DbgPrint
#endif
struct _GUID;
/* Exported definitions and macros */
+26 -23
View File
@@ -57,7 +57,8 @@ typedef struct
/* reference to input stream (file or resource) */
HGLOBAL hRes;
HMMIO hMMio; /* handle to mmio stream */
HWND hWnd;
HWND hwndSelf;
HWND hwndNotify;
/* information on the loaded AVI file */
MainAVIHeader mah;
AVIStreamHeader ash;
@@ -88,9 +89,9 @@ typedef struct
static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
{
SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
(LPARAM)infoPtr->hWnd);
SendMessageA(infoPtr->hwndNotify, WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
(LPARAM)infoPtr->hwndSelf);
}
static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
@@ -149,7 +150,7 @@ static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
infoPtr->hThread = 0;
}
if (infoPtr->uTimer) {
KillTimer(infoPtr->hWnd, infoPtr->uTimer);
KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
infoPtr->uTimer = 0;
}
@@ -202,7 +203,7 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
infoPtr->hbmPrevFrame = 0;
}
infoPtr->indata = infoPtr->outdata = NULL;
infoPtr->hWnd = 0;
infoPtr->hwndSelf = 0;
infoPtr->hMMio = 0;
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
@@ -297,7 +298,7 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
infoPtr->transparentColor = GetPixel(hdcMem,0,0);
}
if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
{
HDC hdcFinal = CreateCompatibleDC(hDC);
HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
@@ -322,11 +323,11 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
infoPtr->hbmPrevFrame = hbmFinal;
}
if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER)
if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
{
RECT rect;
GetWindowRect(infoPtr->hWnd, &rect);
GetWindowRect(infoPtr->hwndSelf, &rect);
nOffsetX = ((rect.right - rect.left) - nWidth)/2;
nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
}
@@ -356,9 +357,9 @@ static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
return FALSE;
}
if ((hDC = GetDC(infoPtr->hWnd)) != 0) {
if ((hDC = GetDC(infoPtr->hwndSelf)) != 0) {
ANIMATE_PaintFrame(infoPtr, hDC);
ReleaseDC(infoPtr->hWnd, hDC);
ReleaseDC(infoPtr->hwndSelf, hDC);
}
if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
@@ -387,15 +388,15 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
while(1)
{
if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
{
hDC = GetDC(infoPtr->hWnd);
hDC = GetDC(infoPtr->hwndSelf);
/* sometimes the animation window will be destroyed in between
* by the main program, so a ReleaseDC() error msg is possible */
infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(infoPtr->hWnd),
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC, (WPARAM)hDC,
(LPARAM)infoPtr->hWnd);
ReleaseDC(infoPtr->hWnd,hDC);
(LPARAM)infoPtr->hwndSelf);
ReleaseDC(infoPtr->hwndSelf,hDC);
}
EnterCriticalSection(&infoPtr->cs);
@@ -689,7 +690,7 @@ static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam)
HINSTANCE hInstance = (HINSTANCE)wParam;
ANIMATE_Free(infoPtr);
infoPtr->hWnd = hWnd;
infoPtr->hwndSelf = hWnd;
if (!lParam) {
TRACE("Closing avi!\n");
@@ -787,14 +788,15 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
return 0;
}
TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)GetParent(hWnd));
/* store crossref hWnd <-> info structure */
SetWindowLongA(hWnd, 0, (DWORD)infoPtr);
infoPtr->hWnd = hWnd;
infoPtr->hwndSelf = hWnd;
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
infoPtr->hbmPrevFrame = 0;
TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)infoPtr->hwndNotify);
InitializeCriticalSection(&infoPtr->cs);
return 0;
@@ -819,12 +821,13 @@ static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
RECT rect;
HBRUSH hBrush = 0;
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{
hBrush = (HBRUSH)SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,
hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
}
@@ -882,7 +885,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{
ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(hWnd),
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
}
@@ -902,7 +905,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageA(GetParent(hWnd),
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
+10 -10
View File
@@ -64,6 +64,7 @@ typedef struct
{
HIMAGELIST himl;
HWND hwndSelf; /* my own hwnd */
HWND hwndNotify; /* my parent hwnd */
HWND hwndCombo;
HWND hwndEdit;
WNDPROC prevEditWndProc; /* previous Edit WNDPROC value */
@@ -190,11 +191,9 @@ static INT COMBOEX_Notify (COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr)
hdr->hwndFrom = infoPtr->hwndSelf;
hdr->code = code;
if (infoPtr->NtfUnicode)
return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
(LPARAM)hdr);
return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr);
else
return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,
(LPARAM)hdr);
return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr);
}
@@ -935,8 +934,9 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
infoPtr->selected = -1;
infoPtr->unicode = IsWindowUnicode (hwnd);
infoPtr->hwndNotify = cs->hwndParent;
i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
if ((i != NFR_ANSI) && (i != NFR_UNICODE)) {
WARN("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
i = NFR_ANSI;
@@ -1079,7 +1079,7 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa
INT cursel, n, oldItem;
NMCBEENDEDITW cbeend;
DWORD oldflags;
HWND parent = GetParent (infoPtr->hwndSelf);
HWND parent = infoPtr->hwndNotify;
TRACE("for command %d\n", command);
@@ -1587,7 +1587,7 @@ static LRESULT COMBOEX_NCCreate (HWND hwnd)
static LRESULT COMBOEX_NotifyFormat (COMBOEX_INFO *infoPtr, LPARAM lParam)
{
if (lParam == NF_REQUERY) {
INT i = SendMessageW(GetParent (infoPtr->hwndSelf),
INT i = SendMessageW(infoPtr->hwndNotify,
WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
}
@@ -2070,7 +2070,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* strings not equal -- indicate edit has changed */
infoPtr->flags |= WCBE_EDITCHG;
}
SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,
SendMessageW ( infoPtr->hwndNotify, WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
CBN_EDITCHANGE),
(LPARAM)infoPtr->hwndSelf);
@@ -2236,9 +2236,9 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_NOTIFY:
if (infoPtr->NtfUnicode)
return SendMessageW (GetParent (hwnd), uMsg, wParam, lParam);
return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
else
return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
/* Window messages we need to process */
+3 -1
View File
@@ -7,10 +7,11 @@
#include <windows.h>
#include "comctl32.h"
#include "wine/wine_common_ver.rc"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "wine/wine_common_ver.rc"
IDB_STD_SMALL BITMAP "res/idb_std_small.bmp"
IDB_STD_LARGE BITMAP "res/idb_std_large.bmp"
IDB_VIEW_SMALL BITMAP "res/idb_view_small.bmp"
@@ -35,6 +36,7 @@ IDI_DRAGARROW ICON "res/idi_dragarrow.ico"
#include "res/comctl_Es.rc"
#include "res/comctl_Fr.rc"
#include "res/comctl_It.rc"
#include "res/comctl_Ja.rc"
#include "res/comctl_Ko.rc"
#include "res/comctl_Nl.rc"
#include "res/comctl_Pl.rc"
+2 -9
View File
@@ -2303,15 +2303,8 @@ DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr)
idFrom = lpHdr->idFrom;
}
else {
if (lpNotify->hwndFrom) {
HWND hwndParent = GetParent (lpNotify->hwndFrom);
if (hwndParent) {
hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER);
/* the following is done even if the return from above
* is zero. GLA 12/2001 */
idFrom = GetDlgCtrlID (lpNotify->hwndFrom);
}
}
if (lpNotify->hwndFrom)
idFrom = GetDlgCtrlID (lpNotify->hwndFrom);
lpNmh = (lpHdr) ? lpHdr : &nmhdr;
+8 -8
View File
@@ -44,6 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(datetime);
typedef struct
{
HWND hMonthCal;
HWND hwndNotify;
HWND hUpdown;
SYSTEMTIME date;
BOOL dateValid;
@@ -895,11 +896,8 @@ DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
else
ShowWindow(infoPtr->hMonthCal, SW_SHOW);
TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p, mcpp:%p\n",
hwnd,infoPtr->hMonthCal,
GetParent (infoPtr->hMonthCal),
GetDesktopWindow (),
GetParent (GetParent (infoPtr->hMonthCal)));
TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p\n",
hwnd, infoPtr->hMonthCal, infoPtr->hwndNotify, GetDesktopWindow ());
DATETIME_SendSimpleNotify (hwnd, DTN_DROPDOWN);
}
@@ -1119,7 +1117,7 @@ DATETIME_SendDateTimeChangeNotify (HWND hwnd)
dtdtc.dwFlags = GDT_VALID;
MONTHCAL_CopyTime (&infoPtr->date, &dtdtc.st);
return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc);
}
@@ -1127,6 +1125,7 @@ DATETIME_SendDateTimeChangeNotify (HWND hwnd)
static BOOL
DATETIME_SendSimpleNotify (HWND hwnd, UINT code)
{
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
NMHDR nmhdr;
TRACE("%x\n",code);
@@ -1134,7 +1133,7 @@ DATETIME_SendSimpleNotify (HWND hwnd, UINT code)
nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID);
nmhdr.code = code;
return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
}
@@ -1225,6 +1224,7 @@ DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->fieldRect = (RECT *) Alloc (32*sizeof(RECT));
infoPtr->buflen = (int *) Alloc (32*sizeof(int));
infoPtr->nrFieldsAllocated = 32;
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
DATETIME_SetFormat (hwnd, 0, 0);
@@ -1232,7 +1232,7 @@ DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0,
WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS,
0, 0, 0, 0,
GetParent(hwnd),
infoPtr->hwndNotify,
0, 0, 0);
/* initialize info structure */
-4
View File
@@ -60,7 +60,6 @@ typedef struct
BOOL WINAPI InitializeFlatSB(HWND hwnd)
{
TRACE("[%p]\n", hwnd);
FIXME("stub\n");
return FALSE;
}
@@ -76,7 +75,6 @@ BOOL WINAPI InitializeFlatSB(HWND hwnd)
HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
{
TRACE("[%p]\n", hwnd);
FIXME("stub\n");
return S_FALSE;
}
@@ -92,7 +90,6 @@ BOOL WINAPI
FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
{
TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
FIXME("stub\n");
return FALSE;
}
@@ -103,7 +100,6 @@ BOOL WINAPI
FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
{
TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
FIXME("stub\n");
return FALSE;
}
+2 -2
View File
@@ -199,7 +199,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
dis.rcItem = r;
dis.itemData = phdi->lParam;
oldBkMode = SetBkMode(hdc, TRANSPARENT);
SendMessageA (GetParent (hwnd), WM_DRAWITEM,
SendMessageA (infoPtr->hwndNotify, WM_DRAWITEM,
(WPARAM)dis.CtlID, (LPARAM)&dis);
if (oldBkMode != TRANSPARENT)
SetBkMode(hdc, oldBkMode);
@@ -1287,7 +1287,7 @@ HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO));
SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
infoPtr->hwndNotify = GetParent(hwnd);
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->uNumItem = 0;
infoPtr->hFont = 0;
infoPtr->items = 0;
+3 -1
View File
@@ -38,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(hotkey);
typedef struct tagHOTKEY_INFO
{
HWND hwndSelf;
HWND hwndNotify;
HFONT hFont;
BOOL bFocus;
INT nHeight;
@@ -222,6 +223,7 @@ HOTKEY_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->HotKey = infoPtr->InvComb = infoPtr->InvMod = infoPtr->CurrMod = 0;
infoPtr->CaretPos = 2;
infoPtr->hwndSelf = hwnd;
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
LoadStringW(COMCTL32_hModule, HKY_NONE, infoPtr->strNone, 15);
/* get default font height */
@@ -252,7 +254,7 @@ HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
RECT rc;
hBrush =
(HBRUSH)SendMessageW (GetParent (infoPtr->hwndSelf), WM_CTLCOLOREDIT,
(HBRUSH)SendMessageW (infoPtr->hwndNotify, WM_CTLCOLOREDIT,
wParam, (LPARAM)infoPtr->hwndSelf);
if (hBrush)
hBrush = (HBRUSH)GetStockObject (WHITE_BRUSH);
+6 -4
View File
@@ -61,6 +61,7 @@ typedef struct
typedef struct
{
HWND Self;
HWND Notify;
IPPART_INFO Part[4];
} IPADDRESS_INFO;
@@ -82,7 +83,7 @@ static LRESULT IPADDRESS_Notify (IPADDRESS_INFO *infoPtr, UINT command)
TRACE("(command=%x)\n", command);
return SendMessageW (GetParent (hwnd), WM_COMMAND,
return SendMessageW (infoPtr->Notify, WM_COMMAND,
MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd);
}
@@ -99,7 +100,7 @@ static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
nmip.iField = field;
nmip.iValue = value;
SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY,
SendMessageW (infoPtr->Notify, WM_NOTIFY,
(WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip);
TRACE("<-- %d\n", nmip.iValue);
@@ -149,7 +150,7 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
}
static LRESULT IPADDRESS_Create (HWND hwnd)
static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
{
IPADDRESS_INFO *infoPtr;
RECT rcClient, edit;
@@ -173,6 +174,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd)
edit.bottom = rcClient.bottom - 2;
infoPtr->Self = hwnd;
infoPtr->Notify = lpCreate->hwndParent;
for (i = 0; i < 4; i++) {
IPPART_INFO* part = &infoPtr->Part[i];
@@ -508,7 +510,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (uMsg)
{
case WM_CREATE:
return IPADDRESS_Create (hwnd);
return IPADDRESS_Create (hwnd, (LPCREATESTRUCTA)lParam);
case WM_DESTROY:
return IPADDRESS_Destroy (infoPtr);
+2 -2
View File
@@ -7186,7 +7186,7 @@ static HWND LISTVIEW_SetToolTips( LISTVIEW_INFO *infoPtr, HWND hwndNewToolTip)
*/
static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW((HWND)lParam, 0);
LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
ITEM_INFO* lv_first = (ITEM_INFO*) DPA_GetPtr( (HDPA)first, 0 );
ITEM_INFO* lv_second = (ITEM_INFO*) DPA_GetPtr( (HDPA)second, 0 );
@@ -7237,7 +7237,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
infoPtr->pfnCompare = pfnCompare;
infoPtr->lParamSort = lParamSort;
DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, (LPARAM)infoPtr->hwndSelf);
DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, (LPARAM)infoPtr);
/* Adjust selections and indices so that they are the way they should
* be after the sort (otherwise, the list items move around, but
+9 -6
View File
@@ -104,6 +104,7 @@ typedef struct
RECT days; /* calendar area */
RECT weeknums; /* week numbers at left side */
RECT todayrect; /* `today: xx/xx/xx' text rect */
HWND hwndNotify; /* Window to receive the notifications */
HWND hWndYearEdit; /* Window Handle of edit box to handle years */
HWND hWndYearUpDown;/* Window Handle of updown box to handle years */
} MONTHCAL_INFO, *LPMONTHCAL_INFO;
@@ -1304,7 +1305,7 @@ static void MONTHCAL_GoToNextMonth(HWND hwnd, MONTHCAL_INFO *infoPtr)
nmds.cDayState = infoPtr->monthRange;
nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
SendMessageA(GetParent(hwnd), WM_NOTIFY,
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
for(i=0; i<infoPtr->monthRange; i++)
infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1335,7 +1336,7 @@ static void MONTHCAL_GoToPrevMonth(HWND hwnd, MONTHCAL_INFO *infoPtr)
nmds.prgDayState = Alloc
(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
SendMessageA(GetParent(hwnd), WM_NOTIFY,
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
for(i=0; i<infoPtr->monthRange; i++)
infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1489,7 +1490,7 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
SendMessageA(GetParent(hwnd), WM_NOTIFY,
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
MONTHCAL_CopyTime(&ht.st, &selArray[0]);
@@ -1555,9 +1556,9 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhdr.hwndFrom = hwnd;
nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID);
nmhdr.code = NM_RELEASEDCAPTURE;
TRACE("Sent notification from %p to %p\n", hwnd, GetParent(hwnd));
TRACE("Sent notification from %p to %p\n", hwnd, infoPtr->hwndNotify);
SendMessageA(GetParent(hwnd), WM_NOTIFY,
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
nmsc.nmhdr.hwndFrom = hwnd;
@@ -1566,7 +1567,7 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam)
MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
SendMessageA(GetParent(hwnd), WM_NOTIFY,
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
/* redraw if necessary */
@@ -1881,6 +1882,8 @@ MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam)
return 0;
}
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
GetObjectA(infoPtr->hFont, sizeof(LOGFONTA), &logFont);
logFont.lfWeight = FW_BOLD;
+8 -5
View File
@@ -44,6 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(pager);
typedef struct
{
HWND hwndChild; /* handle of the contained wnd */
HWND hwndNotify; /* handle of the parent wnd */
BOOL bNoResize; /* set when created with CCS_NORESIZE */
COLORREF clrBk; /* background color */
INT nBorder; /* border size for the control */
@@ -325,6 +326,7 @@ PAGER_GetBkColor(HWND hwnd)
static void
PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth)
{
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
NMPGCALCSIZE nmpgcs;
ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
nmpgcs.hdr.hwndFrom = hwnd;
@@ -333,7 +335,7 @@ PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth)
nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
nmpgcs.iWidth = getWidth ? *size : 0;
nmpgcs.iHeight = getWidth ? 0 : *size;
SendMessageA (GetParent (hwnd), WM_NOTIFY,
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
*size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight;
@@ -795,7 +797,7 @@ PAGER_Scroll(HWND hwnd, INT dir)
}
nmpgScroll.iScroll -= 2*infoPtr->nButtonSize;
SendMessageA (GetParent(hwnd), WM_NOTIFY,
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll);
TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);
@@ -843,6 +845,7 @@ PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* set default settings */
infoPtr->hwndChild = NULL;
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->bNoResize = dwStyle & CCS_NORESIZE;
infoPtr->clrBk = GetSysColor(COLOR_BTNFACE);
infoPtr->nBorder = 0;
@@ -1177,7 +1180,7 @@ PAGER_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhdr.hwndFrom = hwnd;
nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmhdr.code = NM_RELEASEDCAPTURE;
SendMessageA (GetParent(hwnd), WM_NOTIFY,
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
}
@@ -1267,7 +1270,7 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhdr.hwndFrom = hwnd;
nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmhdr.code = NM_RELEASEDCAPTURE;
SendMessageA (GetParent(hwnd), WM_NOTIFY,
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
}
}
@@ -1575,7 +1578,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_NOTIFY:
case WM_COMMAND:
return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
default:
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
+11 -9
View File
@@ -67,6 +67,7 @@ typedef struct
typedef struct
{
HWND Self;
HWND Notify;
WORD numParts;
UINT height;
BOOL simple;
@@ -170,8 +171,7 @@ STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINF
dis.hDC = hdc;
dis.rcItem = r;
dis.itemData = (INT)part->text;
SendMessageW (GetParent (infoPtr->Self), WM_DRAWITEM,
(WPARAM)dis.CtlID, (LPARAM)&dis);
SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
}
else
{
@@ -561,7 +561,7 @@ STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
INT width, x, y;
RECT parent_rect;
GetClientRect (GetParent (infoPtr->Self), &parent_rect);
GetClientRect (infoPtr->Notify, &parent_rect);
infoPtr->height = height + VERT_BORDER;
width = parent_rect.right - parent_rect.left;
x = parent_rect.left;
@@ -779,7 +779,7 @@ STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
nmhdr.hwndFrom = infoPtr->Self;
nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
nmhdr.code = SBN_SIMPLEMODECHANGE;
SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY, 0, (LPARAM)&nmhdr);
SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
InvalidateRect(infoPtr->Self, NULL, FALSE);
return TRUE;
}
@@ -829,13 +829,14 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
infoPtr->Self = hwnd;
infoPtr->Notify = lpCreate->hwndParent;
infoPtr->numParts = 1;
infoPtr->parts = 0;
infoPtr->simple = FALSE;
infoPtr->clrBk = CLR_DEFAULT;
infoPtr->hFont = 0;
i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
infoPtr->NtfUnicode = (i == NFR_UNICODE);
GetClientRect (hwnd, &rect);
@@ -925,7 +926,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
}
if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
GetClientRect (GetParent (hwnd), &rect);
GetClientRect (infoPtr->Notify, &rect);
width = rect.right - rect.left;
infoPtr->height = textHeight + 4 + VERT_BORDER;
SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
@@ -1076,7 +1077,7 @@ STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
/* width and height don't apply */
GetClientRect (GetParent(infoPtr->Self), &parent_rect);
GetClientRect (infoPtr->Notify, &parent_rect);
width = parent_rect.right - parent_rect.left;
x = parent_rect.left;
y = parent_rect.bottom - infoPtr->height;
@@ -1102,13 +1103,14 @@ STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
static LRESULT
STATUSBAR_SendNotify (HWND hwnd, UINT code)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
NMHDR nmhdr;
TRACE("code %04x\n", code);
nmhdr.hwndFrom = hwnd;
nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID);
nmhdr.code = code;
SendMessageW (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
return 0;
}
@@ -1222,7 +1224,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCLBUTTONUP:
case WM_NCLBUTTONDOWN:
PostMessageW (GetParent (hwnd), msg, wParam, lParam);
PostMessageW (infoPtr->Notify, msg, wParam, lParam);
return 0;
case WM_NOTIFYFORMAT:
+221 -173
View File
@@ -4,6 +4,7 @@
* Copyright 1998 Anders Carlsson
* Copyright 1999 Alex Priem <alexp@sci.kun.nl>
* Copyright 1999 Francis Beaudet
* Copyright 2003 Vitaliy Margolen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -59,6 +60,7 @@ typedef struct
typedef struct
{
HWND hwndNotify; /* notification window (parent) */
UINT uNumItem; /* number of tab items */
UINT uNumRows; /* number of tab rows */
INT tabHeight; /* height of the tab row */
@@ -66,6 +68,8 @@ typedef struct
INT tabMinWidth; /* minimum width of items */
USHORT uHItemPadding; /* amount of horizontal padding, in pixels */
USHORT uVItemPadding; /* amount of vertical padding, in pixels */
USHORT uHItemPadding_s; /* Set amount of horizontal padding, in pixels */
USHORT uVItemPadding_s; /* Set amount of vertical padding, in pixels */
HFONT hFont; /* handle to the current font */
HCURSOR hcurArrow; /* handle to the current cursor */
HIMAGELIST himl; /* handle to a image list (may be 0) */
@@ -118,13 +122,14 @@ static void TAB_DrawItemInterior(HWND hwnd, HDC hdc, INT iItem, RECT* drawRect);
static BOOL
TAB_SendSimpleNotify (HWND hwnd, UINT code)
{
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
NMHDR nmhdr;
nmhdr.hwndFrom = hwnd;
nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
nmhdr.code = code;
return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
return (BOOL) SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr);
}
@@ -270,8 +275,8 @@ TAB_SetPadding (HWND hwnd, WPARAM wParam, LPARAM lParam)
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
if (infoPtr == NULL) return 0;
infoPtr->uHItemPadding=LOWORD(lParam);
infoPtr->uVItemPadding=HIWORD(lParam);
infoPtr->uHItemPadding_s=LOWORD(lParam);
infoPtr->uVItemPadding_s=HIWORD(lParam);
return 0;
}
@@ -316,14 +321,13 @@ static BOOL TAB_InternalGetItemRect(
if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL))
{
itemRect->bottom = clientRect.bottom -
SELECTED_TAB_OFFSET -
itemRect->top * (infoPtr->tabHeight - 2) -
((lStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : 0);
((lStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : SELECTED_TAB_OFFSET);
itemRect->top = clientRect.bottom -
infoPtr->tabHeight -
itemRect->top * (infoPtr->tabHeight - 2) -
((lStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : 0);
((lStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : SELECTED_TAB_OFFSET);
}
else if((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL))
{
@@ -400,7 +404,6 @@ static BOOL TAB_InternalGetItemRect(
/* If it also a bit higher. */
if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL))
{
selectedRect->top -= 2; /* the border is thicker on the bottom */
selectedRect->bottom += SELECTED_TAB_OFFSET;
}
else if((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL))
@@ -416,7 +419,7 @@ static BOOL TAB_InternalGetItemRect(
else
{
selectedRect->top -= SELECTED_TAB_OFFSET;
selectedRect->bottom += 1;
selectedRect->bottom -= 1;
}
}
@@ -647,9 +650,12 @@ static void
TAB_DrawLoneItemInterior(HWND hwnd, TAB_INFO* infoPtr, int iItem)
{
HDC hdc = GetDC(hwnd);
HFONT hOldFont = SelectObject(hdc, infoPtr->hFont);
RECT r, rC;
GetWindowRect(hwnd, &rC);
GetWindowRect(infoPtr->hwndUpDown, &r);
ExcludeClipRect(hdc, r.left - rC.left, r.top - rC.top, r.right - rC.left, r.bottom - rC.top);
TAB_DrawItemInterior(hwnd, hdc, iItem, NULL);
SelectObject(hdc, hOldFont);
ReleaseDC(hwnd, hdc);
}
@@ -1098,6 +1104,10 @@ static void TAB_SetItemBounds (HWND hwnd)
clientRect.right = iTemp;
}
/* Now use hPadding and vPadding */
infoPtr->uHItemPadding = infoPtr->uHItemPadding_s;
infoPtr->uVItemPadding = infoPtr->uVItemPadding_s;
/* The leftmost item will be "0" aligned */
curItemLeftPos = 0;
curItemRowCount = infoPtr->uNumItem ? 1 : 0;
@@ -1414,6 +1424,69 @@ static void TAB_SetItemBounds (HWND hwnd)
ReleaseDC (hwnd, hdc);
}
static void
TAB_EraseTabInterior
(
HWND hwnd,
HDC hdc,
INT iItem,
RECT* drawRect
)
{
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
HBRUSH hbr = CreateSolidBrush (comctl32_color.clrBtnFace);
BOOL deleteBrush = TRUE;
RECT rTemp = *drawRect;
InflateRect(&rTemp, -2, -2);
if (lStyle & TCS_BUTTONS)
{
if (iItem == infoPtr->iSelected)
{
/* Background color */
if (!(lStyle & TCS_OWNERDRAWFIXED))
{
DeleteObject(hbr);
hbr = GetSysColorBrush(COLOR_SCROLLBAR);
SetTextColor(hdc, comctl32_color.clr3dFace);
SetBkColor(hdc, comctl32_color.clr3dHilight);
/* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
* we better use 0x55aa bitmap brush to make scrollbar's background
* look different from the window background.
*/
if (comctl32_color.clr3dHilight == comctl32_color.clrWindow)
hbr = COMCTL32_hPattern55AABrush;
deleteBrush = FALSE;
}
FillRect(hdc, &rTemp, hbr);
}
else /* ! selected */
{
if (lStyle & TCS_FLATBUTTONS)
{
FillRect(hdc, drawRect, hbr);
if (iItem == infoPtr->iHotTracked)
DrawEdge(hdc, drawRect, EDGE_RAISED, BF_SOFT|BF_RECT);
}
else
FillRect(hdc, &rTemp, hbr);
}
}
else /* !TCS_BUTTONS */
{
FillRect(hdc, &rTemp, hbr);
}
/* Cleanup */
if (deleteBrush) DeleteObject(hbr);
}
/******************************************************************************
* TAB_DrawItemInterior
*
@@ -1437,7 +1510,8 @@ TAB_DrawItemInterior
HPEN htextPen;
HPEN holdPen;
INT oldBkMode;
HFONT hOldFont;
if (drawRect == NULL)
{
BOOL isVisible;
@@ -1467,32 +1541,77 @@ TAB_DrawItemInterior
*drawRect = itemRect;
if (iItem == infoPtr->iSelected)
{
drawRect->right--;
drawRect->bottom--;
OffsetRect(drawRect, 1, 1);
}
}
else
{
if (iItem == infoPtr->iSelected)
{
*drawRect = selectedRect;
if (lStyle & TCS_BOTTOM)
{
if (lStyle & TCS_VERTICAL)
{
drawRect->left++;
}
else
{
drawRect->top += 3;
drawRect->left += 1;
}
}
}
else
*drawRect = itemRect;
drawRect->right--;
drawRect->bottom--;
if (lStyle & TCS_BOTTOM && !(lStyle & TCS_VERTICAL))
{
drawRect->top--;
drawRect->bottom--;
}
}
}
TRACE("drawRect=(%ld,%ld)-(%ld,%ld)\n",
drawRect->left, drawRect->top, drawRect->right, drawRect->bottom);
/* Clear interior */
TAB_EraseTabInterior (hwnd, hdc, iItem, drawRect);
/* Draw the focus rectangle */
if (!(lStyle & TCS_FOCUSNEVER) &&
(GetFocus() == hwnd) &&
(iItem == infoPtr->uFocus) )
{
RECT rFocus = *drawRect;
InflateRect(&rFocus, -3, -3);
if (lStyle & TCS_BOTTOM && !(lStyle & TCS_VERTICAL))
rFocus.top -= 3;
if (lStyle & TCS_BUTTONS)
{
rFocus.left -= 3;
rFocus.top -= 3;
}
DrawFocusRect(hdc, &rFocus);
}
/*
* Text pen
*/
htextPen = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT) );
holdPen = SelectObject(hdc, htextPen);
holdPen = SelectObject(hdc, htextPen);
hOldFont = SelectObject(hdc, infoPtr->hFont);
/*
* Setup for text output
*/
oldBkMode = SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, ( (iItem == infoPtr->iHotTracked) | (infoPtr->items[iItem].dwState & TCIS_HIGHLIGHTED)) ?
SetTextColor(hdc, (((iItem == infoPtr->iHotTracked) && !(lStyle & TCS_FLATBUTTONS)) |
(infoPtr->items[iItem].dwState & TCIS_HIGHLIGHTED)) ?
comctl32_color.clrHighlight : comctl32_color.clrBtnText);
/*
* if owner draw, tell the owner to draw
*/
@@ -1521,40 +1640,23 @@ TAB_DrawItemInterior
dis.hwndItem = hwnd; /* */
dis.hDC = hdc;
CopyRect(&dis.rcItem,drawRect);
InflateRect(&dis.rcItem, -2, -2);
dis.itemData = infoPtr->items[iItem].lParam;
/*
* send the draw message
*/
SendMessageA( GetParent(hwnd), WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
SendMessageA( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
}
else
{
INT cx;
INT cy;
UINT uHorizAlign;
RECT rcTemp;
RECT rcImage;
LOGFONTA logfont;
HFONT hFont = 0;
HFONT hOldFont = 0; /* stop uninitialized warning */
INT nEscapement = 0; /* stop uninitialized warning */
INT nOrientation = 0; /* stop uninitialized warning */
INT iPointSize;
/* used to center the icon and text in the tab */
RECT rcText;
INT center_offset_h, center_offset_v;
/*
* Deflate the rectangle to acount for the padding
*/
if(lStyle & TCS_VERTICAL)
InflateRect(drawRect, -infoPtr->uVItemPadding, -infoPtr->uHItemPadding);
else
InflateRect(drawRect, -infoPtr->uHItemPadding, -infoPtr->uVItemPadding);
/* set rcImage to drawRect, we will use top & left in our ImageList_Draw call */
rcImage = *drawRect;
@@ -1562,17 +1664,9 @@ TAB_DrawItemInterior
rcText.left = rcText.top = rcText.right = rcText.bottom = 0;
/*
* Setup for text output
*/
oldBkMode = SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, ((iItem == infoPtr->iHotTracked) | (infoPtr->items[iItem].dwState & TCIS_HIGHLIGHTED))?
comctl32_color.clrHighlight : comctl32_color.clrBtnText);
/* get the rectangle that the text fits in */
DrawTextW(hdc, infoPtr->items[iItem].pszText, -1,
&rcText, DT_CALCRECT);
rcText.right += 4;
/*
* If not owner draw, then do the drawing ourselves.
*
@@ -1580,6 +1674,9 @@ TAB_DrawItemInterior
*/
if (infoPtr->himl && (infoPtr->items[iItem].mask & TCIF_IMAGE))
{
INT cx;
INT cy;
ImageList_GetIconSize(infoPtr->himl, &cx, &cy);
if(lStyle & TCS_VERTICAL)
@@ -1593,36 +1690,37 @@ TAB_DrawItemInterior
center_offset_v = ((drawRect->bottom - drawRect->top) - (cy + infoPtr->uVItemPadding)) / 2;
}
if ((lStyle & TCS_FIXEDWIDTH &&
lStyle & (TCS_FORCELABELLEFT | TCS_FORCEICONLEFT)) ||
(center_offset_h < 0))
center_offset_h = 0;
if (lStyle & TCS_FIXEDWIDTH && lStyle & (TCS_FORCELABELLEFT | TCS_FORCEICONLEFT))
center_offset_h = infoPtr->uHItemPadding;
TRACE("for <%s>, c_o=%d, draw=(%ld,%ld)-(%ld,%ld), textlen=%ld\n",
debugstr_w(infoPtr->items[iItem].pszText), center_offset_h,
if (center_offset_h < 2)
center_offset_h = 2;
TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%ld,%ld)-(%ld,%ld), textlen=%ld\n",
debugstr_w(infoPtr->items[iItem].pszText), center_offset_h, center_offset_v,
drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
(rcText.right-rcText.left));
if((lStyle & TCS_VERTICAL) && (lStyle & TCS_BOTTOM))
{
rcImage.top = drawRect->top + center_offset_h;
rcImage.top = drawRect->top + center_offset_h;
/* if tab is TCS_VERTICAL and TCS_BOTTOM, the text is drawn from the */
/* right side of the tab, but the image still uses the left as its x position */
/* this keeps the image always drawn off of the same side of the tab */
rcImage.left = drawRect->right - cx - center_offset_v;
drawRect->top = rcImage.top + (cx + infoPtr->uHItemPadding);
drawRect->top += cy + infoPtr->uHItemPadding;
}
else if(lStyle & TCS_VERTICAL)
{
rcImage.top = drawRect->bottom - cy - center_offset_h;
rcImage.left = drawRect->left + center_offset_v;
drawRect->bottom = rcImage.top - infoPtr->uHItemPadding;
drawRect->bottom -= cy + infoPtr->uHItemPadding;
}
else /* normal style, whether TCS_BOTTOM or not */
{
rcImage.left = drawRect->left + center_offset_h + 3;
drawRect->left = rcImage.left + cx + infoPtr->uHItemPadding;
rcImage.left = drawRect->left + center_offset_h;
rcImage.top = drawRect->top + center_offset_v;
drawRect->left += cx + infoPtr->uHItemPadding;
}
TRACE("drawing image=%d, left=%ld, top=%ld\n",
@@ -1637,70 +1735,52 @@ TAB_DrawItemInterior
ILD_NORMAL
);
}
else /* no image, so just shift the drawRect borders around */
{
/* Now position text */
if (lStyle & TCS_FIXEDWIDTH && lStyle & TCS_FORCELABELLEFT)
center_offset_h = infoPtr->uHItemPadding;
else
if(lStyle & TCS_VERTICAL)
{
center_offset_h = 0;
/*
currently the rcText rect is flawed because the rotated font does not
often match the horizontal font. So leave this as 0
((drawRect->bottom - drawRect->top) - (rcText.right - rcText.left)) / 2;
*/
if(lStyle & TCS_BOTTOM)
drawRect->top+=center_offset_h;
else
drawRect->bottom-=center_offset_h;
}
center_offset_h = ((drawRect->bottom - drawRect->top) - (rcText.right - rcText.left)) / 2;
else
{
center_offset_h = ((drawRect->right - drawRect->left) - (rcText.right - rcText.left)) / 2;
drawRect->left+=center_offset_h;
}
}
if(lStyle & TCS_VERTICAL)
{
center_offset_v = ((drawRect->right - drawRect->left) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;
drawRect->left += center_offset_v;
if(lStyle & TCS_BOTTOM)
drawRect->top+=center_offset_h;
else
drawRect->bottom-=center_offset_h;
drawRect->left += ((drawRect->right - drawRect->left) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;
}
else
{
center_offset_v = ((drawRect->bottom - drawRect->top) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;
drawRect->top += center_offset_v;
drawRect->left += center_offset_h;
drawRect->top += ((drawRect->bottom - drawRect->top) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;
}
/* Draw the text */
if ((lStyle & TCS_FIXEDWIDTH && lStyle & TCS_FORCELABELLEFT) ||
!center_offset_h)
uHorizAlign = DT_LEFT;
else
uHorizAlign = DT_CENTER;
if(lStyle & TCS_VERTICAL) /* if we are vertical rotate the text and each character */
{
LOGFONTA logfont;
HFONT hFont = 0;
INT nEscapement = 900;
INT nOrientation = 900;
if(lStyle & TCS_BOTTOM)
{
nEscapement = -900;
nOrientation = -900;
}
else
{
nEscapement = 900;
nOrientation = 900;
}
}
/* to get a font with the escapement and orientation we are looking for, we need to */
/* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */
if(lStyle & TCS_VERTICAL)
{
/* to get a font with the escapement and orientation we are looking for, we need to */
/* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */
if (!GetObjectA((infoPtr->hFont) ?
infoPtr->hFont : GetStockObject(SYSTEM_FONT),
sizeof(LOGFONTA),&logfont))
{
iPointSize = 9;
INT iPointSize = 9;
lstrcpyA(logfont.lfFaceName, "Arial");
logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY),
@@ -1714,11 +1794,8 @@ TAB_DrawItemInterior
logfont.lfEscapement = nEscapement;
logfont.lfOrientation = nOrientation;
hFont = CreateFontIndirectA(&logfont);
hOldFont = SelectObject(hdc, hFont);
}
SelectObject(hdc, hFont);
if (lStyle & TCS_VERTICAL)
{
ExtTextOutW(hdc,
(lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
(!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
@@ -1727,6 +1804,8 @@ TAB_DrawItemInterior
infoPtr->items[iItem].pszText,
lstrlenW(infoPtr->items[iItem].pszText),
0);
DeleteObject(hFont);
}
else
{
@@ -1736,24 +1815,17 @@ TAB_DrawItemInterior
infoPtr->items[iItem].pszText,
lstrlenW(infoPtr->items[iItem].pszText),
drawRect,
uHorizAlign | DT_SINGLELINE
DT_LEFT | DT_SINGLELINE
);
}
/* clean things up */
*drawRect = rcTemp; /* restore drawRect */
if(lStyle & TCS_VERTICAL)
{
SelectObject(hdc, hOldFont); /* restore the original font */
if (hFont)
DeleteObject(hFont);
}
}
/*
* Cleanup
*/
SelectObject(hdc, hOldFont);
SetBkMode(hdc, oldBkMode);
SelectObject(hdc, holdPen);
DeleteObject( htextPen );
@@ -1790,6 +1862,13 @@ static void TAB_DrawItem(
if (isVisible)
{
RECT rUD, rC;
/* Clip UpDown control to not draw over it */
GetWindowRect(hwnd, &rC);
GetWindowRect(infoPtr->hwndUpDown, &rUD);
ExcludeClipRect(hdc, rUD.left - rC.left, rUD.top - rC.top, rUD.right - rC.left, rUD.bottom - rC.top);
/* If you need to see what the control is doing,
* then override these variables. They will change what
* fill colors are used for filling the tabs, and the
@@ -1800,9 +1879,6 @@ static void TAB_DrawItem(
if (lStyle & TCS_BUTTONS)
{
HBRUSH hbr = CreateSolidBrush (bkgnd);
BOOL deleteBrush = TRUE;
/* Get item rectangle */
r = itemRect;
@@ -1816,43 +1892,15 @@ static void TAB_DrawItem(
if (iItem == infoPtr->iSelected)
{
/* Background color */
if (!(lStyle & TCS_OWNERDRAWFIXED))
{
DeleteObject(hbr);
hbr = GetSysColorBrush(COLOR_SCROLLBAR);
SetTextColor(hdc, comctl32_color.clr3dFace);
SetBkColor(hdc, comctl32_color.clr3dHilight);
/* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
* we better use 0x55aa bitmap brush to make scrollbar's background
* look different from the window background.
*/
if (comctl32_color.clr3dHilight == comctl32_color.clrWindow)
hbr = COMCTL32_hPattern55AABrush;
deleteBrush = FALSE;
}
/* Clear interior */
FillRect(hdc, &r, hbr);
DrawEdge(hdc, &r, EDGE_SUNKEN, BF_SOFT|BF_RECT);
OffsetRect(&r, 1, 1);
}
else /* ! selected */
{
if (!(lStyle & TCS_FLATBUTTONS))
{
/* Clear interior */
FillRect(hdc, &r, hbr);
DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT);
}
}
/* Cleanup */
if (deleteBrush) DeleteObject(hbr);
}
else /* !TCS_BUTTONS */
{
@@ -2029,11 +2077,17 @@ static void TAB_DrawItem(
r1.bottom--;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT);
if ((iItem == infoPtr->iSelected) && (selectedRect.left == 0)) {
if (iItem == infoPtr->iSelected)
{
r.top += 2;
r.left += 1;
if (selectedRect.left == 0)
{
r1 = r;
r1.bottom = r1.top;
r1.top--;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_LEFT);
}
}
}
@@ -2081,22 +2135,7 @@ static void TAB_DrawItem(
TAB_DumpItemInternal(infoPtr, iItem);
/* This modifies r to be the text rectangle. */
{
HFONT hOldFont = SelectObject(hdc, infoPtr->hFont);
TAB_DrawItemInterior(hwnd, hdc, iItem, &r);
SelectObject(hdc,hOldFont);
}
/* Draw the focus rectangle */
if (((lStyle & TCS_FOCUSNEVER) == 0) &&
(GetFocus() == hwnd) &&
(iItem == infoPtr->uFocus) )
{
r = itemRect;
InflateRect(&r, -1, -1);
DrawFocusRect(hdc, &r);
}
TAB_DrawItemInterior(hwnd, hdc, iItem, &r);
}
}
@@ -2355,7 +2394,7 @@ static void TAB_InvalidateTabArea(
HWND hwnd,
TAB_INFO* infoPtr)
{
RECT clientRect, r;
RECT clientRect, rInvalidate;
DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE);
INT lastRow = infoPtr->uNumRows - 1;
RECT rect;
@@ -2363,49 +2402,54 @@ static void TAB_InvalidateTabArea(
if (lastRow < 0) return;
GetClientRect(hwnd, &clientRect);
rInvalidate = clientRect;
TAB_InternalGetItemRect(hwnd, infoPtr, infoPtr->uNumItem-1 , &rect, NULL);
if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL))
{
clientRect.top = clientRect.bottom -
rInvalidate.top = clientRect.bottom -
infoPtr->tabHeight -
lastRow * (infoPtr->tabHeight - 2) -
((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) - 3;
clientRect.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
rInvalidate.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
}
else if((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL))
{
clientRect.left = clientRect.right - infoPtr->tabHeight -
rInvalidate.left = clientRect.right - infoPtr->tabHeight -
lastRow * (infoPtr->tabHeight - 2) -
((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) - 2;
clientRect.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
rInvalidate.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
}
else if(lStyle & TCS_VERTICAL)
{
clientRect.right = clientRect.left + infoPtr->tabHeight +
rInvalidate.right = clientRect.left + infoPtr->tabHeight +
lastRow * (infoPtr->tabHeight - 2) -
((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2;
clientRect.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
rInvalidate.bottom = clientRect.top + rect.bottom + 2 * SELECTED_TAB_OFFSET;
}
else
{
clientRect.bottom = clientRect.top + infoPtr->tabHeight +
rInvalidate.bottom = clientRect.top + infoPtr->tabHeight +
lastRow * (infoPtr->tabHeight - 2) +
((lStyle & TCS_BUTTONS) ? lastRow * BUTTON_SPACINGY : 0) + 2;
clientRect.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
rInvalidate.right = clientRect.left + rect.right + 2 * SELECTED_TAB_OFFSET;
}
/* Punch out the updown control */
if (infoPtr->needsScrolling && (clientRect.right > 0)) {
if (infoPtr->needsScrolling && (rInvalidate.right > 0)) {
RECT r;
GetClientRect(infoPtr->hwndUpDown, &r);
clientRect.right = clientRect.right - (r.right - r.left);
if (rInvalidate.right > clientRect.right - r.left)
rInvalidate.right = rInvalidate.right - (r.right - r.left);
else
rInvalidate.right = clientRect.right - r.left;
}
TRACE("invalidate (%ld,%ld)-(%ld,%ld)\n",
clientRect.left,clientRect.top,
clientRect.right,clientRect.bottom);
InvalidateRect(hwnd, &clientRect, TRUE);
InvalidateRect(hwnd, &rInvalidate, TRUE);
}
static LRESULT
@@ -3001,10 +3045,13 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->uNumItem = 0;
infoPtr->uNumRows = 0;
infoPtr->uHItemPadding = 6;
infoPtr->uVItemPadding = 3;
infoPtr->uHItemPadding_s = 6;
infoPtr->uVItemPadding_s = 3;
infoPtr->hFont = 0;
infoPtr->items = 0;
infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW);
@@ -3044,7 +3091,7 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmttc.hdr.code = NM_TOOLTIPSCREATED;
nmttc.hwndToolTips = infoPtr->hwndToolTip;
SendMessageA (GetParent (hwnd), WM_NOTIFY,
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);
}
}
@@ -3113,6 +3160,7 @@ TAB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI
TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
TRACE("hwnd=%p msg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
if (!TAB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
@@ -3243,7 +3291,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TAB_LButtonUp (hwnd, wParam, lParam);
case WM_NOTIFY:
return SendMessageA(GetParent(hwnd), WM_NOTIFY, wParam, lParam);
return SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam);
case WM_RBUTTONDOWN:
return TAB_RButtonDown (hwnd, wParam, lParam);