X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7edcafa467269b15e0e967e9fe9ee08c6696b8a7..7d1f4c3ff01b09105c07d5e176a14428c834975e:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index c87393282d..e78fc96cd9 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -123,6 +123,8 @@ class wxPopupMenuWindow : public wxPopupTransientWindow { public: wxPopupMenuWindow(wxWindow *parent, wxMenu *menu); + + ~wxPopupMenuWindow(); // override the base class version to select the first item initially virtual void Popup(wxWindow *focus = NULL); @@ -308,6 +310,10 @@ wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu) SetCursor(wxCURSOR_ARROW); } +wxPopupMenuWindow::~wxPopupMenuWindow() +{ +} + // ---------------------------------------------------------------------------- // wxPopupMenuWindow current item/node handling // ---------------------------------------------------------------------------- @@ -662,7 +668,7 @@ bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event) wxPopupMenuWindow *win = menu->m_popupMenu; wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") ); - + pos = ClientToScreen(pos); if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) ) { @@ -1154,6 +1160,10 @@ wxWindow *wxMenu::GetRootWindow() const wxMenu *menu = GetParent(); while ( menu ) { + // We are a submenu of a menu of a menubar + if (menu->GetMenuBar()) + return menu->GetMenuBar(); + win = menu->GetInvokingWindow(); if ( win ) break; @@ -1164,7 +1174,7 @@ wxWindow *wxMenu::GetRootWindow() const // we're probably going to crash in the caller anyhow, but try to detect // this error as soon as possible wxASSERT_MSG( win, _T("menu without any associated window?") ); - + // also remember it in this menu so that we don't have to search for it the // next time wxConstCast(this, wxMenu)->m_invokingWindow = win; @@ -1259,7 +1269,7 @@ void wxMenu::Popup(const wxPoint& pos, const wxSize& size, bool selectFirst) { m_popupMenu->SelectFirst(); } - + // the geometry might have changed since the last time we were shown, so // always resize m_popupMenu->SetClientSize(GetGeometryInfo().GetSize()); @@ -1837,7 +1847,7 @@ int wxMenuBar::GetMenuFromPoint(const wxPoint& pos) const void wxMenuBar::SelectMenu(size_t pos) { SetFocus(); - wxLogDebug("Capturing mouse from wxMenuBar::SelectMenu"); + wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::SelectMenu")); CaptureMouse(); DoSelectMenu(pos); @@ -1926,7 +1936,7 @@ void wxMenuBar::OnLeftDown(wxMouseEvent& event) } else // on item { - wxLogDebug("Capturing mouse from wxMenuBar::OnLeftDown"); + wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown")); CaptureMouse(); // show it as selected @@ -2289,7 +2299,7 @@ void wxMenuBar::OnDismiss() { if ( GetCapture() ) { - wxLogDebug("Releasing mouse from wxMenuBar::OnDismiss"); + wxLogTrace(_T("mousecapture"), _T("Releasing mouse from wxMenuBar::OnDismiss")); GetCapture()->ReleaseMouse(); } @@ -2379,6 +2389,9 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) void wxWindow::DismissPopupMenu() { wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") ); + + char *crash = NULL; + (*crash) = 0; ms_evtLoopPopup->Exit(); }