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

View File

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