mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-24 02:25:40 +00:00
8b85bf647a
* generator/ClassBase.cs : make MarshalType virtual. * generator/Parameters.cs : add Parameter class and Indexer. * generator/Signal.cs : Now use Parameters. (GetHandlerName): New abstraction of name handling. (GenerateDecls): use GetHandlerName. (GenComments): make private. (GenHandler): New. Generate custom event handlers and args. (Generate): use GenHandler. Pass args type to SignalHandler. * generate/SignalHandler.cs : store args type. Generate handler dependent args and use MulticastDelegate.DynamicInvoke. * generate/StructGen.cs : override MarshalType. * glib/SignalCallback.cs : store a MulticastDelegate and args type * sample/*.cs : use new DeleteEventHandler svn path=/trunk/gtk-sharp/; revision=5834
54 lines
1.1 KiB
C#
54 lines
1.1 KiB
C#
// GtkSharp.SignalCallback.cs - Signal callback base class implementation
|
|
//
|
|
// Authors: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001 Mike Kestner
|
|
|
|
namespace GtkSharp {
|
|
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
using GLib;
|
|
|
|
/// <summary>
|
|
/// SignalCallback Class
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Base Class for GSignal to C# event marshalling.
|
|
/// </remarks>
|
|
|
|
public abstract class SignalCallback {
|
|
|
|
// A counter used to produce unique keys for instances.
|
|
protected static int _NextKey = 0;
|
|
|
|
// Hashtable containing refs to all current instances.
|
|
protected static Hashtable _Instances = new Hashtable ();
|
|
|
|
// protected instance members
|
|
protected GLib.Object _obj;
|
|
protected MulticastDelegate _handler;
|
|
protected int _key;
|
|
protected Type _argstype;
|
|
|
|
/// <summary>
|
|
/// SignalCallback Constructor
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Initializes instance data.
|
|
/// </remarks>
|
|
|
|
public SignalCallback (GLib.Object obj, MulticastDelegate eh, Type argstype)
|
|
{
|
|
_key = _NextKey++;
|
|
_obj = obj;
|
|
_handler = eh;
|
|
_argstype = argstype;
|
|
_Instances [_key] = this;
|
|
}
|
|
|
|
}
|
|
}
|