Inheritance: IWrapper, IDisposable
示例#1
0
 public Value(Opaque val, string type_name)
 {
     type = IntPtr.Zero;
     pad1 = pad2 = 0;
     g_value_init(ref this, GType.FromName(type_name).Val);
     g_value_set_boxed(ref this, val.Handle);
 }
示例#2
0
 public Value(IntPtr obj, string prop_name, Opaque val)
 {
     type = IntPtr.Zero;
     pad1 = pad2 = 0;
     InitForProperty(GLib.Object.GetObject(obj), prop_name);
     g_value_set_boxed(ref this, val.Handle);
 }
示例#3
0
        public static Opaque GetOpaque(IntPtr o, Type type, bool owned)
        {
            if (o == IntPtr.Zero)
            {
                return(null);
            }

            Opaque opaque = (Opaque)Activator.CreateInstance(type, new object[] { o });

            if (owned)
            {
                if (opaque.owned)
                {
                    // The constructor took a Ref it shouldn't have, so undo it
                    opaque.Unref(o);
                }
                opaque.owned = true;
            }
            else
            {
                opaque = opaque.Copy(o);
            }

            return(opaque);
        }
        public Value(IntPtr obj, string prop_name, Opaque val)
        {
            type  = IntPtr.Zero;
            pad_1 = pad_2 = 0;
            IntPtr native = GLib.Marshaller.StringToPtrGStrdup(prop_name);

            gtksharp_value_create_from_property(ref this, obj, native);
            GLib.Marshaller.Free(native);
            g_value_set_boxed(ref this, val.Handle);
        }
        public Value(Opaque val, string type_name)
        {
            type  = IntPtr.Zero;
            pad_1 = pad_2 = 0;
            IntPtr native = GLib.Marshaller.StringToPtrGStrdup(type_name);

            gtksharp_value_create_from_type_name(ref this, native);
            GLib.Marshaller.Free(native);
            g_value_set_boxed(ref this, val.Handle);
        }
示例#6
0
        static void OnMarshal(IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr, IntPtr ihint, IntPtr data)
        {
            object [] args = new object[argc - 1];
            object    o    = ((GLib.Value)Marshal.PtrToStructure(argsPtr, typeof(GLib.Value))).Val;

            for (int i = 1; i < argc; i++)
            {
                IntPtr struct_ptr   = (IntPtr)((long)argsPtr + (i * gvalue_struct_size));
                Type   detectedType = GLib.GType.LookupType(Marshal.ReadIntPtr(struct_ptr));

                if (detectedType.IsSubclassOf(typeof(Opaque)))
                {
                    args[i - 1] = (Opaque)Opaque.GetOpaque(g_value_peek_pointer(struct_ptr), detectedType, false);
                }
                else
                {
                    GLib.Value argument = (GLib.Value)Marshal.PtrToStructure(struct_ptr, typeof(GLib.Value));
                    args[i - 1] = argument.Val;
                }
            }

            if (data == IntPtr.Zero)
            {
                Console.Error.WriteLine("No available data");
            }

            Key k = (Key)((GCHandle)data).Target;

            if (k != null)
            {
                SignalArgs arg = new SignalArgs();
                arg.Args = args;
                SignalInfo           si      = (SignalInfo)SignalHandlers[k];
                DynamicSignalHandler handler = (DynamicSignalHandler)si.RegisteredHandler;
                handler(o, arg);

                if (arg.RetVal != null)
                {
                    retval.Val = arg.RetVal;
                }
            }
        }
示例#7
0
        public static Opaque GetOpaque(IntPtr o, Type type, bool owned)
        {
            Opaque opaque = FastActivator.CreateOpaque(o, type);

            if (owned)
            {
                if (opaque.Owned)
                {
                    // The constructor took a Ref it shouldn't have, so undo it
                    opaque.Unref(o);
                }
                opaque.Owned = true;
            }
            else
            {
                opaque = opaque.Copy(o);
            }

            return(opaque);
        }
示例#8
0
		public Value (IntPtr obj, string prop_name, Opaque val)
		{
			type = IntPtr.Zero;
			pad_1 = pad_2 = 0;
			IntPtr native = GLib.Marshaller.StringToPtrGStrdup (prop_name);
			gtksharp_value_create_from_property (ref this, obj, native);
			GLib.Marshaller.Free (native);
			g_value_set_boxed (ref this, val.Handle);
		}
示例#9
0
		public Value (Opaque val, string type_name)
		{
			type = IntPtr.Zero;
			pad_1 = pad_2 = 0;
			IntPtr native = GLib.Marshaller.StringToPtrGStrdup (type_name);
			gtksharp_value_create_from_type_name (ref this, native);
			GLib.Marshaller.Free (native);
			g_value_set_boxed (ref this, val.Handle);
		}
示例#10
0
文件: Value.cs 项目: saraa/fishtastic
 public Value(IntPtr obj, string prop_name, Opaque val)
 {
     type = IntPtr.Zero;
     pad1 = new Padding ();
     pad2 = new Padding ();
     InitForProperty (GLib.Object.GetObject (obj), prop_name);
     g_value_set_boxed (ref this, val.Handle);
 }
示例#11
0
文件: Value.cs 项目: saraa/fishtastic
 public Value(Opaque val, string type_name)
 {
     type = IntPtr.Zero;
     pad1 = new Padding ();
     pad2 = new Padding ();
     g_value_init (ref this, GType.FromName (type_name).Val);
     g_value_set_boxed (ref this, val.Handle);
 }