|
6 | 6 | "utils.rkt" |
7 | 7 | "const.rkt" |
8 | 8 | "types.rkt" |
| 9 | + "liquid-glass.rkt" |
9 | 10 | "window.rkt" |
10 | 11 | "queue.rkt" |
11 | 12 | "menu-bar.rkt" |
|
28 | 29 |
|
29 | 30 | (import-class NSWindow NSGraphicsContext NSMenu NSPanel |
30 | 31 | NSApplication NSAutoreleasePool NSScreen |
31 | | - NSToolbar NSArray) |
| 32 | + NSToolbar NSArray NSView) |
32 | 33 |
|
33 | 34 | (define NSWindowCloseButton 0) |
34 | 35 | (define NSWindowToolbarButton 3) |
|
319 | 320 |
|
320 | 321 | (tellv cocoa setAcceptsMouseMovedEvents: #:type _BOOL #t) |
321 | 322 |
|
| 323 | + (define inner-content-view |
| 324 | + (cond |
| 325 | + [(and is-dialog? liquid-glass?) |
| 326 | + (import-class NSLayoutConstraint) |
| 327 | + (define cv (tell (tell NSView alloc) init)) |
| 328 | + (define win (tell cocoa contentView)) |
| 329 | + (define margin 10) |
| 330 | + (tellv win addSubview: cv) |
| 331 | + (tellv cv setTranslatesAutoresizingMaskIntoConstraints: #:type _BOOL #false) |
| 332 | + (tellv NSLayoutConstraint |
| 333 | + activateConstraints: |
| 334 | + (tell NSArray |
| 335 | + arrayWithObjects: #:type (_list i _id) |
| 336 | + (list |
| 337 | + (tell (tell cv topAnchor) constraintEqualToAnchor: (tell win topAnchor) constant: #:type _CGFloat margin) |
| 338 | + (tell (tell cv leadingAnchor) constraintEqualToAnchor: (tell win leadingAnchor) constant: #:type _CGFloat margin) |
| 339 | + (tell (tell cv trailingAnchor) constraintEqualToAnchor: (tell win trailingAnchor) constant: #:type _CGFloat (- margin)) |
| 340 | + (tell (tell cv bottomAnchor) constraintEqualToAnchor: (tell win bottomAnchor) constant: #:type _CGFloat (- margin))) |
| 341 | + count: #:type _NSUInteger 4)) |
| 342 | + cv] |
| 343 | + [else #f])) |
| 344 | + |
322 | 345 | ;; Setting the window in one-shot mode helps prevent the |
323 | 346 | ;; frame from being resurrected by a click on the dock icon. |
324 | 347 | (tellv cocoa setOneShot: #:type _BOOL #t) |
325 | 348 |
|
| 349 | + (define/override (get-frame) |
| 350 | + (tell #:type _NSRect cocoa frame)) |
| 351 | + |
326 | 352 | (define/override (get-cocoa-content) |
327 | | - (tell cocoa contentView)) |
| 353 | + (or inner-content-view (tell cocoa contentView))) |
328 | 354 | (define/override (get-cocoa-window) cocoa) |
329 | 355 | (define/override (get-wx-window) this) |
330 | 356 |
|
|
0 commit comments