Re: GtkImageView



On Wed, 2007-12-12 at 11:26 +0100, Jeffrey Ratcliffe wrote:

I assume that I have either got the map entry for GdkPixbufDrawOpts
wrong, or am missing something extra needed as it is a struct.

Yes, GdkPixbufDrawOpts is a raw struct (I think you need to #include
<gdkpixbufdrawcache.h> to get it, by the way).  It doesn't have an
associated GType, so putting it in the maps file won't work.

Unfortunately, there's no automatic way to convert raw structs to Perl
land.  In this case, I think the best option would be to represent
GdkPixbufDrawOpts as a hash reference with keys zoom, zoom_rect, etc.
For an example of this kind of thing, take a look at the way
GtkStockItem is handled in Gtk2/xs/GtkStock.xs.

Once you have the converter newSVGdkPixbufDrawOpts[1], you can take this
one step further by installing a custom typemap for GdkPixbufDrawOpts:
"GdkPixbufDrawOpts * T_GPERL_GENERIC_WRAPPER" in a typemap file
installed via ExtUtils::Depends->add_typemaps in Makefile.PL -- like
Gtk2 does for gtk.typemap, for example.  Then the prototype you
mentioned:

void
gtk_iimage_tool_paint_image (tool, opts, drawable)
        GtkIImageTool *         tool
        GdkPixbufDrawOpts *     opts
        GdkDrawable *           drawable

should just work.

-- 
Bye,
-Torsten

[1] SvGdkPixbufDrawOpts is only be necessary when you need to convert a
perl scalar to a GdkPixbufDrawOpts struct.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]