From 8f495aed95add93fbdfe2a318f9ca2e932a17f3e Mon Sep 17 00:00:00 2001 From: rich2014 Date: Wed, 21 Aug 2024 22:34:48 +0800 Subject: [PATCH] Cocoa/Config: turn ToggleBox Config to the new Style --- lcl/interfaces/cocoa/cocoaconfig.inc | 8 +++++++- lcl/interfaces/cocoa/cocoaconfig.pas | 8 ++++++-- lcl/interfaces/cocoa/cocoawsstdctrls.pas | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoaconfig.inc b/lcl/interfaces/cocoa/cocoaconfig.inc index a14d4d8cba..806543cb8b 100644 --- a/lcl/interfaces/cocoa/cocoaconfig.inc +++ b/lcl/interfaces/cocoa/cocoaconfig.inc @@ -87,10 +87,16 @@ var // min height for the Knob of VerticalScroller // min width for the Knob of HorizontalScroller minSize: 25; - ) + ); ); ); +var + CocoaConfigToggleBox: TCocoaConfigToggleBox = ( + bezelStyle: NSRoundedBezelStyle; + buttonType: NSPushOnPushOffButton; + ); + var CocoaConfigNotification: TCocoaConfigNotification = ( // by default on macOS, Notification is only Presented when the APP is diff --git a/lcl/interfaces/cocoa/cocoaconfig.pas b/lcl/interfaces/cocoa/cocoaconfig.pas index 130e2507a9..42923f690e 100644 --- a/lcl/interfaces/cocoa/cocoaconfig.pas +++ b/lcl/interfaces/cocoa/cocoaconfig.pas @@ -138,6 +138,12 @@ type overlay: TCocoaConfigScrollerOverlay; end; +type + TCocoaConfigToggleBox = record + bezelStyle: NSBezelStyle; + buttonType: NSButtonType; + end; + type TCocoaConfigNotification = record alwaysPresent: Boolean; @@ -174,8 +180,6 @@ var // if set to true, then WS would not assign icons via TCocoaWSForm SetIcon // The icon would have to be changed manually. By default LCL behaviour is used CocoaIconUse: Boolean = false; - CocoaToggleBezel : NSBezelStyle = NSRoundedBezelStyle; - CocoaToggleType : NSButtonType = NSPushOnPushOffButton; CocoaHideFocusNoBorder : Boolean = true; diff --git a/lcl/interfaces/cocoa/cocoawsstdctrls.pas b/lcl/interfaces/cocoa/cocoawsstdctrls.pas index d069889aa8..a1fc92ce19 100644 --- a/lcl/interfaces/cocoa/cocoawsstdctrls.pas +++ b/lcl/interfaces/cocoa/cocoawsstdctrls.pas @@ -2275,7 +2275,8 @@ var btn: NSButton; cl: NSButtonCell; begin - btn := AllocButton(AWinControl, TLCLCheckBoxCallback, AParams, CocoaToggleBezel, CocoaToggleType); + btn := AllocButton(AWinControl, TLCLCheckBoxCallback, AParams, + CocoaConfigToggleBox.bezelStyle, CocoaConfigToggleBox.buttonType); cl := NSButtonCell(NSButton(btn).cell); cl.setShowsStateBy(cl.showsStateBy or NSContentsCellMask); Result := TLCLHandle(btn);