Ryujinx-GtkSharp/sample/Subclass.cs
Mike Kestner ff263164e3 2003-12-15 Mike Kestner <mkestner@ximian.com>
* generator/BoxedGen.cs : s/uint/GLib.GType
	* generator/ManualGen.cs : add a ctor to pass ToNative handle name
	* generator/ObjectGen.cs : s/uint/GLib.GType
	* generator/Signal.cs : use GLib.GType and call OverrideVirtualMethod
	* generator/SymbolTable.cs : make GType a ManualGen and update a few
	ManualGens to the new signatures.
	* glib/DefaultSignalHandler.cs : s/Type/System.Type
	* glib/ManagedValue.cs : s/uint/GLib.GType
	* glib/Object.cs : s/uint/GLib.GType, add OverrideVirtualMethod.
	* glib/Type.cs : s/uint/IntPtr, add static fields for fundamentals.
	make it a value type and add ==, !=, Equals, and GetHashCode.
	* glib/TypeConverter.cs : use new GType statics, not fundamentals.
	* glib/Value.cs : use new GType statics, not fundamentals.
	* gnome/*.custom : s/uint/GLib.GType
	* gtk/*Store.custom : use GType statics, not fundamentals.
	* sample/Subclass.cs : s/uint/GLib.GType.

svn path=/trunk/gtk-sharp/; revision=21181
2003-12-15 16:59:25 +00:00

59 lines
1.2 KiB
C#
Executable File

// Subclass.cs - Widget subclass Test implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001-2002 Mike Kestner
namespace GtkSamples {
using Gtk;
using GtkSharp;
using System;
using System.Drawing;
public class ButtonApp {
public static int Main (string[] args)
{
Application.Init ();
Window win = new Window ("Button Tester");
win.DefaultSize = new Size (200, 150);
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
Button btn = new MyButton ();
btn.Label = "I'm a subclassed button";
btn.Clicked += new EventHandler (btn_click);
win.Add (btn);
win.ShowAll ();
Application.Run ();
return 0;
}
static void btn_click (object obj, EventArgs args)
{
Console.WriteLine ("Button Clicked");
}
static void Window_Delete (object obj, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}
}
public class MyButton : Gtk.Button {
static GLib.GType gtype = GLib.GType.Invalid;
public MyButton () : base (GType) {}
public static new GLib.GType GType {
get {
if (gtype == GLib.GType.Invalid)
gtype = RegisterGType (typeof (MyButton));
return gtype;
}
}
}
}