From: Laurent Julliard Date: 2002-01-24T02:45:59+09:00 Subject: Re: RANT: Ruby GUI API (more about SWT) Chris Thomas wrote: > On 1/21/02 10:08 AM, "MENON Jean-Francois" > wrote: > > >>2) The better thing I would like for Ruby, is to have its own GUI, >>developped in Ruby, based on a low-level graphic library, like JAVA2 >>did. So you need only to distribute a low-level C lib adapted for each >>system. >> > > The problem with this approach is that your applications don't look like > native applications on each platform, and there's no way to make them behave > exactly like native applications, even assuming you are willing to do the > work. A Java Swing app can look a lot like a real Mac OS X application, but > it will never feel like one. > > I would rather see something like SWT, which is what the Java AWT (Awful > Window Toolkit) should have been: > > >>SWT is the software component that delivers native widget functionality for >>the Eclipse platform in an operating system independent manner. It is >>analogous to AWT/Swing in Java with a difference - SWT uses native widgets. >>This article is the first in series of articles that discuss the SWT widget >>toolkit. This article discusses the low level implementation techniques used >>to implement SWT on different platforms. Examples are drawn from the windows >>and Motif implementations. >> > > http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html > > I am not convinced that SWT's design is proven WRT cross-platform viability > (I don't think Motif and Win32 are different enough to constitute such > proof), but I do think this approach can work. It would have the benefit of > giving us a pure Ruby framework while preserving the underlying feel of the > platform. > > Chris A couple of remarks/facts about SWT: Look-and-feel ------------- I have been playing with SWT a bit and I must say that I'm really impressed by how well it exploits the underlying native widgets. The look and feel is really very close to the native GUI whatever underlying toolkit you use. Speed ------ On my low-end PII 400 Mhz laptop SWT reponse time is good (no annoying latency at all, but blindingly fast like FOX or FLTK either). It would probably be faster if the high level widgets were not written in Java but... Ruby :-) Ruby/SWT -------- I had a look at the SWT source code. And just in case some Ruby people were thinking of porting SWT to Ruby (actually rewritting is a more suited term) here are a couple of facts and figures. SWT is written in C (for low level mapping with the underlying native toolkit) and all Java for the rest (. SWT is about 130 000 lines of code (without comments) : 100 000 for Java and 30 000 lines of C code. Now this is for all of SWT which means with the code to run on top of Win32, Motif, GTK and Photon/QNX. Assuming that we the Ruby community are mostly interested by the Win32 and GTK parts this is still 50 000 lines of Java code to rewrite in Ruby. Not exactly what you'd call a toy project... This was just to get the conversation going. But this time you have some facts and figures to grin. Laurent