Native GTK2 D Bindings

Artur Skawina art.08.09 at gmail.com
Sun Jan 22 13:54:03 PST 2012



                   Native GTK2 bindings for D.


"Native" for two reasons:

1. Uses the C API directly. No class wrappers and no function wrappers.
2. OO interface, giving a native D look and feel.


The code generated when using these bindings is identical to the
equivalent C version. Bit-for-bit, there is zero overhead. [1]


BINDINGS

The D modules in this package give access to:

 GLib-2.0
 GModule-2.0
 GObject-2.0
 Gio-2.0
 GdkPixbuf-2.0
 Pango-1.0
 Gdk-2.0
 Atk-1.0
 Gtk-2.0
 
There is also a minimal <cairo-1.0> stub, which only allows the GTK
stack to build, but isn't really usable.

[...more info in the README.txt file...]

---------------------------------------------------------------------------------

This is a *very* early release. Works for me (tm), but i've only tried the basic
functionality so far. I don't know how much time I'll be able to spend on this
in the next days and as it's already in a usable state. maybe somebody else
wants to play with it already. At this point i'm mostly interested in API
related thoughts -- i'd like to get it right *before* adding GTK3 support.

The code is available at http://repo.or.cz/w/girtod.git

The bindings are in the "gtk2" branch; the "master" branch has the tool used
to generate all the gtk2/*.d modules, some examples and a README.
 
Yes, there's even a section in there on "Why?" and the answer isn't NIH. :)


The gtk2 package (from the "gtk2" branch) can be used as-is, but if you'd like
to play with (re-)generating the bindings:

- The makefile is just an example of how to use the thing. It's GDC specific,
  x86 specific; the "configure" machinery still needs to be done. But it
  should be functional enough to rebuild the gtk2/*.d modules, with a few local
  tweaks. Which can then be moved and used in your application directly
  (place them in a "gtk2" subdirectory).
- See ./buildem for how to build the bindings.


artur


More information about the Digitalmars-d-announce mailing list