mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-27 21:18:54 +01:00
Cocoa: add TCocoaConfigAppMenu.onCreate for custom
This commit is contained in:
parent
da931797db
commit
1259df9b51
@ -21,6 +21,7 @@ var
|
||||
aboutItem: nil;
|
||||
preferencesItem: nil;
|
||||
customMenus: nil;
|
||||
onCreate: nil;
|
||||
dontAutoCreateItems: False;
|
||||
);
|
||||
|
||||
|
||||
@ -115,6 +115,8 @@ type
|
||||
defaultRadioImageName: NSString;
|
||||
end;
|
||||
|
||||
TCocoaConfigAppMenuOnCreate = procedure ( appMenu: NSMenu );
|
||||
|
||||
// Application interface provided to facilitate APP to operate App Menu.
|
||||
// it's easy to set About, Preferences, and customized menus,
|
||||
// only the LCL TMenuItem is needed to pass in.
|
||||
@ -124,6 +126,7 @@ type
|
||||
aboutItem: TMenuItem;
|
||||
preferencesItem: TMenuItem;
|
||||
customMenus: TMenuItem;
|
||||
onCreate: TCocoaConfigAppMenuOnCreate;
|
||||
dontAutoCreateItems: Boolean;
|
||||
end;
|
||||
|
||||
|
||||
@ -523,6 +523,12 @@ begin
|
||||
rsMacOSMenuPreferences,
|
||||
VK_OEM_COMMA, [ssMeta]);
|
||||
|
||||
// Custom onCreate
|
||||
if Assigned( CocoaConfigMenu.appMenu.onCreate ) then begin
|
||||
submenu.addItem( NSMenuItem.separatorItem );
|
||||
CocoaConfigMenu.appMenu.onCreate( submenu );
|
||||
end;
|
||||
|
||||
// Auto Create App Menu below?
|
||||
if CocoaConfigMenu.appMenu.dontAutoCreateItems then
|
||||
Exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user