2007-04-23 Mike Kestner <mkestner@novell.com>

* glib/Value.cs : add support for accessing generic struct boxed types
	as objects.  [Fixes #79224]

svn path=/trunk/gtk-sharp/; revision=76125
This commit is contained in:
Mike Kestner 2007-04-23 16:17:12 +00:00
parent d8fb820b89
commit 9611a6352f
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-04-23 Mike Kestner <mkestner@novell.com>
* glib/Value.cs : add support for accessing generic struct boxed types
as objects. [Fixes #79224]
2007-04-20 Mike Kestner <mkestner@novell.com>
* generator/CallbackGen.cs : switch to NativeCallbackSignature.

View File

@ -303,6 +303,15 @@ namespace GLib {
return strings;
}
object ToBoxed ()
{
IntPtr boxed_ptr = g_value_get_boxed (ref this);
Type t = GType.LookupType (type);
if (t == null)
throw new Exception ("Unknown type " + new GType (type).ToString ());
return Marshal.PtrToStructure (boxed_ptr, t);
}
public object Val
{
get {
@ -331,6 +340,8 @@ namespace GLib {
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
else if (g_type_is_a (type, GType.Object.Val))
return (GLib.Object) this;
else if (g_type_is_a (type, GType.Boxed.Val))
return ToBoxed ();
else
throw new Exception ("Unknown type " + new GType (type).ToString ());
}