mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 07:45:42 +00:00
2c3cae3be8
* glib/Boxed.cs : fix a ctor bug reported to the list by u900842@oz.nthu.edu.tw. svn path=/trunk/gtk-sharp/; revision=11564
71 lines
1 KiB
C#
71 lines
1 KiB
C#
// GtkSharp.Boxed.cs - Base class for deriving marshallable structures.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001-2002 Mike Kestner
|
|
|
|
namespace GLib {
|
|
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Boxed Class
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// An abstract base class to derive structures and marshal them.
|
|
/// </remarks>
|
|
|
|
public class Boxed {
|
|
object obj;
|
|
IntPtr raw;
|
|
|
|
/// <summary>
|
|
/// Boxed Constructor
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Constructs a Boxed type from a raw ref.
|
|
/// </remarks>
|
|
|
|
public Boxed (object o)
|
|
{
|
|
this.obj = o;
|
|
}
|
|
|
|
public Boxed (IntPtr ptr)
|
|
{
|
|
this.raw = ptr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handle Property
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Gets a marshallable IntPtr.
|
|
/// </remarks>
|
|
public virtual IntPtr Handle {
|
|
get {
|
|
return raw;
|
|
}
|
|
set {
|
|
raw = value;
|
|
}
|
|
}
|
|
|
|
public static explicit operator System.IntPtr (Boxed boxed) {
|
|
return boxed.Handle;
|
|
}
|
|
|
|
public virtual object Obj {
|
|
get {
|
|
return obj;
|
|
}
|
|
set {
|
|
obj = value;
|
|
}
|
|
}
|
|
}
|
|
}
|