GtkSharp/gtk/Widget.cs
Mike Kestner 3c0213de88 2001-10-04 Mike Kestner <mkestner@speakeasy.net>
* gdk/SimpleEvent.cs : Temporarily comment the GCHandle code until
	a layout is ready and exceptions can be avoided.
	* gtk/Widget.cs : Killed all the signal and event attaching methods.
	They never belonged here, and now they exist in the SimpleEvent.
	Add a Signals hash to hold refs of the Signal handlers. Killed default
	ctor and the dtor.  The event Add/Remove methods now create a
	SimpleEvent, stuff it in the hash, and remove it when the last handler
	disappears.

svn path=/trunk/gtk-sharp/; revision=1078
2001-10-04 20:59:48 +00:00

55 lines
1.3 KiB
C#
Executable file

// GTK.Widget.cs - GTK Widget class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace Gtk {
using System;
using System.Collections;
using System.Runtime.InteropServices;
using GLib;
using Gdk;
public class Widget : Object {
private static readonly string DelEvName = "delete-event";
private Hashtable Signals = new Hashtable ();
public event EventHandler DeleteEvent {
add {
if (Events [DelEvName] == null)
Signals [DelEvName] = new SimpleEvent (
this, RawObject,
DelEvName, value);
Events.AddHandler(DelEvName, value);
}
remove {
Events.RemoveHandler(DelEvName, value);
if (Events [DelEvName] == null)
Signals.Remove (DelEvName);
}
}
/// <summary>
/// Show Method
/// </summary>
///
/// <remarks>
/// Makes the Widget visible on the display.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern void gtk_widget_show (IntPtr obj);
public void Show ()
{
gtk_widget_show (RawObject);
}
}
}