]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/cocoa/touchbar/touchbar.factor
factor: trim using lists
[factor.git] / basis / cocoa / touchbar / touchbar.factor
index a5d5be299d300f69f5b23fc3b5c64b789e876b2b..701c0dc6acbadd86c1caf4c0038bd9bb9470a8f5 100644 (file)
@@ -1,31 +1,22 @@
 ! Copyright (C) 2017 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.enums alien.syntax cocoa cocoa.classes
-cocoa.messages combinators core-foundation.strings kernel locals
-namespaces sequences words ;
+USING: alien.c-types cocoa cocoa.classes cocoa.messages
+cocoa.runtime combinators core-foundation.strings kernel ;
 IN: cocoa.touchbar
 
-! ui.backend.cocoa.views creates buttons for each of these actions
-ENUM: default-touchbar refresh-all-action auto-use-action ;
-
-: enum>CFStringArray ( seq -- alien )
-    enum>keys
-    NSArray -> alloc
-        swap <CFStringArray> -> initWithArray: ;
-
-: make-touchbar ( enum self -- touchbar )
+: make-touchbar ( seq self -- touchbar )
     [ NSTouchBar -> alloc -> init dup ] dip -> setDelegate: {
-        [ swap enum>CFStringArray -> setDefaultItemIdentifiers: ]
-        [ swap enum>CFStringArray -> setCustomizationAllowedItemIdentifiers: ]
+        [ swap <CFStringArray> { void { id SEL id } } ?-> setDefaultItemIdentifiers: ]
+        [ swap <CFStringArray> { void { id SEL id } } ?-> setCustomizationAllowedItemIdentifiers: ]
         [ nip ]
     } 2cleave ;
 
 :: make-NSTouchBar-button ( self identifier label-string action-string -- button )
     NSCustomTouchBarItem -> alloc
-        identifier <CFString> -> initWithIdentifier: :> item
+        identifier <CFString> { id { id SEL id } } ?-> initWithIdentifier: :> item
         NSButton
             label-string <CFString>
             self
-            action-string lookup-selector -> buttonWithTitle:target:action: :> button
+            action-string lookup-selector { id { id SEL id id SEL } } ?-> buttonWithTitle:target:action: :> button
         item button -> setView:
-        item ;
\ No newline at end of file
+        item ;