diff --git a/ChangeLog b/ChangeLog index ab2620d77..bf58de978 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-02-15 Mike Kestner + + * generator/SignalHandler.cs : Create the SignalArgs.Args array and fix + indexing into it. + * sample/ButtonApp.cs : A little cleanup. Not quite there yet. + * sample/HelloWorld.cs : Set up the RetVal in the delete handler. + 2002-02-14 Mike Kestner * generator/ObjectGen.cs : suppress generation of get/set methods when diff --git a/generator/SignalHandler.cs b/generator/SignalHandler.cs index 2e0f43fab..56c59f437 100644 --- a/generator/SignalHandler.cs +++ b/generator/SignalHandler.cs @@ -131,12 +131,15 @@ namespace GtkSharp.Generation { sw.WriteLine(); sw.WriteLine("\t\t\t" + sname + " inst = (" + sname + ") _Instances[key];"); sw.WriteLine("\t\t\tSignalArgs args = new SignalArgs();"); + if (parms.Count > 1) { + sw.WriteLine("\t\t\targs.Args = new object[" + (parms.Count-1) + "];"); + } for (int idx=1; idx < parms.Count; idx++) { if (table.IsObject((String)parms[idx])) { - sw.Write("\t\t\targs.Args[" + idx + "] "); + sw.Write("\t\t\targs.Args[" + (idx-1) + "] "); sw.WriteLine("= GLib.Object.GetObject(arg" + idx + ");"); } else { - sw.WriteLine("\t\t\targs.Args[" + idx + "] = arg" + idx + ";"); + sw.WriteLine("\t\t\targs.Args[" + (idx-1) + "] = arg" + idx + ";"); } } sw.WriteLine("\t\t\tinst._handler (inst._obj, args);"); diff --git a/sample/ButtonApp.cs b/sample/ButtonApp.cs index 37cbb2731..939968a91 100755 --- a/sample/ButtonApp.cs +++ b/sample/ButtonApp.cs @@ -15,14 +15,13 @@ namespace GtkSamples { public static int Main (string[] args) { Application.Init (ref args); - Window win = new Window ("Button Tester"); - win.Deleted += new EventHandler (Window_Delete); + Window win = new Window (WindowType.Toplevel); + win.Title = "Button Tester"; + win.DeleteEvent += new EventHandler (Window_Delete); Button btn = new Button (); btn.Clicked += new EventHandler (btn_click); - btn.SizeRequest = new Size (32, 24); - btn.Show (); - win.Add (btn); - win.Show (); + win.EmitAdd (btn); + win.ShowAll (); Application.Run (); return 0; } diff --git a/sample/HelloWorld.cs b/sample/HelloWorld.cs index 229479a63..ef6e5858a 100755 --- a/sample/HelloWorld.cs +++ b/sample/HelloWorld.cs @@ -1,4 +1,4 @@ -// TestWindow.cs - GTK Window class Test implementation +// HelloWorld.cs - GTK Window class Test implementation // // Author: Mike Kestner // @@ -17,20 +17,19 @@ namespace GtkSamples { public static int Main (string[] args) { Application.Init (ref args); - Console.WriteLine("Creating Window"); Gtk.Window win = new Gtk.Window (Gtk.WindowType.Toplevel); - Console.WriteLine("Setting Title"); win.Title = "Gtk# Hello World"; win.DeleteEvent += new EventHandler (Window_Delete); win.ShowAll (); - Console.WriteLine("Entering event loop"); Application.Run (); return 0; } static void Window_Delete (object obj, EventArgs args) { + SignalArgs sa = (SignalArgs) args; Application.Quit (); + sa.RetVal = true; } }