2001-09-17 01:15:56 +02:00
|
|
|
// GTK.Widget.cs - GTK Widget class implementation
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
|
|
|
// (c) 2001 Mike Kestner
|
|
|
|
|
2001-09-19 04:04:57 +02:00
|
|
|
namespace Gtk {
|
2001-09-17 01:15:56 +02:00
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using Glib;
|
|
|
|
using Gdk;
|
2001-09-17 01:15:56 +02:00
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
public abstract class Widget : Object {
|
2001-09-17 01:15:56 +02:00
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
private static readonly string DeleteEvent = "delete-event";
|
|
|
|
public event EventHandler DeleteEvent
|
2001-09-17 01:15:56 +02:00
|
|
|
{
|
2001-09-18 05:57:16 +02:00
|
|
|
add
|
|
|
|
{
|
2001-09-21 16:03:17 +02:00
|
|
|
AddGdkSimpleEvent(DeleteEvent, value);
|
2001-09-18 05:57:16 +02:00
|
|
|
}
|
|
|
|
remove
|
|
|
|
{
|
2001-09-21 16:03:17 +02:00
|
|
|
RemoveGdkSimpleEvent (DeleteEvent, value);
|
2001-09-18 05:57:16 +02:00
|
|
|
}
|
2001-09-17 01:15:56 +02:00
|
|
|
}
|
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
public void AddSimpleEvent(Object type, string name, EventHandler value)
|
|
|
|
{
|
|
|
|
if (Events[type] == null)
|
|
|
|
{
|
|
|
|
ConnectSimpleSignal(name, type);
|
|
|
|
}
|
|
|
|
Events.AddHandler(type, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddSimpleEvent(String type, EventHandle value)
|
|
|
|
: this (type, type, value) {}
|
|
|
|
|
|
|
|
public void RemoveSimpleEvent(Object type, string name, EventHander value)
|
|
|
|
{
|
|
|
|
Events.RemoveHandler(type, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void RemoveSimpleEvent(String type, EventHandle value)
|
|
|
|
: this (type, type, value) {}
|
|
|
|
|
|
|
|
public void AddGdkSimpleEvent(Object type, string name, EventHandler value)
|
2001-09-17 01:15:56 +02:00
|
|
|
{
|
2001-09-21 16:03:17 +02:00
|
|
|
if (Events[type] == null)
|
2001-09-18 05:57:16 +02:00
|
|
|
{
|
2001-09-21 16:03:17 +02:00
|
|
|
ConnectGdkSimpleEventSignal(name, type);
|
2001-09-17 01:15:56 +02:00
|
|
|
}
|
2001-09-21 16:03:17 +02:00
|
|
|
Events.AddHandler(type, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddGdkSimpleEvent(String type, EventHandle value)
|
|
|
|
: this (type, type, value) {}
|
|
|
|
|
|
|
|
public void RemoveGdkSimpleEvent(Object type, string name, EventHander value)
|
|
|
|
{
|
|
|
|
Events.RemoveHandler(type, value);
|
2001-09-17 01:15:56 +02:00
|
|
|
}
|
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
public void RemoveGdkSimpleEvent(String type, EventHandle value)
|
|
|
|
: this (type, type, value) {}
|
|
|
|
|
2001-09-17 01:15:56 +02:00
|
|
|
|
|
|
|
[DllImport("gtk-1.3")]
|
2001-09-21 16:03:17 +02:00
|
|
|
static extern void gtk_signal_connect_full (
|
|
|
|
IntPtr obj, string evname,
|
|
|
|
SimpleDelegate cb, IntPtr unsupported,
|
|
|
|
IntPtr data, IntPtr destroycb,
|
|
|
|
int objsig, int after );
|
2001-09-17 01:15:56 +02:00
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
public void ConnectSimpleSignal(string name, Object signal)
|
2001-09-17 01:15:56 +02:00
|
|
|
{
|
2001-09-21 16:03:17 +02:00
|
|
|
gtk_signal_connect_full(RawObject, name, Glib.Signals.Simple.Delegate,
|
|
|
|
new IntPtr (0), new IntPtr (signal.GetHashCode()),
|
|
|
|
new IntPtr (0), 0, 0);
|
|
|
|
}
|
2001-09-17 01:15:56 +02:00
|
|
|
|
2001-09-21 16:03:17 +02:00
|
|
|
public void ConnectGdkSimpleSignal(string name, Object signal)
|
|
|
|
{
|
|
|
|
gtk_signal_connect_full(RawObject, name, Gdk.Signals.SimpleEvent.Delegate,
|
|
|
|
new IntPtr (0), new IntPtr (signal.GetHashCode()),
|
|
|
|
new IntPtr (0), 0, 0);
|
2001-09-17 01:15:56 +02:00
|
|
|
}
|
2001-09-21 16:03:17 +02:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Show Method
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
|
|
|
/// Makes the Widget visible on the display.
|
|
|
|
/// </remarks>
|
|
|
|
|
|
|
|
[DllImport("gtk-1.3")]
|
|
|
|
static extern void gtk_widget_show (IntPtr obj);
|
|
|
|
|
|
|
|
public void Show ()
|
|
|
|
{
|
|
|
|
gtk_widget_show (RawObject);
|
|
|
|
}
|
|
|
|
}
|
2001-09-17 01:15:56 +02:00
|
|
|
}
|