X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea1ad04b434f92c1269e6dde222a77698d6f873c..25d599ae91f2a57fa942625f2ff65fb6b3e2c014:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index e78fc96cd9..62dc90a1c8 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -257,6 +257,8 @@ public: } else { + // return FALSE; + return wxEvtHandler::ProcessEvent(event); } } @@ -312,6 +314,12 @@ wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu) wxPopupMenuWindow::~wxPopupMenuWindow() { + // When m_popupMenu in wxMenu is deleted because it + // is a child of an old menu bar being deleted (note: it does + // not get destroyed by the wxMenu destructor, but + // by DestroyChildren()), m_popupMenu should be reset to NULL. + + m_menu->m_popupMenu = NULL; } // ---------------------------------------------------------------------------- @@ -1251,7 +1259,9 @@ void wxMenu::OnDismiss(bool dismissParent) wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") ); m_invokingWindow->DismissPopupMenu(); - SetInvokingWindow(NULL); + + // Why reset it here? We need it for sending the event to... + // SetInvokingWindow(NULL); } } } @@ -1321,7 +1331,7 @@ bool wxMenu::ClickItem(wxMenuItem *item) // not applicabled isChecked = -1; } - + return SendEvent(item->GetId(), isChecked); } @@ -1393,20 +1403,10 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu, int id, const wxString& text, const wxString& help, - bool isCheckable, + wxItemKind kind, wxMenu *subMenu) + : wxMenuItemBase(parentMenu, id, text, help, kind, subMenu) { - m_id = id; - m_parentMenu = parentMenu; - m_subMenu = subMenu; - - m_text = text; - m_help = help; - - m_isCheckable = isCheckable; - m_isEnabled = TRUE; - m_isChecked = FALSE; - m_posY = m_height = -1; @@ -1426,10 +1426,10 @@ wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu, int id, const wxString& name, const wxString& help, - bool isCheckable, + wxItemKind kind, wxMenu *subMenu) { - return new wxMenuItem(parentMenu, id, name, help, isCheckable, subMenu); + return new wxMenuItem(parentMenu, id, name, help, kind, subMenu); } /* static */ @@ -1470,7 +1470,7 @@ void wxMenuItem::SetText(const wxString& text) void wxMenuItem::SetCheckable(bool checkable) { - if ( checkable != m_isCheckable ) + if ( checkable != IsCheckable() ) { wxMenuItemBase::SetCheckable(checkable); @@ -1520,6 +1520,8 @@ void wxMenuBar::Init() m_menuShown = NULL; m_shouldShowMenu = FALSE; + + m_windowStyle |= wxNO_FULL_REPAINT_ON_RESIZE; } void wxMenuBar::Attach(wxFrame *frame) @@ -2246,7 +2248,7 @@ void wxMenuBar::PopupCurrentMenu(bool selectFirst) wxCHECK_RET( m_current != -1, _T("no menu to popup") ); // forgot to call DismissMenu()? - wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menu at once!") ); + wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menus at once!") ); // in any case, we should show it - even if we won't m_shouldShowMenu = TRUE; @@ -2355,6 +2357,9 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) #endif // 0 menu->SetInvokingWindow(this); + + // wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() ); + menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0)); // this is not very useful if the menu was popped up because of the mouse @@ -2390,9 +2395,6 @@ void wxWindow::DismissPopupMenu() { wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") ); - char *crash = NULL; - (*crash) = 0; - ms_evtLoopPopup->Exit(); }