This is the mail archive of the
guile-gtk@sources.redhat.com
mailing list for the Guile project.
Re: implementing guile-gtk drag & drop...
- From: Marius Vollmer <mvo at zagadka dot ping dot de>
- To: Stanislas Pinte <alto_stan at wanadoo dot be>
- Cc: guile-gtk <guile-gtk at sources dot redhat dot com>, David Pirotte <david at altosw dot be>
- Date: 03 Nov 2002 16:04:04 +0100
- Subject: Re: implementing guile-gtk drag & drop...
- References: <3DC279A4.1010000@wanadoo.be>
Stanislas Pinte <alto_stan@wanadoo.be> writes:
> -I need to define new strucs, used by GTK: GtkTargetEntry; for example.
>
> How do I define a new struct? define-struct is not that
> documented, and I suppose I will have to play with C (I looked at the
> GTimer struct, define in gdk-1.2-defs), to define creator and
> destructor functions,
Hmm, that's a difficult thing, in general. I'd say that you should
probably first decide how you would like the function to appear in
Scheme. I.e., what would be convenient to use, in contrast to what is
currently easily done with guile-gtk.
Then, try to write a wrapper function by hand (based on examples from
gtk-glue.c, for example), and then we can discuss whether it is useful
to extend build-guile-gtk to make writing your wrapper function
easier.
For example, since GtkTargetEntry seems only to be used as a read-only
struct when passing parameters to gtk_drag_source_set, it might be
best to use a list in Scheme:
(gtk-drag-source-set widget '(button1-mask) '((foo (same-app)))
'(default))
We could then write a function to fill a GtkTargetEntry struct from
'(foo (same-app)) and tell build-guile-gtk to use it. (I don't know
the details right now.) The .defs file entry might then look like
(define-func gtk_drag_source_set
none
((GtkWidget widget)
(GdkModifierType start_button_mask)
((cvecr GtkTargetEntry) targets)
(GdkDragAction actions)))
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405