This is the mail archive of the
guile-gtk@sourceware.cygnus.com
mailing list for the Guile project.
Re: Access a GtkWidget in C from guile?
- To: Brett Viren <bviren at superk dot physics dot sunysb dot edu>
- Subject: Re: Access a GtkWidget in C from guile?
- From: Marius Vollmer <mvo at zagadka dot ping dot de>
- Date: 25 Jun 2000 00:43:46 +0200
- Cc: guile-gtk at sourceware dot cygnus dot com
- References: <14649.32585.297873.456090@bamboo.physics.sunysb.edu>
Brett Viren <bviren@superk.physics.sunysb.edu> writes:
> - Now comes the problem: In scheme I need to do something like:
>
> (use-modules (my app)
> (gnome gnome)
> (gtk gtk)
> (gtk gdk))
> ;; ...
>
> (let ((window (gtk-window-new 'toplevel))
> (mad (init-my-app-data some args)))
> (gtk-container-add window (give-me-a-canvas mad))
> ...)
>
> Where `(give-me-a-canvas mad)' needs to return a guile-ified version
> of my C-land GnomeCanvas.
The easiest would be to write a C function
#include <guile-gtk.h>
SCM
give_me_a_canvas (SCM scm_mad)
{
my_app_data *mad = GET_STRUCT_FROM_SMOB (scm_mad);
return sgtk_wrap_gtkobj (mad->canvas);
}
and export it to Scheme. Note `sgtk_wrap_gtkobj' which is probably
the interesting thing here.