Commit c5940433 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Make the controls send notifications to the parent window passed to

them in CREATESTRUCT. Based on a treeview patch by Igor Grahek.
parent abeb325c
......@@ -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);
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......@@ -923,7 +924,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,
......@@ -1074,7 +1075,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;
......@@ -1100,13 +1101,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;
}
......@@ -1220,7 +1222,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:
......
......@@ -59,6 +59,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 */
......@@ -118,13 +119,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);
}
......@@ -1526,7 +1528,7 @@ TAB_DrawItemInterior
/*
* send the draw message
*/
SendMessageA( GetParent(hwnd), WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
SendMessageA( infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)id, (LPARAM)&dis );
}
else
{
......@@ -3001,6 +3003,7 @@ 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;
......@@ -3044,7 +3047,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 +3116,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 +3247,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);
......
......@@ -4715,7 +4715,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nButtonDown = -1;
infoPtr->nOldHit = -1;
infoPtr->nHotItem = -2; /* It has to be initially different from nOldHit */
infoPtr->hwndNotify = GetParent (hwnd);
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->bTransparent = (dwStyle & TBSTYLE_TRANSPARENT);
infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST));
infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE : DT_CENTER;
......@@ -5453,7 +5453,7 @@ TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
INT i;
if (lParam == NF_REQUERY) {
i = SendMessageA(GetParent(infoPtr->hwndSelf),
i = SendMessageA(infoPtr->hwndNotify,
WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
......@@ -5649,6 +5649,8 @@ TOOLBAR_SysColorChange (HWND hwnd)
static LRESULT WINAPI
ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
......@@ -6002,13 +6004,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_DRAWITEM:
case WM_MEASUREITEM:
case WM_VKEYTOITEM:
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if(infoPtr != NULL)
return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
else
return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
}
return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
/* We see this in Outlook Express 5.x and just does DefWindowProc */
case PGM_FORWARDMOUSE:
......
......@@ -1902,12 +1902,11 @@ TOOLTIPS_WindowFromPoint (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT
TOOLTIPS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
{
TOOLTIPS_INFO *infoPtr;
NONCLIENTMETRICSA nclm;
INT nResult;
HWND hParent;
/* allocate memory for info structure */
infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
......@@ -1930,21 +1929,16 @@ TOOLTIPS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L);
hParent = GetParent(hwnd);
if (hParent) {
nResult = (INT) SendMessageA (hParent, WM_NOTIFYFORMAT,
nResult = (INT) SendMessageA (lpcs->hwndParent, WM_NOTIFYFORMAT,
(WPARAM)hwnd, (LPARAM)NF_QUERY);
if (nResult == NFR_ANSI) {
infoPtr->bNotifyUnicode = FALSE;
if (nResult == NFR_ANSI) {
infoPtr->bNotifyUnicode = FALSE;
TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
}
else if (nResult == NFR_UNICODE) {
infoPtr->bNotifyUnicode = TRUE;
TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
}
else {
ERR (" -- WM_NOTIFYFORMAT returns: error!\n");
}
} else if (nResult == NFR_UNICODE) {
infoPtr->bNotifyUnicode = TRUE;
TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
} else {
TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
}
SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
......@@ -2371,7 +2365,7 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_CREATE:
return TOOLTIPS_Create (hwnd, wParam, lParam);
return TOOLTIPS_Create (hwnd, (LPCREATESTRUCTW)lParam);
case WM_DESTROY:
return TOOLTIPS_Destroy (hwnd, wParam, lParam);
......
......@@ -4718,7 +4718,7 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam)
/* Create/Destroy *******************************************************/
static LRESULT
TREEVIEW_Create(HWND hwnd)
TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
{
RECT rcClient;
TREEVIEW_INFO *infoPtr;
......@@ -4797,7 +4797,7 @@ TREEVIEW_Create(HWND hwnd)
infoPtr->root->iLevel = -1;
infoPtr->root->visibleOrder = -1;
infoPtr->hwndNotify = GetParent(hwnd);
infoPtr->hwndNotify = lpcs->hwndParent;
#if 0
infoPtr->bTransparent = ( GetWindowLongA( hwnd, GWL_STYLE) & TBSTYLE_FLAT);
#endif
......@@ -5179,7 +5179,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
else
{
if (uMsg == WM_CREATE)
TREEVIEW_Create(hwnd);
TREEVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);
else
goto def;
}
......
......@@ -48,6 +48,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(updown);
typedef struct
{
HWND Self; /* Handle to this up-down control */
HWND Notify; /* Handle to the parent window */
UINT AccelCount; /* Number of elements in AccelVect */
UDACCEL* AccelVect; /* Vector containing AccelCount elements */
INT AccelIndex; /* Current accel index, -1 if not accel'ing */
......@@ -562,8 +563,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
ni.hdr.hwndFrom = infoPtr->Self;
ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
ni.hdr.code = UDN_DELTAPOS;
if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY,
(WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
if (!SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
/* Parent said: OK to adjust */
/* Now adjust value with (maybe new) delta */
......@@ -574,10 +574,8 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
}
/* Also, notify it. This message is sent in any case. */
SendMessageW( GetParent(infoPtr->Self),
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal),
(LPARAM)infoPtr->Self);
SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self);
}
/***********************************************************************
......@@ -616,7 +614,7 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
hdr.hwndFrom = infoPtr->Self;
hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
hdr.code = NM_RELEASEDCAPTURE;
SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
SendMessageW(infoPtr->Notify, WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
ReleaseCapture();
}
......@@ -720,6 +718,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
/* initialize the info struct */
infoPtr->Self = hwnd;
infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0;
infoPtr->AccelIndex = -1;
......@@ -798,7 +797,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
if ( (infoPtr->Flags & FLAG_MOUSEIN) &&
(infoPtr->Flags & FLAG_ARROW) ) {
SendMessageW( GetParent(hwnd),
SendMessageW( infoPtr->Notify,
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_ENDSCROLL, infoPtr->CurVal),
(LPARAM)hwnd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment