Exemplo n.º 1
0
 static void OverrideGetTypeFromName(GLib.GType gtype, GetTypeFromNameNativeDelegate callback)
 {
     unsafe {
         IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("get_type_from_name"));
         *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback);
     }
 }
Exemplo n.º 2
0
        private GLib.GType InternalGetTypeFromName(string type_name)
        {
            GetTypeFromNameNativeDelegate unmanaged = class_abi.BaseOverride <GetTypeFromNameNativeDelegate>(this.LookupGType(), "get_type_from_name");

            if (unmanaged == null)
            {
                return(GLib.GType.None);
            }

            IntPtr native_type_name = GLib.Marshaller.StringToPtrGStrdup(type_name);
            IntPtr __result         = unmanaged(this.Handle, native_type_name);

            GLib.Marshaller.Free(native_type_name);
            return(new GLib.GType(__result));
        }
Exemplo n.º 3
0
        private GLib.GType InternalGetTypeFromName(string type_name)
        {
            GetTypeFromNameNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("get_type_from_name"));
                unmanaged = (GetTypeFromNameNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetTypeFromNameNativeDelegate));
            }
            if (unmanaged == null)
            {
                return(GLib.GType.None);
            }

            IntPtr native_type_name = GLib.Marshaller.StringToPtrGStrdup(type_name);
            IntPtr __result         = unmanaged(this.Handle, native_type_name);

            GLib.Marshaller.Free(native_type_name);
            return(new GLib.GType(__result));
        }
Exemplo n.º 4
0
		static void OverrideGetTypeFromName (GLib.GType gtype, GetTypeFromNameNativeDelegate callback)
		{
			GtkBuilderClass class_iface = GetClassStruct (gtype, false);
			class_iface.GetTypeFromName = callback;
			OverrideClassStruct (gtype, class_iface);
		}