From ff7f9c2def69a48a294ade0edaebe0b37bd19b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 17 Nov 2013 18:03:05 +0000 Subject: [PATCH] Put Services submenu into the Apple menu on OS X. Native applications have a Services submenu in the apple menu. wx applications didn't until now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75232 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 7 ++++++- src/osx/cocoa/menu.mm | 4 ++++ src/osx/menu_osx.cpp | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 0d03f0a313..a15f7cc576 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2293,8 +2293,13 @@ enum wxStandardID wxID_OSX_HIDE = wxID_OSX_MENU_FIRST, wxID_OSX_HIDEOTHERS, wxID_OSX_SHOWALL, +#if wxABI_VERSION >= 30001 + wxID_OSX_SERVICES, + wxID_OSX_MENU_LAST = wxID_OSX_SERVICES, +#else wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL, - +#endif + /* IDs used by generic file dialog (13 consecutive starting from this value) */ wxID_FILEDLGG = 5900, diff --git a/src/osx/cocoa/menu.mm b/src/osx/cocoa/menu.mm index 9733bc56cd..65d1572599 100644 --- a/src/osx/cocoa/menu.mm +++ b/src/osx/cocoa/menu.mm @@ -194,6 +194,10 @@ public : { [NSApp setMainMenu:m_osxMenu]; [NSApp setAppleMenu:[[m_osxMenu itemAtIndex:0] submenu]]; + + wxMenuItem *services = GetWXPeer()->FindItem(wxID_OSX_SERVICES); + if ( services ) + [NSApp setServicesMenu:services->GetSubMenu()->GetHMenu()]; } virtual void Enable( bool WXUNUSED(enable) ) diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index 20af4b3e1e..97685d31ef 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -615,6 +615,9 @@ static wxMenu *CreateAppleMenu() appleMenu->AppendSeparator(); } + appleMenu->Append(wxID_OSX_SERVICES, _("Services"), new wxMenu()); + appleMenu->AppendSeparator(); + // standard menu items, handled in wxMenu::HandleCommandProcess(), see above: wxString hideLabel; hideLabel = wxString::Format(_("Hide %s"), wxTheApp ? wxTheApp->GetAppDisplayName() : _("Application"));