Browse Source
* [NativeMenu] [Refactoring] Move Default Menu creation from native lib to C# (C# side of code) * fix return type for IAvnApplicationCommands * [Native] menu refactoring (ObjC side) * fix nullref * minor refactor Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com> Co-authored-by: Dan Walmsley <dan@walms.co.uk>pull/7132/head
committed by
GitHub
10 changed files with 198 additions and 82 deletions
@ -0,0 +1,12 @@ |
|||||
|
namespace Avalonia.Controls.Platform |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Native Menu Default Application Commands
|
||||
|
/// </summary>
|
||||
|
public interface INativeApplicationCommands |
||||
|
{ |
||||
|
void HideApp(); |
||||
|
void ShowAll(); |
||||
|
void HideOthers(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using Avalonia.Controls; |
||||
|
using Avalonia.Controls.Platform; |
||||
|
using Avalonia.Native.Interop; |
||||
|
|
||||
|
namespace Avalonia.Native |
||||
|
{ |
||||
|
internal class MacOSNativeMenuCommands : INativeApplicationCommands |
||||
|
{ |
||||
|
private readonly IAvnApplicationCommands _commands; |
||||
|
|
||||
|
public MacOSNativeMenuCommands(IAvnApplicationCommands commands) |
||||
|
{ |
||||
|
_commands = commands; |
||||
|
} |
||||
|
|
||||
|
public void HideApp() |
||||
|
{ |
||||
|
_commands.HideApp(); |
||||
|
} |
||||
|
|
||||
|
public void ShowAll() |
||||
|
{ |
||||
|
_commands.ShowAll(); |
||||
|
} |
||||
|
|
||||
|
public void HideOthers() |
||||
|
{ |
||||
|
_commands.HideOthers(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static readonly AttachedProperty<bool> IsServicesSubmenuProperty = |
||||
|
AvaloniaProperty.RegisterAttached<MacOSNativeMenuCommands, NativeMenu, bool>("IsServicesSubmenu", false); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue