[racket] Adding a new native GUI component — is it possible?

From: Alexis King (lexi.lambda at gmail.com)
Date: Thu Dec 11 00:35:54 EST 2014

The Racket GUI system is nice, but as with almost any GUI system, sometimes I yearn for the simplicity of HTML rendering. CSS and JavaScript let properly-styled HTML be easily inserted into almost any application without anyone realizing it isn’t native, so long as it’s fast and seamless.

Basically, I want to try and create a wrapper for a Chromium web view <https://code.google.com/p/chromiumembedded/> to be able to add to a Racket GUI in the same way that I can add, say, a horizontal-panel%. However, even putting the logistics of the complications that would involve aside, the question becomes… is it even possible to implement a new native UI component without sticking it into the internals of MrEd?

Currently, all of the plumbing that handles the linkage of the GUI classes with their underlying native counterparts is tightly woven into the gui library itself. There’s no way for an external package to hook into that system and add something new, as far as I can tell. Ideally, I’d like to be able to write a native library for each platform to define a GTK widget, a Cocoa view, and a Windows… whatever they’re called in Windows. (I don’t do Windows development.) Then I’d be able to write my own plumbing to connect those native components with a Racket class that would provide the adequate abstractions.

I’m willing to work out those problems, but in order to do that, I do need to figure out a suitable method for actually adding a GUI component. I’d love for adding a web view to be as easy as typing (new web-view% [parent frame] [url "http://google.com"]) and have it just work.

Is this possible? Is it foreseeably possible? If not, what would be the best way to integrate such functionality so that it’s at least semi-composable with the existing libraries?

(As a note, rendering to a canvas% or something like that is most certainly out of the question. Chromium needs access to the window itself to get the hardware-accelerated performance necessary to actually make it feasible.)

Alexis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141210/7fa77333/attachment.html>

Posted on the users mailing list.