]> gitweb.factorcode.org Git - factor.git/blob - basis/cocoa/cocoa-docs.factor
17621dc6348ac760190152ebda376e7d7e7131fb
[factor.git] / basis / cocoa / cocoa-docs.factor
1 USING: cocoa.messages help.markup help.syntax strings
2 alien core-foundation ;
3 IN: cocoa
4
5 HELP: ->
6 { $syntax "-> selector" }
7 { $values { "selector" "an Objective C method name" } }
8 { $description "A sugared form of the following:" }
9 { $code "\"selector\" send" } ;
10
11 HELP: SUPER->
12 { $syntax "-> selector" }
13 { $values { "selector" "an Objective C method name" } }
14 { $description "A sugared form of the following:" }
15 { $code "\"selector\" send-super" } ;
16
17 { send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words
18
19 HELP: IMPORT:
20 { $syntax "IMPORT: name" }
21 { $description "Makes an Objective C class available for use." } 
22 { $examples
23     { $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
24 } ;
25
26 ARTICLE: "objc-calling" "Calling Objective C code"
27 "Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed."
28 { $subsection POSTPONE: IMPORT: }
29 "Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
30 $nl
31 "Messages can be sent to classes and instances using a pair of parsing words:"
32 { $subsection POSTPONE: -> }
33 { $subsection POSTPONE: SUPER-> }
34 "These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:"
35 { $subsection send }
36 { $subsection super-send } ;
37
38 ARTICLE: "cocoa" "Cocoa bridge"
39 "The " { $vocab-link "cocoa" } " vocabulary implements a Factor-Cocoa bridge for Mac OS X (GNUstep is not supported)."
40 $nl
41 "The lowest layer uses the " { $link "alien" } " to define bindings for the various functions in Apple's Objective-C runtime. This is defined in the " { $vocab-link "cocoa.runtime" } " vocabulary."
42 $nl
43 "On top of this, a dynamic message send facility is built:"
44 { $subsection "objc-calling" }
45 { $subsection "objc-subclassing" }
46 "A utility library is built to faciliate the development of Cocoa applications in Factor:"
47 { $subsection "cocoa-application-utils" }
48 { $subsection "cocoa-dialogs" }
49 { $subsection "cocoa-pasteboard-utils" }
50 { $subsection "cocoa-view-utils" }
51 { $subsection "cocoa-window-utils" } ;
52
53 IN: cocoa
54 ABOUT: "cocoa"