Paste: webkit demos (needs a few cocoa binding tweaks i haven't pushed yet)
Author: | slava |
Mode: | factor |
Date: | Thu, 2 Oct 2008 11:18:47 |
Plain Text |
USING: kernel
cocoa
cocoa.application
cocoa.standalone
cocoa.types
cocoa.classes
cocoa.windows ;
IN: webkit-demo
FRAMEWORK: /System/Library/Frameworks/WebKit.framework
IMPORT: WebView
: rect ( -- rect ) 0 0 700 500 <NSRect> ;
: <WebView> ( -- id )
WebView -> alloc rect f f -> initWithFrame:frameName:groupName: ;
: <WebWindow> ( -- id )
<WebView> rect <ViewWindow> ;
: activate ( window -- )
[ f -> orderFront: ] [ -> makeKeyWindow ] bi ;
: load-url ( window url -- )
[ -> contentView ] [ <NSString> ] bi* -> setMainFrameURL: ;
: webkit-demo ( -- )
<WebWindow>
[ -> center ] [ activate ] [ "http://factorcode.org" load-url ] tri ;
: run-webkit-demo ( -- )
[ webkit-demo ] cocoa-app ;
MAIN: run-webkit-demo
New Annotation