2001-10-07 00:41:52 +00:00
|
|
|
// ButtonApp.cs - Gtk.Button class Test implementation
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2002-04-09 19:10:31 +00:00
|
|
|
// (c) 2001-2002 Mike Kestner
|
2001-10-07 00:41:52 +00:00
|
|
|
|
|
|
|
namespace GtkSamples {
|
|
|
|
|
|
|
|
using Gtk;
|
2002-02-18 19:26:33 +00:00
|
|
|
using GtkSharp;
|
2001-10-07 00:41:52 +00:00
|
|
|
using System;
|
2002-05-02 23:29:33 +00:00
|
|
|
using System.Drawing;
|
2001-10-07 00:41:52 +00:00
|
|
|
|
|
|
|
public class ButtonApp {
|
|
|
|
|
|
|
|
public static int Main (string[] args)
|
|
|
|
{
|
2002-04-09 19:10:31 +00:00
|
|
|
Application.Init ();
|
2002-05-02 23:29:33 +00:00
|
|
|
Window win = new Window ("Button Tester");
|
|
|
|
win.DefaultSize = new Size (200, 150);
|
2002-02-15 11:15:11 +00:00
|
|
|
win.DeleteEvent += new EventHandler (Window_Delete);
|
2002-04-09 19:10:31 +00:00
|
|
|
Button btn = new Button ("Click Me");
|
2001-10-07 00:41:52 +00:00
|
|
|
btn.Clicked += new EventHandler (btn_click);
|
2002-02-15 11:15:11 +00:00
|
|
|
win.EmitAdd (btn);
|
|
|
|
win.ShowAll ();
|
2001-10-07 00:41:52 +00:00
|
|
|
Application.Run ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void btn_click (object obj, EventArgs args)
|
|
|
|
{
|
|
|
|
Console.WriteLine ("Button Clicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Window_Delete (object obj, EventArgs args)
|
|
|
|
{
|
2002-02-18 19:26:33 +00:00
|
|
|
SignalArgs sa = (SignalArgs) args;
|
2001-10-07 00:41:52 +00:00
|
|
|
Application.Quit ();
|
2002-02-18 19:26:33 +00:00
|
|
|
sa.RetVal = true;
|
2001-10-07 00:41:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|