88175147cf
* generator/BoxedGen.cs : New boxed type generatable. * generator/ObjectGen.cs : Add boxed type property generation and stub off interface properties for now. * generator/Parser.cs : Add boxed element parsing. * generator/SymbolTable.cs : Add IsBoxed and IsInterface methods. * glib/Boxed.cs : New base class for deriving boxed types. * glib/Object.cs : Add boxed GetProp/SetProp methods. * parser/gapi2xml.pl : Add boxed type element formatting. * parser/gapi_pp.pl : Add preprocessing of the generated sourcefiles. Handle the builtins and make them identifiable to the xml generator. svn path=/trunk/gtk-sharp/; revision=2012
66 lines
1.2 KiB
C#
66 lines
1.2 KiB
C#
// GtkSharp.Boxed.cs - Base class for deriving marshallable structures.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001-2002 Mike Kestner
|
|
|
|
namespace GtkSharp {
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
/// <summary>
|
|
/// Boxed Class
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// An abstract base class to derive structures and marshal them.
|
|
/// </remarks>
|
|
|
|
public abstract class Boxed {
|
|
|
|
IntPtr _raw;
|
|
|
|
// Destructor is required since we are allocating unmanaged
|
|
// heap resources.
|
|
|
|
~Boxed ()
|
|
{
|
|
Marshal.FreeHGlobal (_raw);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raw Property
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Gets a marshallable IntPtr.
|
|
/// </remarks>
|
|
|
|
public IntPtr Raw {
|
|
get {
|
|
if (_raw == IntPtr.Zero) {
|
|
// FIXME: Ugly hack.
|
|
_raw = Marshal.AllocHGlobal (128);
|
|
Marshal.StructureToPtr (this, _raw, true);
|
|
}
|
|
return _raw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// GetBoxed Shared Method
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Gets a managed class representing a raw ref.
|
|
/// </remarks>
|
|
|
|
public static Boxed GetBoxed (IntPtr raw)
|
|
{
|
|
// FIXME: Use the type manager to box the raw ref.
|
|
return null;
|
|
}
|
|
|
|
}
|
|
}
|