2017-05-30 13:09:02 -04:00
|
|
|
! Copyright (C) 2017 Doug Coleman.
|
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2018-01-01 18:01:04 -05:00
|
|
|
USING: alien.c-types cocoa cocoa.classes cocoa.messages
|
|
|
|
|
cocoa.runtime combinators core-foundation.strings kernel locals
|
|
|
|
|
;
|
2017-05-30 13:09:02 -04:00
|
|
|
IN: cocoa.touchbar
|
|
|
|
|
|
2018-01-01 18:01:04 -05:00
|
|
|
: make-touchbar ( seq self -- touchbar )
|
2018-01-27 11:38:35 -05:00
|
|
|
[ NSTouchBar send: alloc send: init dup ] dip send: setDelegate: {
|
2018-02-10 12:18:18 -05:00
|
|
|
[ swap <CFStringArray> send: \setDefaultItemIdentifiers: ]
|
|
|
|
|
[ swap <CFStringArray> send: \setCustomizationAllowedItemIdentifiers: ]
|
2017-05-30 13:09:02 -04:00
|
|
|
[ nip ]
|
|
|
|
|
} 2cleave ;
|
|
|
|
|
|
|
|
|
|
:: make-NSTouchBar-button ( self identifier label-string action-string -- button )
|
2018-01-27 11:38:35 -05:00
|
|
|
NSCustomTouchBarItem send: alloc
|
2018-02-10 12:18:18 -05:00
|
|
|
identifier <CFString> send: \initWithIdentifier: :> item
|
2017-05-30 13:09:02 -04:00
|
|
|
NSButton
|
|
|
|
|
label-string <CFString>
|
|
|
|
|
self
|
2018-02-10 12:18:18 -05:00
|
|
|
action-string lookup-selector send: \buttonWithTitle:target:action: :> button
|
|
|
|
|
item button send: \setView:
|
2017-06-01 14:46:32 -04:00
|
|
|
item ;
|