factor/core/cocoa/handbook.facts

98 lines
3.8 KiB
Plaintext
Raw Normal View History

USING: help cocoa objc ;
ARTICLE: "cocoa" "Cocoa bridge"
"Factor includes a simple but complete Objective C interface for calling the Cocoa API on Mac OS X. Objective C interface words are found in the " { $vocab-link "objc" } " vocabulary."
{ $subsection "objc-calling" }
{ $subsection "objc-subclassing" }
"In addition to providing a direct binding, Factor also supplies some utility words which take care of some common boilerplate which comes up when working with Cocoa. Cocoa utility words are found in the " { $vocab-link "cocoa" } " vocabulary."
{ $subsection "core-foundation" }
{ $subsection "cocoa-types" }
{ $subsection "cocoa-application-utils" }
{ $subsection "cocoa-dialogs" }
{ $subsection "cocoa-pasteboard-utils" }
{ $subsection "cocoa-view-utils" }
{ $subsection "cocoa-window-utils" }
;
ARTICLE: "objc-calling" "Calling Objective C code"
"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."
{ $subsection import-objc-class }
"Every imported Objective C class has as corresponding class word in the " { $vocab-link "objc-classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
$nl
"Messages can be sent to classes and instances using a pair of parsing words:"
{ $subsection POSTPONE: -> }
{ $subsection POSTPONE: SUPER-> }
"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:"
{ $subsection send }
{ $subsection super-send } ;
ARTICLE: "objc-subclassing" "Subclassing Objective C classes"
"Objective C classes can be subclassed, with new methods defined in Factor, using a parsing word:"
{ $subsection POSTPONE: CLASS: }
"This word is actually syntax sugar for an ordinary word:"
{ $subsection define-objc-class }
"Objective C class definitions are saved in the image. If the image is saved and Factor is restarted with the saved image, custom class definitions are made available to the Objective C runtime when they are first accessed from within Factor." ;
ARTICLE: "core-foundation" "Core foundation utilities"
"The " { $vocab-link "cocoa" } " vocabulary defines bindings for some frequently-used Core Foundation functions. It also provides some utility words."
$nl
"Strings:"
{ $subsection <CFString> }
{ $subsection <NSString> }
{ $subsection CF>string }
"Arrays:"
{ $subsection <CFArray> }
{ $subsection <NSArray> }
{ $subsection CF>array }
{ $subsection CF>string-array }
"URLs:"
{ $subsection <CFFileSystemURL> }
{ $subsection <CFURL> }
"Frameworks:"
{ $subsection load-framework } ;
ARTICLE: "cocoa-types" "Cocoa types"
"The Cocoa binding defines some common C structs:"
{ $code
"NSRect"
"NSPoint"
"NSSize"
}
"Some words for working with the above:"
{ $subsection <NSRect> }
{ $subsection <NSPoint> }
{ $subsection <NSSize> } ;
ARTICLE: "cocoa-application-utils" "Cocoa application utilities"
{ $subsection NSApp }
{ $subsection with-autorelease-pool }
{ $subsection with-cocoa }
{ $subsection do-events }
{ $subsection add-observer }
{ $subsection remove-observer }
{ $subsection load-nib }
{ $subsection install-delegate } ;
ARTICLE: "cocoa-dialogs" "Cocoa file dialogs"
"Open dialogs:"
{ $subsection <NSOpenPanel> }
{ $subsection open-panel }
"Save dialogs:"
{ $subsection <NSSavePanel> }
{ $subsection save-panel } ;
ARTICLE: "cocoa-pasteboard-utils" "Cocoa pasteboard utilities"
{ $subsection pasteboard-string? }
{ $subsection pasteboard-string }
{ $subsection set-pasteboard-string } ;
ARTICLE: "cocoa-view-utils" "Cocoa view utilities"
{ $subsection <PixelFormat> }
{ $subsection <GLView> }
{ $subsection view-dim }
{ $subsection mouse-location } ;
ARTICLE: "cocoa-window-utils" "Cocoa window utilities"
{ $subsection <NSWindow> }
{ $subsection <ViewWindow> } ;