X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd9cd5343b90490e914604eca95f2e07ba8fd072..44d130a35e7973911686d664bcf275a538990d52:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 20df0dd866..36162cb9a9 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -430,7 +430,10 @@ bool wxWindowMSW::Create(wxWindow *parent, msflags |= WS_VISIBLE; } - return MSWCreate(wxCanvasClassName, NULL, pos, size, msflags, exstyle); + bool retVal = MSWCreate(wxCanvasClassName, NULL, pos, size, msflags, exstyle); + if (retVal) + SetWindowLong( (HWND)m_hWnd, GWL_WNDPROC, (LONG)wxWndProc); + return retVal; } // --------------------------------------------------------------------------- @@ -2955,7 +2958,7 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, WXHWND wxWindowMSW::MSWGetParent() const { - return m_parent ? m_parent->GetHWND() : NULL; + return m_parent ? m_parent->GetHWND() : WXHWND(NULL); } bool wxWindowMSW::MSWCreate(const wxChar *wclass, @@ -3021,7 +3024,7 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass, // --------------------------------------------------------------------------- #ifdef __WIN95__ -// FIXME: VZ: I'm not sure at all that the order of processing is correct + bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { #ifndef __WXMICROWIN__ @@ -3029,12 +3032,19 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) HWND hWnd = hdr->hwndFrom; wxWindow *win = wxFindWinFromHandle((WXHWND)hWnd); - // is this one of our windows? + // if the control is one of our windows, let it handle the message itself if ( win ) { return win->MSWOnNotify(idCtrl, lParam, result); } + // VZ: why did we do it? normally this is unnecessary and, besides, it + // breaks the message processing for the toolbars because the tooltip + // notifications were being forwarded to the toolbar child controls + // (if it had any) before being passed to the toolbar itself, so in my + // example the tooltip for the combobox was always shown instead of the + // correct button tooltips +#if 0 // try all our children wxWindowList::Node *node = GetChildren().GetFirst(); while ( node ) @@ -3047,8 +3057,9 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) node = node->GetNext(); } +#endif // 0 - // finally try this window too (catches toolbar case) + // by default, handle it ourselves return MSWOnNotify(idCtrl, lParam, result); #else // __WXMICROWIN__ return FALSE; @@ -3067,7 +3078,7 @@ bool wxWindowMSW::HandleTooltipNotify(WXUINT code, // we need to handle it as well, otherwise no tooltips will be shown in // this case - if ( !(code == TTN_NEEDTEXTA || code == TTN_NEEDTEXTW) || ttip.empty() ) + if ( !(code == (WXUINT) TTN_NEEDTEXTA || code == (WXUINT) TTN_NEEDTEXTW) || ttip.empty() ) { // not a tooltip message or no tooltip to show anyhow return FALSE; @@ -3075,7 +3086,7 @@ bool wxWindowMSW::HandleTooltipNotify(WXUINT code, LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam; - if ( code == TTN_NEEDTEXTA ) + if ( code == (WXUINT) TTN_NEEDTEXTA ) { ttText->lpszText = (wxChar *)ttip.c_str(); } @@ -3131,6 +3142,7 @@ bool wxWindowMSW::MSWOnNotify(int WXUNUSED(idCtrl), return FALSE; } + #endif // __WIN95__ // --------------------------------------------------------------------------- @@ -3191,7 +3203,7 @@ bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) { // there is no need to do anything for the top level windows const wxWindow *parent = GetParent(); - if ( parent && !parent->IsTopLevel() ) + while ( parent && !parent->IsTopLevel() ) { LONG exStyle = ::GetWindowLong(GetHwndOf(parent), GWL_EXSTYLE); if ( !(exStyle & WS_EX_CONTROLPARENT) ) @@ -3200,6 +3212,8 @@ bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) ::SetWindowLong(GetHwndOf(parent), GWL_EXSTYLE, exStyle | WS_EX_CONTROLPARENT); } + + parent = parent->GetParent(); } } @@ -3605,7 +3619,7 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange) if ( hWndPalChange != GetHWND() ) { // check to see if we our our parents have a custom palette - wxWindow *win = this; + wxWindowMSW *win = this; while ( win && !win->HasCustomPalette() ) { win = win->GetParent(); @@ -3654,7 +3668,7 @@ bool wxWindowMSW::HandleQueryNewPalette() #if wxUSE_PALETTE // check to see if we our our parents have a custom palette - wxWindow *win = this; + wxWindowMSW *win = this; while (!win->HasCustomPalette() && win->GetParent()) win = win->GetParent(); if (win->HasCustomPalette()) { /* realize the palette to see whether redrawing is needed */