]> gitweb.factorcode.org Git - factor.git/blob - contrib/cocoa-callbacks.factor
Interface builder menu bar not works
[factor.git] / contrib / cocoa-callbacks.factor
1 ! Copyright (C) 2005, 2006 Kevin Reid.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: objc-classes
4 DEFER: FactorCallback
5
6 IN: cocoa-callbacks
7 USING: gadgets hashtables kernel namespaces objc cocoa ;
8
9 SYMBOL: callbacks
10
11 : reset-callbacks ( -- )
12     H{ } clone callbacks set-global ;
13
14 reset-callbacks
15
16 "NSObject" "FactorCallback" {
17     { "perform:" "void" { "id" "SEL" "id" }
18         [ 2drop callbacks get hash ui-try ]
19     }
20     
21     { "dealloc" "void" { "id" "SEL" }
22         [
23             drop
24             dup callbacks get remove-hash
25             SUPER-> dealloc
26         ]
27     }
28 } define-objc-class
29
30 : <FactorCallback> ( quot -- id )
31     FactorCallback -> alloc -> init
32     [ callbacks get set-hash ] keep ;
33
34 PROVIDE: callbacks ;