Wrapping GTK+

new topic     » topic index » view thread      » older message » newer message

Anyone have any clue how to go about wrapping the GTK+ library? I have a
number of questions:

[1. Is there a DLL for GTK+? ]

I know that Euphoria/Linux _can_ link to dynamic libraries - Graph and XLib,
for example. But is there a DLL for GTK+? If so, where is it, and how did
you figure it out?

In XLIB.H, the routines were declared as 'extern'; I don't see any such
animal in the GTK+ include files. How does the DLL know what routines are to
be exported?


[2. Prototype Syntax ]

 I've found the include files in /usr/include/gtk and /usr/include/gdk.
There are all sorts of declarations, such as:

    void gtk_list_undo_selection (GtkList *list);

I assume that these would have to be turned into something like:

    global constant
        gtk_list_undo_selection =
           define_c_proc(GTK,"gtk_list_undo_selection",{C_PTR})

Right? Wrong? I'm pretty sure I'm right, it's just that missing 'extern' has
me spooked.


[ 3. Enum ]

What value does 'enum' start numbering with? For example:

    /* cell types */
    typedef enum
    {
      GTK_CELL_EMPTY,
      GTK_CELL_TEXT,
      GTK_CELL_PIXMAP,
      GTK_CELL_PIXTEXT,
      GTK_CELL_WIDGET
    } GtkCellType;

Would the equivalent value of GTK_CELL_EMPTY be 0 or 1?


[ 4. Type declarations ]

In C, a typical declaration and assignment would be:

   GtkWidget *button;
   button = gtk_button_new_with_label ("I'm A Button!");

I assume that the equivalent in Euphoria would be something like this, with
no type casting needed:


   -- function prototype, for example's completeness
   constant gtk_list_undo_selection =
      define_c_func(GTK,"gtk_list_undo_selection",{C_PTR},C_PTR)

    -- no typecasting; they're just pointers
   atom szText, button

   -- convert to c string
   szText = allot_string("I'm A Button!")

   -- finally, the function call!
   button = c_func( gtk_button_new_with_label, {szText} )

   -- clean up local storage
   free( szText )

This looks good to me, but what do I know?

Thanks!

-- David Cuny

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu