Goo.NativeMenus
0.13.0
See the version list below for details.
dotnet add package Goo.NativeMenus --version 0.13.0
NuGet\Install-Package Goo.NativeMenus -Version 0.13.0
<PackageReference Include="Goo.NativeMenus" Version="0.13.0" />
<PackageVersion Include="Goo.NativeMenus" Version="0.13.0" />
<PackageReference Include="Goo.NativeMenus" />
paket add Goo.NativeMenus --version 0.13.0
#r "nuget: Goo.NativeMenus, 0.13.0"
#:package Goo.NativeMenus@0.13.0
#addin nuget:?package=Goo.NativeMenus&version=0.13.0
#tool nuget:?package=Goo.NativeMenus&version=0.13.0
Native menus
let save = Command(() -> SaveDocument())
let actions = List[NativeMenuItem]()
actions.Add(NativeMenuItem{
Id: "save", Text: "Save", Enabled: save.CanExecute,
Shortcut: NativeMenuShortcut{Key: "s", Modifiers: KeyModifiers{Super: true}},
})
let menus = List[NativeMenuItem]()
menus.Add(NativeMenuItem{Id: "file", Text: "File", Items: actions})
let bar = NativeMenuBar(window)
bar.Activated += id -> { if id == "save" { save.Execute() } }
let result = bar.SetItems(menus)
Reference Goo.NativeMenus. Share Command objects with widgets.
- Call on the open owner's UI thread. Dispose the bar when it is no longer needed.
- Publish a complete snapshot. IDs and shortcuts must be unique.
- A separator has an empty ID, no children and no shortcut.
- A shortcut uses one printable logical key. It runs as a native accelerator.
- Bar activation uses the Goo queue after input is restored. Context selection completes only its task.
- Context points use owner-content Goo layout units.
- Desktop tracking blocks the Goo scheduler.
- Check the result status. Cancellation is
Cancelled. Conflicting work in an owner chain isBusy. - Closing the owner completes a pending menu as
OwnerClosed, including before native launch.
| Platform | Bar | Context |
|---|---|---|
| macOS | Global bar selected by the key Goo window | NSMenu |
| Windows | Per-window HMENU | TrackPopupMenuEx |
| Wayland | Unsupported | Unsupported |
| Android | Unsupported | Android ContextMenu |
macOS keeps SDL's application and system menus. Super means Command.
The default bar is restored only while this package still owns the menu.
Windows uses the active keyboard layout and rebuilds accelerators when it changes.
Super and keys outside that layout return Unsupported.
The official SDL binary supplies the pre-TranslateMessage hook. No SDL patch is required.
Android requires GooActivity, which forwards native menu closure to the owner.
Other Activity hosts return Unsupported. Android shortcuts return Unsupported.
Activity teardown completes the menu as OwnerClosed.
Build both package targets with -p:GooBuildAndroid=true.
dotnet build tests/Goo.AndroidSmoke/Goo.AndroidSmoke.csproj -c Release -p:GooBuildAndroid=true
adb shell am start -n org.goo.androidsmoke/.MainActivity --ez goo.native_menu_smoke true
adb logcat -s GooNativeMenus
On a Vulkan Android device, open Actions, then choose Select. Press Back on the cancellation menu.
The smoke then checks owner-close completion and prints passed.
See API reference.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Goo (>= 0.13.0)
-
net10.0-android36.0
- Goo (>= 0.13.0)
- Goo.Android (>= 0.13.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.