X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/036da5e37479c4e2bc3493d3a7a37ac629757515..802e3a187b442f23aebe3809b63579a0345d3803:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index b99b966f66..e762e88e84 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -179,7 +179,7 @@ static void TranslateKbdEventToMouse(wxWindowMSW *win, static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win); // find the window for the mouse event at the specified position -static wxWindowMSW *FindWindowForMouseEvent(wxWindow *win, int *x, int *y); +static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y); //TW:REQ:Univ // wrapper around BringWindowToTop() API static inline void wxBringWindowToTop(HWND hwnd) @@ -413,7 +413,10 @@ bool wxWindowMSW::Create(wxWindow *parent, #ifdef __WXUNIVERSAL__ // no borders, we draw them ourselves - exstyle = 0; + exstyle &= ~(WS_EX_DLGMODALFRAME | + WS_EX_STATICEDGE | + WS_EX_CLIENTEDGE | + WS_EX_WINDOWEDGE); msflags &= ~WS_BORDER; #endif // wxUniversal @@ -1160,6 +1163,17 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const *exstyle |= WS_EX_DLGMODALFRAME; break; } + + // to make the dialog navigation work with the nested panels we must + // use this style but, unfortunately, it hangs NT4 in some situations + // so we shouldn't use it -- even though it means that keyboard accels + // in, e.g. wxWizard, don't work +#if 0 + if ( flags & wxTAB_TRAVERSAL ) + { + *exstyle |= WS_EX_CONTROLPARENT; + } +#endif // 0 } return style; @@ -1995,9 +2009,23 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) return TRUE; } - //else: no default button + else // no default button + { #endif // wxUSE_BUTTON - // treat Enter as TAB: pass to the next control + // this is a quick and dirty test for a text + // control + if ( !(lDlgCode & DLGC_HASSETSEL) ) + { + // don't process Enter, the control might + // need it for itself and don't let + // ::IsDialogMessage() have it as it can + // eat the Enter events sometimes + return FALSE; + } + //else: treat Enter as TAB: pass to the next + // control as this is the best thing to do + // if the text doesn't handle Enter itself + } } } break; @@ -2407,9 +2435,15 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam y = GET_Y_LPARAM(lParam); // redirect the event to a static control if necessary - wxWindow *win = FindWindowForMouseEvent(this, &x, &y); - - processed = win->HandleMouseEvent(message, x, y, wParam); + if (this == GetCapture()) + { + processed = HandleMouseEvent(message, x, y, wParam); + } + else + { + wxWindowMSW *win = FindWindowForMouseEvent(this, &x, &y); //TW:REQ:Univ + processed = win->HandleMouseEvent(message, x, y, wParam); + } } } break; @@ -2880,6 +2914,11 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, return nonDefault; } +WXHWND wxWindowMSW::MSWGetParent() const +{ + return m_parent ? m_parent->GetHWND() : NULL; +} + bool wxWindowMSW::MSWCreate(const wxChar *wclass, const wxChar *title, const wxPoint& pos, @@ -2891,41 +2930,10 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass, int x, y, w, h; (void)MSWGetCreateWindowCoords(pos, size, x, y, w, h); - // find the correct parent HWND - wxWindow *parent = GetParent(); - bool isChild = (style & WS_CHILD) != 0; - HWND hParent; - if ( GetWindowStyleFlag() & wxPOPUP_WINDOW ) - { - // popup windows should have desktop as parent because they shouldn't - // be limited to the parents client area as child windows usually are - hParent = ::GetDesktopWindow(); - } - else // !popup - { - if ( (isChild || HasFlag(wxFRAME_TOOL_WINDOW)) && parent ) - { - // this is either a normal child window or a top level window with - // wxFRAME_TOOL_WINDOW style (see below) - hParent = GetHwndOf(parent); - } - else - { - // this is either a window for which no parent was specified (not - // much we can do then) or a frame without wxFRAME_TOOL_WINDOW - // style: we should use NULL parent HWND for it or it would be - // always on top of its parent which is not what we usually want - // (in fact, we only want it for frames with the special - // wxFRAME_TOOL_WINDOW as above) - hParent = NULL; - } - - } - // controlId is menu handle for the top level windows, so set it to 0 // unless we're creating a child window int controlId; - if ( isChild ) + if ( style & WS_CHILD ) { controlId = GetId(); @@ -2952,17 +2960,17 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass, wxWindowCreationHook hook(this); m_hWnd = (WXHWND)::CreateWindowEx - ( - extendedStyle, - className, - title ? title : wxT(""), - style, - x, y, w, h, - hParent, - (HMENU)controlId, - wxGetInstance(), - NULL // no extra data - ); + ( + extendedStyle, + className, + title ? title : wxT(""), + style, + x, y, w, h, + (HWND)MSWGetParent(), + (HMENU)controlId, + wxGetInstance(), + NULL // no extra data + ); if ( !m_hWnd ) { @@ -3954,6 +3962,7 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event, event.SetTimestamp(s_currentMsg.time); event.m_eventObject = this; + event.SetId(GetId()); #if wxUSE_MOUSEEVENT_HACK m_lastMouseX = x; @@ -3972,7 +3981,7 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event, // Notice that this is not done for the mouse move events because this could // (would?) be too slow, but only for clicks which means that the static texts // still don't get move, enter nor leave events. -static wxWindowMSW *FindWindowForMouseEvent(wxWindow *win, int *x, int *y) +static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y) //TW:REQ:Univ { wxCHECK_MSG( x && y, win, _T("NULL pointer in FindWindowForMouseEvent") );