Ryujinx-GtkSharp/sample/Subclass.cs
Mike Kestner c9f1eadc11 2004-05-07 Mike Kestner <mkestner@ximian.com>
[Derived from a patch by Ben Maurer]
	* generator/Ctor.cs : generate code to detect subclassing and handle
	GType registration and native object creation properly.
	* generator/Parameters.cs : add PropertyName accessor for param attr.
	* generator/Property.cs : use a new GLib.Value ctor.
	* glib/ObjectManager.cs : redo hash access.
	* glib/Object.cs : CreateNativeObject method to invoke g_object_newv
	and some refactoring of RegisterGType and LookupGType.
	* glib/Value.cs : make gtype field an IntPtr.
	* glib/glue/object.c : glue for g_object_newv use.
	* glib/glue/value.c : new glue for value creation.
	* gtk/Dialog.custom : fix a ctor declaration for auto-reg.
	* gtk/Gtk.metadata : mark a couple property_name attrs as examples.
	* sample/Subclass.cs : use auto-GType-registration now.

svn path=/trunk/gtk-sharp/; revision=26916
2004-05-07 13:42:59 +00:00

42 lines
803 B
C#
Executable File

// Subclass.cs - Widget subclass Test
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2001-2003 Mike Kestner, Novell, Inc.
namespace GtkSamples {
using Gtk;
using System;
public class ButtonApp {
public static int Main (string[] args)
{
Application.Init ();
Window win = new Window ("Button Tester");
win.DeleteEvent += new DeleteEventHandler (Quit);
Button btn = new MyButton ();
win.Add (btn);
win.ShowAll ();
Application.Run ();
return 0;
}
static void Quit (object sender, DeleteEventArgs args)
{
Application.Quit();
}
}
public class MyButton : Gtk.Button {
public MyButton () : base ("I'm a subclassed button") {}
protected override void OnClicked ()
{
Console.WriteLine ("Button::Clicked default handler fired.");
}
}
}