examples/lib use the new wrappers

This commit is contained in:
Andreas Rumpf 2010-02-28 23:04:18 +01:00
commit b559285b78
133 changed files with 17038 additions and 151734 deletions

View file

@ -2,30 +2,28 @@
import
glib2, gtk2
proc newbutton(ALabel: cstring): PGtkWidget =
Result = gtk_button_new_with_label(ALabel)
gtk_widget_show(result)
proc newbutton(ALabel: cstring): PWidget =
Result = button_new_with_label(ALabel)
show(result)
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
var
window, maintable: PgtkWidget
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var Maintable = table_new(6, 6, True)
proc AddToTable(Widget: PGtkWidget, Left, Right, Top, Bottom: guint) =
gtk_table_attach_defaults(GTK_TABLE(MainTable), Widget, Left, right, top,
bottom)
proc AddToTable(Widget: PWidget, Left, Right, Top, Bottom: guint) =
attach_defaults(MainTable, Widget, Left, right, top, bottom)
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
Maintable = gtk_table_new(6, 6, True)
gtk_widget_show(MainTable)
show(MainTable)
AddToTable(newbutton("1,1 At 1,1"), 1, 2, 1, 2)
AddToTable(newbutton("2,2 At 3,1"), 3, 5, 1, 3)
AddToTable(newbutton("4,1 At 4,1"), 1, 5, 4, 5) # Put all in window
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), maintable)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
gtk_widget_show(window)
gtk_main()
set_border_width(Window, 5)
add(window, maintable)
discard signal_connect(window, "destroy",
SignalFunc(ex4.destroy), nil)
show(window)
main()