Cocoa/Config: turn Menu Config to the new Style

This commit is contained in:
rich2014 2024-08-21 22:49:19 +08:00
parent 8f495aed95
commit 23b1da3131
2 changed files with 14 additions and 8 deletions

View File

@ -144,6 +144,12 @@ type
buttonType: NSButtonType;
end;
type
TCocoaConfigMenu = record
defaultCheckImageName: NSString;
defaultRadioImageName: NSString;
end;
type
TCocoaConfigNotification = record
alwaysPresent: Boolean;
@ -186,10 +192,6 @@ var
// some localized named might be too long to be returned properly by APIs
CocoaUseLocalizedFontName : Boolean = false;
// default Image Name for MenuItem
CocoaDefaultCheckMenuImageName : NSString;
CocoaDefaultRadioMenuImageName : NSString;
{$ifdef COCOALOOPHIJACK}
// The flag is set to true once hi-jacked loop is finished (at the end of app)
// The flag is checked in Menus to avoid "double" Cmd+Q menu
@ -198,6 +200,10 @@ var
{$include cocoaconfig.inc}
var
CocoaConfigMenu: TCocoaConfigMenu = (
);
implementation
var
@ -246,8 +252,8 @@ begin
end;
initialization
CocoaDefaultCheckMenuImageName:= NSSTR('NSMenuCheckmark');
CocoaDefaultRadioMenuImageName:= NSSTR('NSDatePickerCalendarHome');
CocoaConfigMenu.defaultCheckImageName:= NSSTR('NSMenuCheckmark');
CocoaConfigMenu.defaultRadioImageName:= NSSTR('NSDatePickerCalendarHome');
initDefaultFoucsRingSetting;
end.

View File

@ -161,12 +161,12 @@ end;
// used from the MenuMadness example
class function TCocoaWSMenuItem.NSMenuCheckmark: NSImage;
begin
Result:=NSImage.imageNamed(CocoaConfig.CocoaDefaultCheckMenuImageName);
Result:=NSImage.imageNamed(CocoaConfigMenu.defaultCheckImageName);
end;
class function TCocoaWSMenuItem.NSMenuRadio: NSImage;
begin
Result:=NSImage.imageNamed(CocoaConfig.CocoaDefaultRadioMenuImageName)
Result:=NSImage.imageNamed(CocoaConfigMenu.defaultRadioImageName);
end;
class function TCocoaWSMenuItem.isSeparator(const ACaption: AnsiString): Boolean;