Пример #1
0
		static IntPtr GetProtocolsFull_cb (IntPtr gtype)
		{
			try {
				GLib.GType gt = new GLib.GType (gtype);
				System.Type t = (System.Type) gt;

				if (protocols_cache.Contains (gtype)) {
				  return (IntPtr) protocols_cache[gtype];
				}

				System.Reflection.PropertyInfo pi = t.GetProperty ("Protocols", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
				string[] __result;
				if (pi != null && pi.PropertyType == typeof (string[]))
				  __result = (string[]) pi.GetValue (null, null);
				else
				  __result = new string[] {};
				IntPtr ret = Gst.Marshaller.StringArrayToNullTermPointer (__result);
				protocols_cache.Add (gtype, ret);

				return ret;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}
Пример #2
0
        public ListStore(params Type[] types)
            : base(IntPtr.Zero)
        {
            GLib.GType[] gtypes = new GLib.GType[types.Length];
            int i = 0;
            foreach (Type type in types) {
                gtypes[i] = (GLib.GType) type;
                i++;
            }

            CreateNativeObject (new string [0], new GLib.Value [0]);
            ColumnTypes = gtypes;
        }
Пример #3
0
		static int GetTypeFull_cb (IntPtr gtype)
		{
			try {
				GLib.GType gt = new GLib.GType (gtype);
				System.Type t = (System.Type) gt;

				System.Reflection.PropertyInfo pi = t.GetProperty ("Type", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
				Gst.URIType __result = Gst.URIType.Unknown;
				if (pi != null && pi.PropertyType == typeof (Gst.URIType))
				  __result = (Gst.URIType) pi.GetValue (null, null);

				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}
Пример #4
0
 private static void ConfigureClass(IntPtr gtype)
 {
     GType = new GLib.GType (gtype);
 }
Пример #5
0
 static void OverrideRequestPhase(GLib.GType gtype)
 {
     OverrideRequestPhase(gtype, RequestPhaseVMCallback);
 }
Пример #6
0
 static void OverrideResumeEvents(GLib.GType gtype, ResumeEventsNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "resume-events", callback);
 }
Пример #7
0
 static void OverrideAfterPaint(GLib.GType gtype, AfterPaintNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "after-paint", callback);
 }
Пример #8
0
		public GLib.GType GetColumnType(int index_) {
			IntPtr raw_ret = gtk_tree_model_get_column_type(Handle, index_);
			GLib.GType ret = new GLib.GType(raw_ret);
			return ret;
		}
Пример #9
0
		public GLib.GType SupportedChildType() {
			IntPtr raw_ret = gtk_container_child_type(Handle);
			GLib.GType ret = new GLib.GType(raw_ret);
			return ret;
		}
Пример #10
0
 static void OverrideQuery(GLib.GType gtype)
 {
     OverrideQuery(gtype, QueryVMCallback);
 }
Пример #11
0
 static void OverrideGetNativeSize(GLib.GType gtype)
 {
     OverrideGetNativeSize(gtype, GetNativeSizeVMCallback);
 }
Пример #12
0
 static void OverrideHandleBuffer(GLib.GType gtype)
 {
     OverrideHandleBuffer(gtype, HandleBufferVMCallback);
 }
Пример #13
0
 static void OverrideSrcEvent(GLib.GType gtype)
 {
     OverrideSrcEvent(gtype, SrcEventVMCallback);
 }
Пример #14
0
 static void OverrideSetCaps(GLib.GType gtype)
 {
     OverrideSetCaps(gtype, SetCapsVMCallback);
 }
Пример #15
0
 static void OverrideGetAction(GLib.GType gtype)
 {
     OverrideGetAction(gtype, GetActionVMCallback);
 }
Пример #16
0
 static void OverridePostActivate(GLib.GType gtype, PostActivateNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "post-activate", callback);
 }
Пример #17
0
		public static GLib.GType FactoryLookupType(GLib.SocketFamily family, GLib.SocketType type, int protocol_id) {
			IntPtr raw_ret = g_socket_connection_factory_lookup_type((int) family, (int) type, protocol_id);
			GLib.GType ret = new GLib.GType(raw_ret);
			return ret;
		}
Пример #18
0
 static void OverrideToNative(GLib.GType gtype)
 {
     OverrideToNative(gtype, ToNativeVMCallback);
 }
Пример #19
0
 static PlacementTool()
 {
     gtype = RegisterGType (typeof (PlacementTool));
 }
Пример #20
0
 static void OverrideGetFamily(GLib.GType gtype)
 {
     OverrideGetFamily(gtype, GetFamilyVMCallback);
 }
Пример #21
0
 static void OverridePostActivate(GLib.GType gtype)
 {
     OverridePostActivate(gtype, PostActivateVMCallback);
 }
Пример #22
0
 static void OverrideFormatValue(GLib.GType gtype)
 {
     OverrideFormatValue(gtype, FormatValueVMCallback);
 }
Пример #23
0
		public GLib.GType GetTypeFromName(string type_name) {
			IntPtr native_type_name = GLib.Marshaller.StringToPtrGStrdup (type_name);
			IntPtr raw_ret = gtk_builder_get_type_from_name(Handle, native_type_name);
			GLib.GType ret = new GLib.GType(raw_ret);
			GLib.Marshaller.Free (native_type_name);
			return ret;
		}
Пример #24
0
 static void OverrideDrawValue(GLib.GType gtype)
 {
     OverrideDrawValue(gtype, DrawValueVMCallback);
 }
 static CompletionWindow()
 {
     type = RegisterGType (typeof (CompletionWindow));
 }
Пример #26
0
 static void OverrideGetLayoutOffsets(GLib.GType gtype)
 {
     OverrideGetLayoutOffsets(gtype, GetLayoutOffsetsVMCallback);
 }
Пример #27
0
 static void OverrideResumeEvents(GLib.GType gtype)
 {
     OverrideResumeEvents(gtype, ResumeEventsVMCallback);
 }
Пример #28
0
 protected SourceUndoManager(GLib.GType gtype) : base(gtype)
 {
 }
Пример #29
0
 static void OverrideGetFrameTime(GLib.GType gtype)
 {
     OverrideGetFrameTime(gtype, GetFrameTimeVMCallback);
 }
Пример #30
0
 static void OverrideFlushEvents(GLib.GType gtype)
 {
     OverrideFlushEvents(gtype, FlushEventsVMCallback);
 }
Пример #31
0
 static void OverrideBeginUpdating(GLib.GType gtype)
 {
     OverrideBeginUpdating(gtype, BeginUpdatingVMCallback);
 }
Пример #32
0
 static void OverrideFlushEvents(GLib.GType gtype, FlushEventsNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "flush-events", callback);
 }
Пример #33
0
 static HtmlControl()
 {
     type = RegisterGType (typeof (HtmlControl));
 }
Пример #34
0
 static void OverrideBeforePaint(GLib.GType gtype)
 {
     OverrideBeforePaint(gtype, BeforePaintVMCallback);
 }
 static GtkHtmlControl()
 {
     type = RegisterGType (typeof (GtkHtmlControl));
 }
Пример #36
0
		static IntPtr ConstructorCallback (IntPtr gtypeval, uint n_construct_properties, IntPtr construct_properties)
		{
			GType gtype = new GLib.GType (gtypeval);
			GObjectClass threshold_class = (GObjectClass) Marshal.PtrToStructure (gtype.GetThresholdType ().GetClassPtr (), typeof (GObjectClass));
			IntPtr raw = threshold_class.constructor_cb (gtypeval, n_construct_properties, construct_properties);
			Dictionary<IntPtr, GLib.Value> deferred;

			GLib.Object obj = null;
			for (int i = 0; i < n_construct_properties; i++) {
				IntPtr p = new IntPtr (construct_properties.ToInt64 () + i * 2 * IntPtr.Size);

				string prop_name = Marshaller.Utf8PtrToString (g_param_spec_get_name (Marshal.ReadIntPtr (p)));
				if (prop_name != "gtk-sharp-managed-instance")
					continue;

				Value val = (Value) Marshal.PtrToStructure (Marshal.ReadIntPtr (p, IntPtr.Size), typeof (Value));
				if ((IntPtr) val.Val != IntPtr.Zero) {
					GCHandle gch = (GCHandle) (IntPtr) val.Val;
					obj = (GLib.Object) gch.Target;
					obj.Raw = raw;
					break;
				}
			}

			if (obj == null)
				obj = GetObject (raw, false);

			if(PropertiesToSet.TryGetValue(raw, out deferred)) {
				foreach(var item in deferred) {
					SetDeferredProperty(obj, item.Value, item.Key);
				}
				PropertiesToSet.Remove(raw);
			}
			return raw;
		}
Пример #37
0
        protected override void OnRealized()
        {
            base.OnRealized ();

            try {
                GLib.GType type = new GLib.GType (shell_window_get_type ());
                Style style = Rc.GetStyleByPaths (Settings, null, null, type);
                if (style != null) {
                    this.Style = style;
                    machineTasksLabel.Style = style;
                    commonTasksLabel.Style = style;
                }
            } catch {
            }
        }
Пример #38
0
		public static GLib.GType Lookup(string scheme) {
			IntPtr scheme_as_native = GLib.Marshaller.StringToPtrGStrdup (scheme);
			IntPtr raw_ret = rc_world_service_lookup(scheme_as_native);
			GLib.GType ret = new GLib.GType(raw_ret);
			GLib.Marshaller.Free (scheme_as_native);
			return ret;
		}
Пример #39
0
 static void OverrideBeforePaint(GLib.GType gtype, BeforePaintNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "before-paint", callback);
 }
Пример #40
0
 static void OverrideDisconnectProxy(GLib.GType gtype, DisconnectProxyNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "disconnect-proxy", callback);
 }
 static InsightWindow()
 {
     type = RegisterGType (typeof (InsightWindow));
 }
Пример #42
0
 static void OverrideUpdate(GLib.GType gtype)
 {
     OverrideUpdate(gtype, UpdateVMCallback);
 }
		public TypedClassDescriptor (Assembly assembly, XmlElement elem)
		{
			bool inheritedWrapper = false;
			
			wrapped = Registry.GetType (elem.GetAttribute ("type"), true);
			if (elem.HasAttribute ("wrapper"))
			    wrapper = Registry.GetType (elem.GetAttribute ("wrapper"), true);
			else {
				inheritedWrapper = true;
				string baseClass = elem.GetAttribute ("base-type");
				if (baseClass.Length > 0) {
					// If a base type is specified, use the wrapper of that base type
					TypedClassDescriptor parent = Registry.LookupClassByName (baseClass) as TypedClassDescriptor;
					if (parent != null)
						wrapper = parent.WrapperType;
				}
				else {
					for (Type type = wrapped.BaseType; type != null; type = type.BaseType) {
						TypedClassDescriptor parent = Registry.LookupClassByName (type.FullName) as TypedClassDescriptor;
						if (parent != null) {
							wrapper = parent.WrapperType;
							break;
						}
					}
				}
				if (wrapper == null)
					throw new ArgumentException (string.Format ("No wrapper type for class {0}", wrapped.FullName));
			}

			gtype = (GLib.GType)wrapped;
			cname = gtype.ToString ();

			string iconname = elem.GetAttribute ("icon");
			if (iconname.Length > 0) {
				try {
					// Using the pixbuf resource constructor generates a gdk warning.
					Gdk.PixbufLoader loader = new Gdk.PixbufLoader (assembly, iconname);
					icon = loader.Pixbuf;
				} catch {
					Console.WriteLine ("Could not load icon: " + iconname);
					icon = GetDefaultIcon ();
				}
			} else
				icon = GetDefaultIcon ();
			
			BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
						
			// If the wrapper is inherited from a base class, ignore the CreateInstance method
			// since it is going to create an instance of the base class.
			if (!inheritedWrapper) {
				ctorMethodInfoWithClass = wrapper.GetMethod ("CreateInstance", flags, null, new Type[] { typeof(ClassDescriptor)}, null);
				if (ctorMethodInfoWithClass == null) {
					ctorMethodInfo = wrapper.GetMethod ("CreateInstance", flags, null, Type.EmptyTypes, null);
				}
			}
			
			// Look for a constructor even if a CreateInstance method was
			// found, since it may return null.
			cinfo = wrapped.GetConstructor (Type.EmptyTypes);
			if (cinfo == null) {
				useGTypeCtor = true;
				cinfo = wrapped.GetConstructor (new Type[] { typeof (IntPtr) });
			}
			
			Load (elem);
		}
Пример #44
0
 static void OverrideUpdate(GLib.GType gtype, UpdateNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "update", callback);
 }
Пример #45
0
        public static Type LookupType(IntPtr typeid)
        {
            lock (types) {
                if (types.Contains (typeid))
                    return (Type)types[typeid];
            }

            string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));

            if (ResolveType != null) {
                GLib.GType gt = new GLib.GType (typeid);

                Delegate[] invocation_list = ResolveType.GetInvocationList ();
                foreach (Delegate d in invocation_list) {
                    TypeResolutionHandler handler = (TypeResolutionHandler) d;
                    System.Type tmp = handler (gt, native_name);
                    if (tmp != null) {
                        Register (gt, tmp);
                        return tmp;
                    }
                }
            }

            string type_name = GetQualifiedName (native_name);
            if (type_name == null)
                return null;
            Type result = null;
            Assembly[] assemblies = (Assembly[]) AppDomain.CurrentDomain.GetAssemblies ().Clone ();
            foreach (Assembly asm in assemblies) {
                result = asm.GetType (type_name);
                if (result != null)
                    break;
            }

            if (result == null) {
                // Because of lazy loading of references, it's possible the type's assembly
                // needs to be loaded.  We will look for it by name in the references of
                // the currently loaded assemblies.  Hopefully a recursive traversal is
                // not needed. We avoid one for now because of problems experienced
                // in a patch from bug #400595, and a desire to keep memory usage low
                // by avoiding a complete loading of all dependent assemblies.
                string ns = type_name.Substring (0, type_name.LastIndexOf ('.'));
                string asm_name = ns.ToLower ().Replace ('.', '-') + "-sharp";
                foreach (Assembly asm in assemblies) {
                    foreach (AssemblyName ref_name in asm.GetReferencedAssemblies ()) {
                        if (ref_name.Name != asm_name)
                            continue;
                        try {
                            string asm_dir = Path.GetDirectoryName (asm.Location);
                            Assembly ref_asm;
                            if (File.Exists (Path.Combine (asm_dir, ref_name.Name + ".dll")))
                                ref_asm = Assembly.LoadFrom (Path.Combine (asm_dir, ref_name.Name + ".dll"));
                            else
                                ref_asm = Assembly.Load (ref_name);
                            result = ref_asm.GetType (type_name);
                            if (result != null)
                                break;
                        } catch (Exception) {
                            /* Failure to load a referenced assembly is not an error */
                        }
                    }
                    if (result != null)
                        break;
                }
            }

            Register (new GType (typeid), result);
            return result;
        }
Пример #46
0
 static void OverrideLayout(GLib.GType gtype)
 {
     OverrideLayout(gtype, LayoutVMCallback);
 }
Пример #47
0
        static IntPtr ConstructorCallback(IntPtr gtypeval, uint n_construct_properties, IntPtr construct_properties)
        {
            GType gtype = new GLib.GType (gtypeval);
            GObjectClass threshold_class = (GObjectClass) Marshal.PtrToStructure (gtype.GetThresholdType ().GetClassPtr (), typeof (GObjectClass));
            IntPtr raw = threshold_class.constructor_cb (gtypeval, n_construct_properties, construct_properties);
            bool construct_needed = true;
            for (int i = 0; i < n_construct_properties; i++) {
                IntPtr p = new IntPtr (construct_properties.ToInt64 () + i * 2 * IntPtr.Size);

                string prop_name = Marshaller.Utf8PtrToString (g_param_spec_get_name (Marshal.ReadIntPtr (p)));
                if (prop_name != "gtk-sharp-managed-instance")
                    continue;

                Value val = (Value) Marshal.PtrToStructure (Marshal.ReadIntPtr (p, IntPtr.Size), typeof (Value));
                if ((IntPtr) val.Val != IntPtr.Zero) {
                    GCHandle gch = (GCHandle) (IntPtr) val.Val;
                    Object o = (GLib.Object) gch.Target;
                    o.Raw = raw;
                    construct_needed = false;
                    break;
                }
            }

            if (construct_needed)
                GetObject (raw, false);

            return raw;
        }
Пример #48
0
 static void OverrideLayout(GLib.GType gtype, LayoutNativeDelegate callback)
 {
     OverrideVirtualMethod(gtype, "layout", callback);
 }
Пример #49
0
 static void OverrideAfterPaint(GLib.GType gtype)
 {
     OverrideAfterPaint(gtype, AfterPaintVMCallback);
 }
Пример #50
0
		public GLib.GType IterGetObjectType(int pos) {
			IntPtr raw_ret = gtk_widget_path_iter_get_object_type(Handle, pos);
			GLib.GType ret = new GLib.GType(raw_ret);
			return ret;
		}