summary refs log tree commit diff stats
path: root/examples/gtk/ex5.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2010-02-28 23:04:18 +0100
committerAndreas Rumpf <rumpf_a@web.de>2010-02-28 23:04:18 +0100
commitb559285b78bfa76533d25e77f3f61cab2427bb03 (patch)
treef418f489f307f825a934cea878921f65c0114561 /examples/gtk/ex5.nim
parentddb718548278290a1c25c1bbfba82bc5581457a7 (diff)
downloadNim-b559285b78bfa76533d25e77f3f61cab2427bb03.tar.gz
examples/lib use the new wrappers
Diffstat (limited to 'examples/gtk/ex5.nim')
-rwxr-xr-xexamples/gtk/ex5.nim36
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/gtk/ex5.nim b/examples/gtk/ex5.nim
index 3a5b076c6..29d80626e 100755
--- a/examples/gtk/ex5.nim
+++ b/examples/gtk/ex5.nim
@@ -2,23 +2,23 @@
 import 
   glib2, gtk2
 
-proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} = 
-  gtk_main_quit()
+proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = 
+  main_quit()
 
-var 
-  window: PGtkWidget
-  button: PGtkWidget
+proc widgetDestroy(w: PWidget) {.cdecl.} = 
+  destroy(w)
+
+nimrod_init()
+var window = window_new(WINDOW_TOPLEVEL)
+var button = button_new_with_label("Click me")
+set_border_width(Window, 5)
+add(window, button)
+discard signal_connect(window, "destroy", 
+                       SIGNAL_FUNC(ex5.destroy), nil)
+discard signal_connect_object(button, "clicked", 
+                              SIGNAL_FUNC(widgetDestroy), 
+                              window)
+show(button)
+show(window)
+main()
 
-gtk_nimrod_init()
-window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
-button = gtk_button_new_with_label("Click me")
-gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
-gtk_container_add(GTK_Container(window), button)
-discard gtk_signal_connect(GTKOBJECT(window), "destroy", 
-                           GTK_SIGNAL_FUNC(destroy), nil)
-discard gtk_signal_connect_object(GTKOBJECT(button), "clicked", 
-                                  GTK_SIGNAL_FUNC(gtk_widget_destroy), 
-                                  GTKOBJECT(window))
-gtk_widget_show(button)
-gtk_widget_show(window)
-gtk_main()