mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-24 02:05:32 +00:00
c2d90eb282
svn path=/trunk/gtk-sharp/; revision=858
71 lines
1.3 KiB
C#
71 lines
1.3 KiB
C#
// GTK.Button.cs - GTK Button class implementation
|
|
//
|
|
// Author: Bob Smith <bob@thestuff.net>
|
|
//
|
|
// (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 (EmitDeleteEvent));
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Button Object Constructor
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Constructs a Button Wrapper.
|
|
/// </remarks>
|
|
|
|
public Button (IntPtr o)
|
|
{
|
|
Object = o;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Button Constructor
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Constructs a new Button with the specified content.
|
|
/// </remarks>
|
|
|
|
[DllImport("gtk-1.3")]
|
|
static extern IntPtr gtk_label_new_with_label (String str);
|
|
|
|
public Button (String str)
|
|
{
|
|
Object = gtk_button_new_with_label (str);
|
|
}
|
|
}
|
|
}
|