File lib/glade.lua
Read and interpret Glade-2/3 XML files and create the widgets. It constructs widgets automatically, and autoconnects the signals. NOTE. Starting with Gtk 2.12, you can alternatively use the GtkBuilder class, which is built-in into Gtk. Interface functions: read(filename) Read the Glade XML file, parse and return the parse tree. create(tree, widgetname) Use the parse tree to find the given widget, then create it and all child widgets. Returns a table with all the created widgets. EXAMPLE require "gtk" require "gtk.glade"
Functions
create (tree, path) | Attempt to create a widget tree. |
glade_line (stack, line) | Parse one line of the glade file |
print_r (obj, prefix) | Debugging: recursively print a structure |
read (fname) | Parse a Glade XML file; return the resulting tree. |
Functions
- create (tree, path)
-
Attempt to create a widget tree. Use the parse tree to find the given widget, then create it and all child widgets.
Parameters
- tree: The widget tree as returned from read.
- path: Name of the top widget, typically "window1" or similar.
Return value:
A table with all the widgets; key=name, value=widget. - glade_line (stack, line)
-
Parse one line of the glade file
Parameters
- stack:
- line:
- print_r (obj, prefix)
-
Debugging: recursively print a structure
Parameters
- obj:
- prefix:
- read (fname)
-
Parse a Glade XML file; return the resulting tree. This is based on Roberto Ierusalimschy's XML parser as found on http://lua-users.org/wiki/LuaXml.
Types of XML elements: glade-interface top level wrapper widget widget with class, id property some property with name and value child wrapper for widget + packing packing sets the packing optionsParameters
- fname: