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