lua-users home
lua-l archive

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



2 layers is a must :) but how about three, or more?

The first one (in C) is a plain C/Lua API (doing some table stuff etc. but mostly following the C API). This is just a lot of work, and rather unusable (or, you could be coding in C just the same..)

The second one (in Lua) is an object oriented one, tying the bits and pieces together into a more realistic framework. This is probably "how the GTK+ object system was meant to be" kind-of level.

The third one (and on..) will be helper functions for this and that, such as gathering menus and box layouts by simple tables, instead of doing them part by part.

Some examples:

  C:
    label = gtk_label_new( "Enter a message:" );
    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
    entry = gtk_entry_new ();
    gtk_entry_set_text (GTK_ENTRY (entry), "");
    gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
    gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);

  Lua (not much different):

    label= gtk.label_new "Enter a message:"
    hbox:box_pack_start( label, false, false, 0 )
    entry= gtk.entry_new()
    entry.text= ""      -- or: entry:set_text("")
    entry:editable_select_region( 0, -1 )
    hbox:box_pack_start( entry, false, false, 0 )

  Lua (much different):

    entry= gtk.entry_new{ text="" }
    entry:editable_select_region( 0, -1 )

vbox= gtk.vbox_new{ { "Enter a message:", entry }, -- 1st row (no need for label, nor hbox_new) "--", -- separator (no need for separate separator)
                        button }            -- 3rd row


p.s. Make IUP for OS X and I'll be interested. ;P


15.2.2005 kello 21:48, Herbert Leuwer kirjoitti:

I can only agree to Diego: 2 layers. However, since I'm currently working with IUP, which has an almost ideal level of abstraction for a rapid GUI development and for applications, where the GUI itself is not the main selling message, I would like to
see IUP as the higher abstraction layer.

Herbert