macOS Default Menu Handling

Ryan Ogurek <[email protected]> Sun, 31 May 2026 19:10:07 -0700 (PDT)
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
------=_Part_377464_661997561.1780279807682
Content-Type: multipart/alternative; 
	boundary="----=_Part_377465_436363679.1780279807682"

------=_Part_377465_436363679.1780279807682
Content-Type: text/plain; charset="UTF-8"

Hello,

I've been looking at the way wxWidgets handles the macOS "default" items 
like "About" and "Preferences," and I'm a bit confused by it, stepping 
through the code with a debugger a bit.

I see CreateAppleMenu() and MacInstallMenuBar() in menu_osx.cpp, where in 
the former the About and preferences items are added unconditionally (if 
the static item ids are set) to a menu added to all menu bars (afaics).

CreateAppleMenu() creates "About %s" with the GetAppDisplayName() and 
"Preferences..." with the correct accelerator (although "Preferences..." is 
outdated, and macOS uses "Settings..." now, but that's an aside).

In MacInstallMenuBar() though, whenever these menu items are found, the 
item labels are replaced with the labels from the `wxItem`. This ends up 
replacing the labels created in `CreateAppleMenu()` (which were what I'd 
expect a macOS app to have, more or less).

For these menu items, I don't provide a label, so it just replaces it with 
the stock label and accelerator.

Is the intent that a non-stock item id should be set (in the macOS-specific 
static fields in wxApp, e.g. `s_macAboutMenuItemId`) for About in order to 
circumvent wxWidget's default handling, and instead the macOS specific 
default handling labels to persist?

If that's intentional, I suppose it is what it is, but it just seems rather 
awkward, so I thought I'd ask.

Thank you,
Ryan Ogurek

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/wx-users/b8199c9c-e174-4b2d-aadd-98e1f3f74466n%40googlegroups.com.

------=_Part_377465_436363679.1780279807682
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello,<div><br /></div><div>I've been looking at the way wxWidgets handles =
the macOS "default" items like "About" and "Preferences," and I'm a bit con=
fused by it, stepping through the code with a debugger a bit.</div><div><br=
 /></div><div>I see CreateAppleMenu() and MacInstallMenuBar() in menu_osx.c=
pp, where in the former the About and preferences items are added unconditi=
onally (if the static item ids are set) to a menu added to all menu bars (a=
faics).</div><div><br /></div><div>CreateAppleMenu() creates "About %s" wit=
h the GetAppDisplayName() and "Preferences..." with the correct accelerator=
 (although "Preferences..." is outdated, and macOS uses "Settings..." now, =
but that's an aside).</div><div><br /></div><div>In MacInstallMenuBar() tho=
ugh, whenever these menu items are found, the item labels are replaced with=
 the labels from the `wxItem`. This ends up replacing the labels created in=
 `CreateAppleMenu()` (which were what I'd expect a macOS app to have, more =
or less).</div><div><br /></div><div>For these menu items, I don't provide =
a label, so it just replaces it with the stock label and accelerator.</div>=
<div><br /></div><div>Is the intent that a non-stock item id should be set =
(in the macOS-specific static fields in wxApp, e.g. `s_macAboutMenuItemId`)=
 for About in order to circumvent wxWidget's default handling, and instead =
the macOS specific default handling labels to persist?</div><div><br /></di=
v><div>If that's intentional, I suppose it is what it is, but it just seems=
 rather awkward, so I thought I'd ask.</div><div><br /></div><div>Thank you=
,</div><div>Ryan Ogurek</div>

<p></p>

-- <br />
Please read <a href=3D"https://www.wxwidgets.org/support/mlhowto.htm">https=
://www.wxwidgets.org/support/mlhowto.htm</a> before posting.<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wx-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wx-users+u=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
wx-users/b8199c9c-e174-4b2d-aadd-98e1f3f74466n%40googlegroups.com?utm_mediu=
m=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/wx-users/b=
8199c9c-e174-4b2d-aadd-98e1f3f74466n%40googlegroups.com</a>.<br />

------=_Part_377465_436363679.1780279807682--

------=_Part_377464_661997561.1780279807682--