 ! Copyright (C) 2006, 2008 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types arrays assocs cocoa kernel math
-cocoa.messages cocoa.subclassing cocoa.classes cocoa.views
-cocoa.application cocoa.pasteboard cocoa.types cocoa.windows sequences
-ui ui.private ui.gadgets ui.gadgets.private ui.gadgets.worlds
-ui.gestures core-foundation.strings core-graphics core-graphics.types
-threads combinators math.rectangles ;
+USING: accessors alien alien.c-types alien.strings arrays assocs
+cocoa kernel math cocoa.messages cocoa.subclassing cocoa.classes
+cocoa.views cocoa.application cocoa.pasteboard cocoa.types
+cocoa.windows sequences io.encodings.ascii ui ui.private ui.gadgets
+ui.gadgets.private ui.gadgets.worlds ui.gestures
+core-foundation.strings core-graphics core-graphics.types threads
+combinators math.rectangles ;
 IN: ui.backend.cocoa.views
 
 : send-mouse-moved ( view event -- )

    [ drop dim>> first2 ]
    2bi <CGRect> ;

CLASS: {
    { +superclass+ "NSOpenGLView" }
    { +name+ "FactorView" }


{ "keyUp:" "void" { "id" "SEL" "id" }
    [ nip send-key-up-event ]
}

{ "validateUserInterfaceItem:" "char" { "id" "SEL" "id" }
    [
        nip -> action
        2dup [ window ] [ ascii alien>string ] bi* validate-action
        [ [ 2drop ] dip >c-bool ] [ SUPER-> validateUserInterfaceItem: ] if
    ]
}

{ "undo:" "id" { "id" "SEL" "id" }
