@@ -26,6 +26,7 @@ public final class AppKitBackend: AppBackend {
2626 public let menuImplementationStyle = MenuImplementationStyle . dynamicPopover
2727 public let canRevealFiles = true
2828 public let deviceClass = DeviceClass . desktop
29+ public let supportedDatePickerStyles : [ DatePickerStyle ] = [ . automatic, . graphical, . compact]
2930
3031 public var scrollBarWidth : Int {
3132 // We assume that all scrollers have their controlSize set to `.regular` by default.
@@ -1796,22 +1797,7 @@ public final class AppKitBackend: AppBackend {
17961797 parent. endSheet ( sheet)
17971798 parent. nestedSheet = nil
17981799 }
1799- }
1800-
1801- public final class NSCustomSheet : NSCustomWindow , NSWindowDelegate {
1802- public var onDismiss : ( ( ) -> Void ) ?
1803-
1804- public var interactiveDismissDisabled : Bool = false
1805-
1806- public var backgroundView : NSView ?
1807-
1808- @objc override public func cancelOperation( _ sender: Any ? ) {
1809- if !interactiveDismissDisabled {
1810- sheetParent? . endSheet ( self )
1811- onDismiss ? ( )
1812- }
1813- }
1814-
1800+
18151801 public func createDatePicker( ) -> NSView {
18161802 let datePicker = CustomDatePicker ( )
18171803 datePicker. delegate = datePicker. strongDelegate
@@ -1822,7 +1808,7 @@ public final class NSCustomSheet: NSCustomWindow, NSWindowDelegate {
18221808 // choice for the current calendar means the cursor position is reset after every keystroke. I
18231809 // know of no simple way to tell whether NSDatePicker requires or forbids eras for a given
18241810 // calendar, so in lieu of that I have hardcoded the calendar identifiers.
1825- private let calendarsWithEras : Set < Calendar . Identifier > = [
1811+ private let calendarsRequiringEra : Set < Calendar . Identifier > = [
18261812 . buddhist, . coptic, . ethiopicAmeteAlem, . ethiopicAmeteMihret, . indian, . islamic,
18271813 . islamicCivil, . islamicTabular, . islamicUmmAlQura, . japanese, . persian, . republicOfChina,
18281814 ]
@@ -1858,13 +1844,13 @@ public final class NSCustomSheet: NSCustomWindow, NSWindowDelegate {
18581844 var elementFlags : NSDatePicker . ElementFlags = [ ]
18591845 if components. contains ( . date) {
18601846 elementFlags. insert ( . yearMonthDay)
1861- if calendarsWithEras . contains ( environment. calendar. identifier) {
1847+ if calendarsRequiringEra . contains ( environment. calendar. identifier) {
18621848 elementFlags. insert ( . era)
18631849 }
18641850 }
18651851 if components. contains ( . hourMinuteAndSecond) {
18661852 elementFlags. insert ( . hourMinuteSecond)
1867- } else {
1853+ } else if components . contains ( . hourAndMinute ) {
18681854 elementFlags. insert ( . hourMinute)
18691855 }
18701856
@@ -1887,6 +1873,21 @@ public final class NSCustomSheet: NSCustomWindow, NSWindowDelegate {
18871873 }
18881874}
18891875
1876+ public final class NSCustomSheet : NSCustomWindow , NSWindowDelegate {
1877+ public var onDismiss : ( ( ) -> Void ) ?
1878+
1879+ public var interactiveDismissDisabled : Bool = false
1880+
1881+ public var backgroundView : NSView ?
1882+
1883+ @objc override public func cancelOperation( _ sender: Any ? ) {
1884+ if !interactiveDismissDisabled {
1885+ sheetParent? . endSheet ( self )
1886+ onDismiss ? ( )
1887+ }
1888+ }
1889+ }
1890+
18901891final class NSCustomTapGestureTarget : NSView {
18911892 var leftClickHandler : ( ( ) -> Void ) ? {
18921893 didSet {
0 commit comments