I am trying to implement a WebKit panel in Racket, and am running in to some
trouble with the windowing API. I cannot get resizing to work. In OS X it looks
like it is supposed to be enabled by default so I assume racket is changing it
so that it can do its layout algorithm. The problem is that If I want to hook
into this It looks like I need to get access to the platform specific racket
windowing API. Currently I can get access to the Objective C layer, but not to
the hidden racket layer. Maybe this is not the way I should approach this but
I'm hoping someone can help.
#lang racket
(require racket/gui/base ffi/unsafe/objc ffi/unsafe)
(require mred/private/wx/cocoa/types
(prefix-in c: mred/private/wx/cocoa/window))
(define webkit-lib (ffi-lib (format
"/System/Library/Frameworks/WebKit.framework/WebKit")))
(import-class WebView)
(import-class NSURLRequest)
(import-class NSURL)
(define web-view (tell (tell WebView alloc) initWithFrame: #:type _NSRect
(make-NSRect (make-NSPoint 0 0) (make-NSSize 300 300)) frameName: #f groupName:
#f))
(define frame (new frame% (label "test-frame") (width 300) (height 300)))
;(define racket-web-view (new c:window% (parent frame) (cocoa web-view)
(no-show? #f)))
;This problem is here the parent argument needs to be the platform specific
window and not the generic one
(define frame-view (send frame get-client-handle))
(tellv frame-view addSubview: web-view)
(define request (tell NSURLRequest requestWithURL: (tell NSURL URLWithString:
#:type _NSString "http://www.google.com")))
(tellv (tell web-view mainFrame) loadRequest: request)
(send frame show #t)
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/dev