Re: gdlmm



> Hello all,
>
> The task of wrapping gdl turns out to be rather frustrating :-/ mostly
> due to the lack of understandable documentation. Currently i have the
> following problems;
>
> - How to wrap a simpel C structure, for example ;
> struct _GdlDockRequest {
>     GdlDockObject    *applicant;
>     GdlDockObject    *target;
>     GdlDockPlacement  position;
>     GdkRectangle      rect;
>     GValue            extra;
> };
>
> I tried several of the _CLASS_* macros but they all seem to fail one way
> or another, in the documentation it doesn't not mention what the
> arguments to the macros should be. Trying to copy the Gdk::Rectangle
> source code didn't work.

That would be a good example to use. What problem did you have exactly? If
you can put the code online somewhere (ideally in cvs) then people can
help more precisely.

> - How to wrap a enum like the following ;
> /* data types & structures */
> typedef enum {
>     /* the parameter is to be exported for later layout rebuilding */
>     GDL_DOCK_PARAM_EXPORT = 1 << G_PARAM_USER_SHIFT,
>     /* the parameter must be set after adding the children objects */
>     GDL_DOCK_PARAM_AFTER  = 1 << (G_PARAM_USER_SHIFT + 1)
> } GdlDockParamFlags;
>
> The generated .defs file by enum.pl (which I found after a long search
> in gnome CVS http://cvs.gnome.org/viewcvs/gtkmm-root/tools/ ) doesn'T
> like the  G_PARAM_USER_SHIFT part, i had to replace them by hand with 8
> and 9 (the resuld ot the G_PARAM_USER_SHIFT + 0 and G_PARAM_USER_SHIFT +
> 1)

Is G_PARAM_USER_SHIFT used anywhere else in glib or gtk? Maybe you can
find an example of how we've done that elsewhere.

> - How to setup convert_gdlmm.m4 so that i can use Glib::RefPtr<> return
> values.

Just create a _CONVERSION() that has the Glib::RefPtr<Soemethign> as the
second parameter.

> - Do the .defs files have to be hand edited, or should the result of the
> scripts like enum.pl be final ? I had to edit them because things like
> () in comments cause errors.

They usually do not need to be edited, but if you are one of the first to
wrap a library then it's headers are sometimes not perfect. But a little
editing is OK, and not something to worry about.

> Even though things are going slow and painful the test-dock example is
> converted to C++ and works

Well done.

> (with a small crash at the end due to some
> memory management problems). Of course the fact that the gdl api is
> without one a single comment doesn't really help :-/
>
> For the C++ API i have some style questions, are reference arguments
> preferred to pointer arguments ?

Yes. But check whether the C API allows the pointer to be NULL, and what
that would mean. But that usually requires documentation for the C API. We
usually overload these methods.

> When functions return a pointer in C,
> what is the preferred return type for the C++ wrapper, and how to decide
> between pointer, reference and RefPtr<> ?

It depends on how the object should be managed. It's almost never reference.

> The GDL docking functionality looks very nice, are there plans to split
> it of and integrate it with GTK, or will it always be separated, cause
> docking is one of the things GTK really is missing at the moment.  GDL
> is nice but it has some rather random widgets like GdlComboButton too.

gtk-devel-list would know more about that. Maybe it's part of GTK+'s
"Project Ridley".


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]