Re: Wrapping GTK+

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

Pete Eberlein wrote:

>I narrowed it down to:
>
>? open_dll("libgtkxmhtml.so")
>? open_dll("libgtk.so")

Thanks Pete (and Greg). I fixed some obvious errors (routine names, arg
counts, etc.) and it runs! The code is included.

I would never have figured this thing out myself. If there was a dependancy,
I would have bet on GDK or GLIB. Perhaps I can narrow it down a bit,
although at this point it's not really an issue.

Now I need to figure out how the callbacks work. If I'm lucky, it'll be as
trivial as it looks - simply registering the callback with
gtk_signal_connect. I'll try to give Irv and GraphApp a run for their money.
Hopefully there are no horrible licensing restrictions associated with GTK.

[ Llama ]

In case people are wondering what the status of Llama is, I've got it up and
running under Win32 again after some fairly serious modifications to the
classes. But I'm having some doubts about the wisdom of the underlying
messaging system. I think that I can accomplish a similar effect using
inheritance by simpler (and faster) means.

The end result should still accomplish all the original goals - portable
code, extensible classes and emulated controls.

And, of course, I'll be paying close attention to see if I can wrap GTK with
Llama. At this point, it looks very good.

-- David Cuny

-- gtktest.exu

include dll.e
include machine.e

-- link dlls
atom gtkhtml, gtk
gtkhtml = open_dll("libgtkxmhtml.so")
gtk = open_dll("libgtk.so")

-- declare functions
constant
gtk_init = define_c_proc( gtk, "gtk_init", {C_POINTER, C_POINTER} ),
gtk_window_new = define_c_func( gtk, "gtk_window_new", {C_POINTER},
C_POINTER ),
gtk_window_set_title = define_c_proc( gtk, "gtk_window_set_title",
{C_POINTER, C_POINTER} ),
gtk_container_set_border_width = define_c_proc( gtk,
"gtk_container_set_border_width", {C_POINTER, C_LONG} ),
gtk_button_new_with_label = define_c_func( gtk, "gtk_button_new_with_label",
{C_POINTER}, C_POINTER ),
gtk_widget_show = define_c_proc( gtk, "gtk_widget_show", {C_POINTER} ),
gtk_container_add = define_c_proc( gtk, "gtk_container_add", {C_POINTER,
C_POINTER} ),
gtk_main = define_c_proc( gtk, "gtk_main", {} )
constant

GTK_WINDOW_TOPLEVEL = 1

-- main loop
atom window, button

-- initialization
c_proc( gtk_init, { 0, 0 } )

-- create the toplevel window
window = c_func( gtk_window_new, {GTK_WINDOW_TOPLEVEL} )

-- title
c_proc( gtk_window_set_title, {window, allocate_string("Push Button")})

-- border
c_proc( gtk_container_set_border_width, {window, 50} )

-- create a button
button = c_func( gtk_button_new_with_label, {allocate_string("Button")} )

-- show the button (but not visible yet)
c_proc( gtk_widget_show, {button} )

-- add the button to the window
c_proc( gtk_container_add, {window, button} )

-- add button to window
c_proc( gtk_widget_show, {window} )

-- main loop
c_proc( gtk_main, {} )
abort(0)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu