     selector>action at
     [ swap world-focus parents-handle-gesture? t ] [ drop f f ] if* ;
 
+: touchbar-commands ( -- commands/f gadget )
+    world get [
+        children>> [
+            class-of "commands" word-prop
+            "touchbar" of dup [ commands>> ] when
+        ] map-find
+    ] [ f f ] if* ;
+
+: touchbar-invoke-command ( n -- )
+    [ touchbar-commands ] dip over
+    [ rot nth second invoke-command ] [ 3drop ] if ;
+
 <CLASS: FactorView < NSOpenGLView
     COCOA-PROTOCOL: NSTextInput
 

            ] [ drop ] if

        ] when
    ] ;

    ! Rendering

! Copyright (C) 2006, 2010 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.data alien.strings
arrays assocs classes cocoa cocoa.application cocoa.classes
cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.touchbar
cocoa.types cocoa.views combinators core-foundation.strings
core-graphics core-graphics.types core-text io.encodings.utf8
kernel literals locals math math.order math.parser
math.rectangles namespaces opengl sequences splitting threads
ui.commands ui.gadgets ui.gadgets.private ui.gadgets.worlds
ui.gestures ui.private words ;
IN: ui.backend.cocoa.views

: send-mouse-moved ( view event -- )
