Re: Wrapping GooCanvas



On Sat, 2007-04-21 at 02:52 -0500, Paul Davis wrote:
> Hey,
> 
> I'm working on wrapping goocanvas and I'm having a few issues.
> 
> Issue #1:
> 
> I have no idea how to wrap this function:
> 
> (define-method get_items_at
>   (of-object "GooCanvasItem")
>   (c-name "goo_canvas_item_get_items_at")
>   (return-type "GList*")
>   (parameters
>     '("gdouble" "x")
>     '("gdouble" "y")
>     '("cairo_t*" "cr")
>     '("gboolean" "is_pointer_event")
>     '("gboolean" "parent_is_visible")
>     '("GList*" "found_items")
>   )
> )
> 
> Specifically, the GList as a parameter

return type.

>  is causing me problems. I can't
> figure out if I need to add a conversion macro thinger in
> tools/m4/convert_goocanvas.m4 or if I need to write a hand-coded
> method.

You should probably add a m4 conversion directly into the m4 file,
because they usually require specific ownership rules depending on the
function. Here is an example from gtk/src/action.hg:

#m4 _CONVERSION(`GSList*', `Glib::SListHandle<Widget*>', `$2($3, Glib::OWNERSHIP_NONE)')
#m4 _CONVERSION(`GSList*', `Glib::SListHandle<const Widget*>', `$2($3, Glib::OWNERSHIP_NONE)')

  _WRAP_METHOD(Glib::SListHandle<Widget*> get_proxies(), gtk_action_get_proxies)
  _WRAP_METHOD(Glib::SListHandle<const Widget*> get_proxies() const, gtk_action_get_proxies)


You need to be sure what type is in the GList->data. As usual, the
documentation for the C function is unclear about that and also unclear
about the ownership (should the list be freed? should its items be freed
too?). Really, you should file a goocanvas bug about that. C++ makes
this much clearer, when you've done the wrapping.

I guess this one is a GList* of GooCanvasItem* and I guess that the list
should be freed, but not the items (shallow ownership).

> 
> Issue #2:
> 
> I'm trying to wrap a struct with _CLASS_BOXEDTYPE_STATIC, and gmmproc
> appears to be having some sort of error.  Its not writing out any
> class definition in the generated .h file and its not giving any sort
> of error message when the translation happens.
> 
> Any help would be appreciated.

Check it in and ask me to take a look.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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