This is the mail archive of the guile-gtk@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: implementing guile-gtk drag & drop...


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]