]> gitweb.factorcode.org Git - factor.git/blob - basis/cocoa/callbacks/callbacks.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / cocoa / callbacks / callbacks.factor
1 ! Copyright (C) 2005, 2006 Kevin Reid.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs kernel namespaces cocoa cocoa.classes
4 cocoa.subclassing debugger ;
5 IN: cocoa.callbacks
6
7 SYMBOL: callbacks
8
9 : reset-callbacks ( -- )
10     H{ } clone callbacks set-global ;
11
12 reset-callbacks
13
14 CLASS: {
15     { +name+ "FactorCallback" }
16     { +superclass+ "NSObject" }
17 }
18
19 { "perform:" "void" { "id" "SEL" "id" }
20     [ 2drop callbacks get at try ]
21 }
22
23 { "dealloc" "void" { "id" "SEL" }
24     [
25         drop
26         dup callbacks get delete-at
27         SUPER-> dealloc
28     ]
29 } ;
30
31 : <FactorCallback> ( quot -- id )
32     FactorCallback -> alloc -> init
33     [ callbacks get set-at ] keep ;