// GTK.Button.cs - GTK Button class implementation // // Author: Bob Smith // // (c) 2001 Bob Smith namespace Gtk { using System; using System.Runtime.InteropServices; public class Button : Widget { private static readonly object ClickedEvent = new object (); public event EventHandler Clicked { add { if (Events[ClickedEvent] == null) { ConnectSignal ("clicked", new SimpleCallback (EmitClickedEvent)); } Events.AddHandler (ClickedEvent, value); } remove { Events.RemoveHandler (ClickedEvent, value); } } private void EmitClickedEvent (IntPtr obj) { EventHandler eh = (EventHandler)(Events[ClickedEvent]); if (eh != null) { EventArgs args = new EventArgs (); eh(this, args); } } /// /// Button Object Constructor /// /// /// /// Constructs a Button Wrapper. /// public Button (IntPtr o) { RawObject = o; } /// /// Button Constructor /// /// /// /// Constructs a new Button with the specified content. /// [DllImport("gtk-1.3")] static extern IntPtr gtk_button_new_with_label (String str); public Button (String str) { RawObject = gtk_button_new_with_label (str); } } }