2002-02-15 Mike Kestner <mkestner@speakeasy.net>

* 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.

svn path=/trunk/gtk-sharp/; revision=2426
This commit is contained in:
Mike Kestner 2002-02-15 11:15:11 +00:00
parent bd171184ed
commit 486c867726
4 changed files with 20 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2002-02-15 Mike Kestner <mkestner@speakeasy.net>
* 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 <mkestner@speakeasy.net> 2002-02-14 Mike Kestner <mkestner@speakeasy.net>
* generator/ObjectGen.cs : suppress generation of get/set methods when * generator/ObjectGen.cs : suppress generation of get/set methods when

View file

@ -131,12 +131,15 @@ namespace GtkSharp.Generation {
sw.WriteLine(); sw.WriteLine();
sw.WriteLine("\t\t\t" + sname + " inst = (" + sname + ") _Instances[key];"); sw.WriteLine("\t\t\t" + sname + " inst = (" + sname + ") _Instances[key];");
sw.WriteLine("\t\t\tSignalArgs args = new SignalArgs();"); 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++) { for (int idx=1; idx < parms.Count; idx++) {
if (table.IsObject((String)parms[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 + ");"); sw.WriteLine("= GLib.Object.GetObject(arg" + idx + ");");
} else { } 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);"); sw.WriteLine("\t\t\tinst._handler (inst._obj, args);");

View file

@ -15,14 +15,13 @@ namespace GtkSamples {
public static int Main (string[] args) public static int Main (string[] args)
{ {
Application.Init (ref args); Application.Init (ref args);
Window win = new Window ("Button Tester"); Window win = new Window (WindowType.Toplevel);
win.Deleted += new EventHandler (Window_Delete); win.Title = "Button Tester";
win.DeleteEvent += new EventHandler (Window_Delete);
Button btn = new Button (); Button btn = new Button ();
btn.Clicked += new EventHandler (btn_click); btn.Clicked += new EventHandler (btn_click);
btn.SizeRequest = new Size (32, 24); win.EmitAdd (btn);
btn.Show (); win.ShowAll ();
win.Add (btn);
win.Show ();
Application.Run (); Application.Run ();
return 0; return 0;
} }

View file

@ -1,4 +1,4 @@
// TestWindow.cs - GTK Window class Test implementation // HelloWorld.cs - GTK Window class Test implementation
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //
@ -17,20 +17,19 @@ namespace GtkSamples {
public static int Main (string[] args) public static int Main (string[] args)
{ {
Application.Init (ref args); Application.Init (ref args);
Console.WriteLine("Creating Window");
Gtk.Window win = new Gtk.Window (Gtk.WindowType.Toplevel); Gtk.Window win = new Gtk.Window (Gtk.WindowType.Toplevel);
Console.WriteLine("Setting Title");
win.Title = "Gtk# Hello World"; win.Title = "Gtk# Hello World";
win.DeleteEvent += new EventHandler (Window_Delete); win.DeleteEvent += new EventHandler (Window_Delete);
win.ShowAll (); win.ShowAll ();
Console.WriteLine("Entering event loop");
Application.Run (); Application.Run ();
return 0; return 0;
} }
static void Window_Delete (object obj, EventArgs args) static void Window_Delete (object obj, EventArgs args)
{ {
SignalArgs sa = (SignalArgs) args;
Application.Quit (); Application.Quit ();
sa.RetVal = true;
} }
} }