diff --git a/collects/mred/private/wx/cocoa/button.rkt b/collects/mred/private/wx/cocoa/button.rkt index b58f18e3..48e97919 100644 --- a/collects/mred/private/wx/cocoa/button.rkt +++ b/collects/mred/private/wx/cocoa/button.rkt @@ -23,6 +23,9 @@ (define MIN-BUTTON-WIDTH 72) (define BUTTON-EXTRA-WIDTH 12) +(define NSSmallControlSize 1) +(define NSMiniControlSize 2) + (define-objc-class MyButton NSButton #:mixins (FocusResponder KeyMouseResponder CursorDisplayer) [wxb] @@ -61,6 +64,14 @@ (tellv cocoa sizeToFit) (when (and (eq? event-type 'button) (string? label)) + (when font + (let ([n (send font get-point-size)]) + (when (n . < . sys-font-size) + (tellv (tell cocoa cell) + setControlSize: #:type _int + (if (n . < . (- sys-font-size 2)) + NSMiniControlSize + NSSmallControlSize))))) (let ([frame (tell #:type _NSRect cocoa frame)]) (tellv cocoa setFrame: #:type _NSRect (make-NSRect (NSRect-origin frame) diff --git a/collects/mred/private/wx/cocoa/frame.rkt b/collects/mred/private/wx/cocoa/frame.rkt index 8d585a77..7779a020 100644 --- a/collects/mred/private/wx/cocoa/frame.rkt +++ b/collects/mred/private/wx/cocoa/frame.rkt @@ -244,12 +244,12 @@ (not (send p get-sheet))))) (let ([p (get-parent)]) (send p set-sheet this) - (tell (tell NSApplication sharedApplication) - beginSheet: cocoa - modalForWindow: (send p get-cocoa) - modalDelegate: #f - didEndSelector: #:type _SEL #f - contextInfo: #f)) + (tellv (tell NSApplication sharedApplication) + beginSheet: cocoa + modalForWindow: (send p get-cocoa) + modalDelegate: #f + didEndSelector: #:type _SEL #f + contextInfo: #f)) (tellv cocoa makeKeyAndOrderFront: #f)) (begin (when is-a-dialog? diff --git a/collects/mred/private/wx/cocoa/item.rkt b/collects/mred/private/wx/cocoa/item.rkt index 674da458..e04a3751 100644 --- a/collects/mred/private/wx/cocoa/item.rkt +++ b/collects/mred/private/wx/cocoa/item.rkt @@ -3,6 +3,7 @@ ffi/unsafe ffi/unsafe/objc "../../syntax.rkt" + "../../lock.rkt" "window.rkt" "const.rkt" "types.rkt" @@ -10,11 +11,17 @@ (provide (protect-out item% - install-control-font)) + install-control-font + sys-font-size)) (import-class NSFont) -(define sys-font (tell NSFont - systemFontOfSize: #:type _CGFloat 13)) + +(define sys-font-size 13) +(define sys-font + (atomically + (let ([f (tell NSFont systemFontOfSize: #:type _CGFloat sys-font-size)]) + (tellv f retain) + f))) (define (install-control-font cocoa font) (if font