mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-03-01 09:07:09 +00:00
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:
parent
d8fb820b89
commit
9611a6352f
|
@ -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>
|
2007-04-20 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* generator/CallbackGen.cs : switch to NativeCallbackSignature.
|
* generator/CallbackGen.cs : switch to NativeCallbackSignature.
|
||||||
|
|
|
@ -303,6 +303,15 @@ namespace GLib {
|
||||||
return strings;
|
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
|
public object Val
|
||||||
{
|
{
|
||||||
get {
|
get {
|
||||||
|
@ -331,6 +340,8 @@ namespace GLib {
|
||||||
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
|
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
|
||||||
else if (g_type_is_a (type, GType.Object.Val))
|
else if (g_type_is_a (type, GType.Object.Val))
|
||||||
return (GLib.Object) this;
|
return (GLib.Object) this;
|
||||||
|
else if (g_type_is_a (type, GType.Boxed.Val))
|
||||||
|
return ToBoxed ();
|
||||||
else
|
else
|
||||||
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
throw new Exception ("Unknown type " + new GType (type).ToString ());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue