Ryujinx-GtkSharp/sample/Subclass.cs
Mike Kestner f774796311 2004-02-10 Mike Kestner <mkestner@ximian.com>
* gconf/GConf.PropertyEditors/PropertyEditorColorPicker.cs :
	nuke a GnomeSharp.
	* generator/Signal.cs : move eventhandlers and args into the
	base namespace instead of a *Sharp namespace.
	* sample/*.cs : nuke using *Sharp.

svn path=/trunk/gtk-sharp/; revision=22956
2004-02-10 20:35:40 +00:00

56 lines
1.0 KiB
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;
using System.Drawing;
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 {
static GLib.GType gtype = GLib.GType.Invalid;
public MyButton () : base (GType)
{
Label = "I'm a subclassed button";
}
public static new GLib.GType GType {
get {
if (gtype == GLib.GType.Invalid)
gtype = RegisterGType (typeof (MyButton));
return gtype;
}
}
protected override void OnClicked ()
{
Console.WriteLine ("Button::Clicked default handler fired.");
}
}
}