예제 #1
0
//        private CoordDataTable cdt;

        #region Construction
        public EditObject(IGeoApp app, GType type)
        {
            this.app  = app;
            lib       = type.Lib;
            this.type = type;

//            cdt = new CoordDataTable( );        //      ???
        }
예제 #2
0
 static extern GType g_type_register_static_simple(
     GType parentType,
     IntPtr typeName,
     UIntPtr classSize,
     IntPtr classInit,
     UIntPtr instanceSize,
     IntPtr instanceInit,
     uint flags);
예제 #3
0

        
예제 #4
0
 public void SetSearchCondition(GType type, string searchStr)
 {
     this.cbType.SelectedItem = type;
     if (searchStr == null)
     {
         searchStr = "";
     }
     this.tbSearch.Text = searchStr;
 }
예제 #5
0
        public void TestParamSpecObject()
        {
            var param = TestParamSpec(GType.Object, (name, nick, blurb, flags) =>
                                      new ParamSpecObject(name, nick, blurb, GType.TypeOf <GISharp.GObject.Object> (), flags));

            Assert.That(param.GetGType().Name, Is.EqualTo("GParamObject"));

            Utility.AssertNoGLibLog();
        }
예제 #6
0
        private void ReadPoint(DXFObject dxf, GType gType)
        {
            Point pnt = new Point((int)(dxf.points[0].X * 100.0), (int)(dxf.points[0].Y * 100.0));

            UpdateBounds(pnt);
            pointcount++;
            unitcount++;
            GPoint gobj = new GPoint(gType, pnt);
        }
예제 #7
0
 public static GType GetThresholdType(GType type)
 {
     GLib.GType curr_type = type;
     while (curr_type.ToString().StartsWith("__gtksharp_"))
     {
         curr_type = GetBaseType(curr_type);
     }
     return(curr_type);
 }
예제 #8
0
 /// <summary>
 /// Global Parameter Command  –  g
 /// Read
 /// </summary>
 /// <param name="magic"></param>
 /// <param name="code"></param>
 /// <param name="par_num"></param>
 /// <param name="par_ix"></param>
 public Message_g(int magic, byte code, byte par_num, int par_ix)
     : base("g")
 {
     m_GType               = GType.ReadGlobalParameter;
     Magic                 = magic;
     Code                  = code;
     NumberOfParameters    = par_num;
     GlobalParameterOffset = par_ix;
 }
예제 #9
0
        TreeNode AddNode(TreeNode parNode, GType type)
        {
            TreeNode node = parNode.Nodes.Add(type.Name);

            treeNodes.Add(type.Id, node);
            node.Tag     = type;
            node.Checked = AppLayer.Includes(type.Id);
            return(node);
        }
예제 #10
0
        private void ReadText(DXFObject dxf, GType gType)
        {
            Point    pnt  = new Point((int)(dxf.points[0].X * 100.0), (int)(dxf.points[0].Y * 100.0));
            GCaption gobj = new GCaption(gType, pnt);

            gobj.Caption = dxf.text;
            gobj.Angle   = (float)dxf.angle;

            UpdateBounds(pnt);
        }
예제 #11
0
 /// <summary>
 /// Global Parameter Command  –  g
 /// Write
 /// </summary>
 /// <param name="magic"></param>
 /// <param name="code"></param>
 /// <param name="par_num"></param>
 /// <param name="par_ix"></param>
 /// <param name="values"></param>
 public Message_g(int magic, byte code, byte par_num, int par_ix, List <int> values)
     : base("g")
 {
     m_GType               = GType.WriteGlobalParameter;
     Magic                 = magic;
     Code                  = code;
     NumberOfParameters    = par_num;
     GlobalParameterOffset = par_ix;
     m_Values              = values;
 }
예제 #12
0
        void Read(MIFPoint mp, GType gType)
        {
            Point  pnt  = new Point((int)(mp.point.X * 100.0), (int)(mp.point.Y * 100.0));
            GPoint gobj = new GPoint(gType, pnt);

            SetCaption(gobj);
            SetName(gobj);

            UpdateBounds(pnt);
        }
예제 #13
0
    public static IntPtr GetClassPtr(GType type)
    {
        IntPtr klass = g_type_class_peek(type.Val);

        if (klass == IntPtr.Zero)
        {
            klass = g_type_class_ref(type.Val);
        }
        return(klass);
    }
            public static IntPtr LookupGTypeClass(System.Type t)
            {
                if (classes[t] == null)
                {
                    GType gtype = GLib.Object.LookupGType(t);
                    classes[t] = g_type_class_ref(gtype.Val);
                }

                return((IntPtr)classes[t]);
            }
예제 #15
0
        public static GType RegisterStatic(string typeName, FlagsValue[] values)
        {
            GType.AssertGTypeName(typeName);
            var typeName_ = GMarshal.StringToUtf8Ptr(typeName);
            var values_   = GMarshal.CArrayToPtr <FlagsValue> (values, nullTerminated: true);
            var ret       = g_flags_register_static(typeName_, values_);

            // values are never freed for the liftime of the program
            return(ret);
        }
예제 #16
0
 /* <type name="none" type="void" managed-name="None" /> */
 /* transfer-ownership:none */
 static extern void g_flags_complete_type_info(
     /* <type name="GType" type="GType" managed-name="GType" /> */
     /* transfer-ownership:none */
     GType gFlagsType,
     /* <type name="TypeInfo" type="GTypeInfo*" managed-name="TypeInfo" /> */
     /* direction:out caller-allocates:0 transfer-ownership:full */
     out TypeInfo info,
     /* <type name="FlagsValue" type="const GFlagsValue*" managed-name="FlagsValue" /> */
     /* transfer-ownership:none */
     IntPtr constValues);
예제 #17
0
 public void Insert(ParamSpec pspec, GType ownerType)
 {
     AssertNotDisposed();
     if (pspec == null)
     {
         throw new ArgumentNullException(nameof(pspec));
     }
     g_param_spec_pool_insert(Handle, pspec.Handle, ownerType);
     GC.KeepAlive(pspec);
 }
예제 #18
0
        public static GType GetDummyGType()
        {
            if (_dummyGType == GType.Invalid)
            {
                _dummyGType = g_type_register_static_simple(GType.Object,
                                                            GMarshal.StringToUtf8Ptr(dummyTypeName),
                                                            new UIntPtr(256), IntPtr.Zero, new UIntPtr(32), IntPtr.Zero, 0);
            }

            return(_dummyGType);
        }
예제 #19
0
        public void DataChanged(object obj)
        {
            ISerializableObject ser = obj as ISerializableObject;

            if (ser != null)
            {
                switch (ser.ClassId)
                {
                case ClassId.Lib:
                    if (lib.IsUpdated(LibField.Attr))
                    {
                        CheckMirrorChanged();
                    }
                    if (lib.IsUpdated(LibField.Name))
                    {
                        CheckCompositeNameChanged(lib);
                    }
                    break;

                case ClassId.Type:
                    GType type = (GType)obj;
                    if (lib.IsUpdated(LibField.Name))
                    {
                        CheckCompositeNameChanged(type);
                    }
                    break;

                case ClassId.BgImage:
                    mainForm.RepaintMapForms();
                    break;

                case ClassId.Layer:
                    UpdateControls();
                    break;

                default:
                    break;
                }
            }
            IShapedObject iobj = obj as IShapedObject;

            if (iobj != null)
            {
                CheckRepaint(iobj);
            }
            if (obj is Layers)
            {
                UpdateControls();
            }
            if (obj is Map)
            {
                UpdateControls();
            }
        }
예제 #20
0
    static void Init(GType gType, Type type)
    {
        var ptr = gType.GetClassPtr();

        gst_element_class_set_metadata(ptr, LONGNAME, CLASSIFICATION, DESCRIPTION, AUTHOR);
        PadTemplate srcTmpl  = new PadTemplate("src", PadDirection.Src, PadPresence.Always, Caps.NewAny());
        PadTemplate sinkTmpl = new PadTemplate("sink", PadDirection.Sink, PadPresence.Always, Caps.NewAny());

        gst_element_class_add_pad_template(ptr, srcTmpl.OwnedHandle);
        gst_element_class_add_pad_template(ptr, sinkTmpl.OwnedHandle);
    }
예제 #21
0
        internal static T Get <T> (GType type) where T : TypeClass
        {
            if (!type.IsClassed)
            {
                throw new ArgumentException("GType is not classed", nameof(type));
            }
            var handle = g_type_class_ref(type);
            var ret    = Opaque.GetInstance <T> (handle, Transfer.Full);

            return(ret);
        }
예제 #22
0
        protected internal static GType LookupGType(System.Type t)
        {
            GType gtype = (GType)t;

            if (gtype.ToString() != "GtkSharpValue")
            {
                return(gtype);
            }

            return(RegisterGType(t));
        }
예제 #23
0
        public void TestFromName()
        {
            Assert.That(GType.FromName("void"), Is.EqualTo(GType.None));
            Assert.That(GType.FromName("there-should-never-be-a-type-with-this-name"),
                        Is.EqualTo(GType.Invalid));
            Assert.That(() => GType.FromName("name has invalid characters"),
                        Throws.TypeOf <InvalidGTypeNameException> ());
            Assert.That(() => GType.FromName(null),
                        Throws.TypeOf <ArgumentNullException> ());

            Utility.AssertNoGLibLog();
        }
예제 #24
0
파일: ParamSpec.cs 프로젝트: jwzl/ossbuild
		internal ParamSpec (string name, string nick, string blurb, GType type, ParamFlags pflags)
		{
			int flags = (int) pflags;

			IntPtr p_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr p_nick = Gst.GLib.Marshaller.StringToPtrGStrdup (nick);
			IntPtr p_blurb = Gst.GLib.Marshaller.StringToPtrGStrdup (blurb);

			if (type == GType.Char)
				handle = g_param_spec_char (p_name, p_nick, p_blurb, SByte.MinValue, SByte.MaxValue, 0, flags);
			else if (type == GType.UChar)
				handle = g_param_spec_uchar (p_name, p_nick, p_blurb, Byte.MinValue, Byte.MaxValue, 0, flags);
			else if (type == GType.Boolean)
				handle = g_param_spec_boolean (p_name, p_nick, p_blurb, false, flags);
			else if (type == GType.Int)
				handle = g_param_spec_int (p_name, p_nick, p_blurb, Int32.MinValue, Int32.MaxValue, 0, flags);
			else if (type == GType.UInt)
				handle = g_param_spec_uint (p_name, p_nick, p_blurb, 0, UInt32.MaxValue, 0, flags);
			else if (type == GType.Long)
				handle = g_param_spec_long (p_name, p_nick, p_blurb, IntPtr.Zero, IntPtr.Size == 4 ? new IntPtr (Int32.MaxValue) : new IntPtr (Int64.MaxValue), IntPtr.Zero, flags);
			else if (type == GType.ULong)
				handle = g_param_spec_ulong (p_name, p_nick, p_blurb, UIntPtr.Zero, UIntPtr.Size == 4 ? new UIntPtr (UInt32.MaxValue) : new UIntPtr (UInt64.MaxValue), UIntPtr.Zero, flags);
			else if (type == GType.Int64)
				handle = g_param_spec_int64 (p_name, p_nick, p_blurb, Int64.MinValue, Int64.MaxValue, 0, flags);
			else if (type == GType.UInt64)
				handle = g_param_spec_uint64 (p_name, p_nick, p_blurb, 0, UInt64.MaxValue, 0, flags);
			/*
			else if (type == GType.Enum)
			else if (type == GType.Flags)
			* TODO: 
			* Both g_param_spec_enum and g_param_spec_flags expect default property values and the members of the enum seemingly cannot be enumerated
			*/
			else if (type == GType.Float)
				handle = g_param_spec_float (p_name, p_nick, p_blurb, Single.MinValue, Single.MaxValue, 0.0f, flags);
			else if (type == GType.Double)
				handle = g_param_spec_double (p_name, p_nick, p_blurb, Double.MinValue, Double.MaxValue, 0.0, flags);
			else if (type == GType.String)
				handle = g_param_spec_string (p_name, p_nick, p_blurb, IntPtr.Zero, flags);
			else if (type == GType.Pointer)
				handle = g_param_spec_pointer (p_name, p_nick, p_blurb, flags);
			else if (type.Val == g_gtype_get_type ())
				handle = g_param_spec_gtype (p_name, p_nick, p_blurb, GType.None.Val, flags);
			else if (g_type_is_a (type.Val, GType.Boxed.Val))
				handle = g_param_spec_boxed (p_name, p_nick, p_blurb, type.Val, flags);
			else if (g_type_is_a (type.Val, GType.Object.Val))
				handle = g_param_spec_object (p_name, p_nick, p_blurb, type.Val, flags);
			else
				throw new ArgumentException ("type");

			Gst.GLib.Marshaller.Free (p_name);
			Gst.GLib.Marshaller.Free (p_nick);
			Gst.GLib.Marshaller.Free (p_blurb);
		}
예제 #25
0
 /// <summary>
 /// Free the boxed structure @boxed which is of type @boxed_type.
 /// </summary>
 /// <param name="boxedType">
 /// The type of @boxed.
 /// </param>
 /// <param name="boxed">
 /// The boxed structure to be freed.
 /// </param>
 public static void Free(GType boxedType, TypeInstance boxed)
 {
     if (!boxedType.IsA(GType.Boxed))
     {
         throw new ArgumentException("Not a boxed type", nameof(boxedType));
     }
     if (boxed == null)
     {
         throw new ArgumentNullException(nameof(boxed));
     }
     g_boxed_free(boxedType, boxed.Handle);
 }
예제 #26
0
 void SelectStyle(object sender, RoutedEventArgs e)
 {
     System.Windows.Controls.MenuItem mi = sender as System.Windows.Controls.MenuItem;
     if (mi.Name == "L")
     {
         lg = GType.__Linear;
     }
     else
     {
         lg = GType.__Radial;
     }
 }
예제 #27
0
 public void SelectType(GType type)
 {
     if (treeNodes.ContainsKey(type.Id))
     {
         TreeNode node = treeNodes[type.Id] as TreeNode;
         if (node != null)
         {
             tvTypes.SelectedNode = node;
             node.EnsureVisible();
         }
     }
 }
예제 #28
0
        public void TestParamSpecBoxed()
        {
            var gtype = GType.TypeOf <object> ();

            Assume.That(gtype.IsA(GType.Boxed));

            var param = TestParamSpec(gtype, (name, nick, blurb, flags) =>
                                      new ParamSpecBoxed(name, nick, blurb, gtype, flags));

            Assert.That(param.GetGType().Name, Is.EqualTo("GParamBoxed"));

            Utility.AssertNoGLibLog();
        }
예제 #29
0
        public void TestParamSpecParam()
        {
            var gtype = GType.TypeOf <ParamSpecBoolean> ();

            Assume.That(gtype.IsA(GType.Param));

            var param = TestParamSpec(gtype, (name, nick, blurb, flags) =>
                                      new ParamSpecParam(name, nick, blurb, gtype, flags));

            Assert.That(param.GetGType().Name, Is.EqualTo("GParamParam"));

            Utility.AssertNoGLibLog();
        }
예제 #30
0
        void Read(MIFText mp, GType gType)
        {
            Point    pnt  = new Point((int)(mp.point1.X * 100.0), (int)(mp.point1.Y * 100.0));
            GCaption gobj = new GCaption(gType, pnt);

            gobj.Caption = mp.text;
            gobj.Angle   = (float)mp.angle;

//          SetCaption( );
            SetName(gobj);

            UpdateBounds(pnt);
        }
예제 #31
0
    public static GType GetBaseType(GType type)
    {
        IntPtr parent = g_type_parent(type.Val);

        if (parent == IntPtr.Zero)
        {
            return(GType.None);
        }
        else
        {
            return(new GType(parent));
        }
    }
예제 #32
0
파일: Signal.cs 프로젝트: jwzl/ossbuild
		internal static void OverrideDefaultHandler (GType gtype, string name, Delegate cb)
		{
			IntPtr closure = g_cclosure_new (cb, IntPtr.Zero, IntPtr.Zero);
			gtype.EnsureClass ();
			uint id = GetSignalId (name, gtype.Val);
			g_signal_override_class_closure (id, gtype.Val, closure);
		}
예제 #33
0
 public GTypeSignalKey (GType type, string name) {
   this.type = type;
   signal_name = name;
 }
예제 #34
0
    public static object Emit (Gst.GLib.Object o, string name, params object[] parameters) {
      SignalQuery query;
      IntPtr type = gstsharp_g_type_from_instance (o.Handle);
      GType gtype = new GType (type);
      string signal_name, signal_detail;
      uint signal_detail_quark = 0;
      int colon;

      colon = name.LastIndexOf ("::");

      if (colon == -1) {
        signal_name = name;
        signal_detail = String.Empty;
      } else {
        signal_name = name.Substring (0, colon);
        signal_detail = name.Substring (colon + 2);
      }

      GTypeSignalKey key = new GTypeSignalKey (gtype, signal_name);

      if (SignalEmitInfo[key] == null) {
        IntPtr native_string = Gst.GLib.Marshaller.StringToPtrGStrdup (signal_name);
        uint signal_id = g_signal_lookup (native_string, type);
        Gst.GLib.Marshaller.Free (native_string);

        if (signal_id == 0)
          throw new NotSupportedException (String.Format ("{0} has no signal of name {1}", o, name));
        GSignalQuery q = new GSignalQuery ();
        g_signal_query (signal_id, ref q);

        if (q.signal_id == 0)
          throw new NotSupportedException (String.Format ("{0} couldn't be queried for signal with name {1}", o, name));

        query = new SignalQuery ();

        query.signal_id = signal_id;
        query.signal_name = Gst.GLib.Marshaller.Utf8PtrToString (q.signal_name);
        query.itype = new GType (q.itype);
        query.signal_flags = q.signal_flags;
        query.return_type = new GType (q.return_type);
        query.n_params = q.n_params;
        query.param_types = new Type[q.n_params];

        for (int i = 0; i < query.n_params; i++) {
          IntPtr t = Marshal.ReadIntPtr (q.param_types, i);
          GType g = new GType (t);

          query.param_types[i] = (Type) g;
        }

        SignalEmitInfo.Add (key, query);
      }

      query = (SignalQuery) SignalEmitInfo[key];
      Gst.GLib.Value[] signal_parameters = new Gst.GLib.Value[query.n_params + 1];
      signal_parameters[0] = new Gst.GLib.Value (o);

      if (parameters.Length != query.n_params)
        throw new ApplicationException (String.Format ("Invalid number of parameters: expected {0}, got {1}", query.n_params, parameters.Length));

      for (int i = 0; i < query.n_params; i++) {
        Type expected_type = (Type) query.param_types[i];
        Type given_type = parameters[i].GetType ();

        if (expected_type != given_type && ! given_type.IsSubclassOf (given_type))
          throw new ApplicationException (String.Format ("Invalid parameter type: expected {0}, got {1}", expected_type, given_type));

        signal_parameters[i + 1] = new Gst.GLib.Value (parameters[i]);
      }

      Gst.GLib.Value return_value = new Gst.GLib.Value ();
      if (query.return_type != GType.Invalid && query.return_type != GType.None)
        return_value.Init (query.return_type);

      if (signal_detail != String.Empty) {
        IntPtr native_string = Gst.GLib.Marshaller.StringToPtrGStrdup (signal_detail);
        signal_detail_quark = g_quark_from_string (native_string);
        Gst.GLib.Marshaller.Free (native_string);
      }

      g_signal_emitv (signal_parameters, query.signal_id, signal_detail_quark, ref return_value);

      foreach (Gst.GLib.Value v in signal_parameters)
        v.Dispose ();

      object ret = (query.return_type != GType.Invalid && query.return_type != GType.None) ? return_value.Val : null;

      if (ret != null)
        return_value.Dispose ();

      return ret;
    }
예제 #35
0
파일: MiniObject.cs 프로젝트: jwzl/ossbuild
    private static void ConnectDefaultHandlers (GType gtype, System.Type t) {
      foreach (MethodInfo minfo in t.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly)) {
        MethodInfo baseinfo = minfo.GetBaseDefinition ();
        if (baseinfo == minfo)
          continue;

        foreach (object attr in baseinfo.GetCustomAttributes (typeof (DefaultSignalHandlerAttribute), false)) {
          DefaultSignalHandlerAttribute sigattr = attr as DefaultSignalHandlerAttribute;
          MethodInfo connector = sigattr.Type.GetMethod (sigattr.ConnectionMethod, BindingFlags.Static | BindingFlags.NonPublic);
          object[] parms = new object [1];
          parms [0] = gtype;
          connector.Invoke (null, parms);
          break;
        }
      }

    }
예제 #36
0
 public GenType(GType gType, string javaTypeName)
 {
     GType = gType;
     JavaTypeName = javaTypeName;
 }
예제 #37
0
파일: Object.cs 프로젝트: jwzl/ossbuild
		static void AddProperties (GType gtype, System.Type t, bool register_instance_prop)
		{
			uint idx = 1;
			
			if (register_instance_prop) {
				IntPtr declaring_class = gtype.GetClassPtr ();
				ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly);
				g_object_class_install_property (declaring_class, idx, pspec.Handle);
				idx++;				
			}

			bool handlers_overridden = register_instance_prop;
			foreach (PropertyInfo pinfo in t.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) {
				foreach (object attr in pinfo.GetCustomAttributes (typeof (PropertyAttribute), false)) {
					if(pinfo.GetIndexParameters().Length > 0)
						throw(new InvalidOperationException(String.Format("Gst.GLib.RegisterPropertyAttribute cannot be applied to property {0} of type {1} because the property expects one or more indexed parameters", pinfo.Name, t.FullName)));
					
					if (!handlers_overridden) {
						IntPtr class_ptr = gtype.GetClassPtr ();
						GObjectClass gobject_class = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass));
						gobject_class.get_prop_cb = GetPropertyHandler;
						gobject_class.set_prop_cb = SetPropertyHandler;
						Marshal.StructureToPtr (gobject_class, class_ptr, false);
						handlers_overridden = true;
					}
					PropertyAttribute property_attr = attr as PropertyAttribute;
					try {
						IntPtr param_spec = RegisterProperty (gtype, property_attr.Name, property_attr.Nickname, property_attr.Blurb, idx, (GType) pinfo.PropertyType, pinfo.CanRead, pinfo.CanWrite);
						Properties.Add (param_spec, pinfo);
						idx++;
					} catch (ArgumentException) {
						throw new InvalidOperationException (String.Format ("Gst.GLib.PropertyAttribute cannot be applied to property {0} of type {1} because the return type of the property is not supported", pinfo.Name, t.FullName));
					}
				}
			}
		}
예제 #38
0
파일: Object.cs 프로젝트: jwzl/ossbuild
		static void AddInterfaces (GType gtype, Type t)
		{
			foreach (Type iface in t.GetInterfaces ()) {
				if (!iface.IsDefined (typeof (GInterfaceAttribute), true) || iface.IsAssignableFrom (t.BaseType))
					continue;

				GInterfaceAttribute attr = iface.GetCustomAttributes (typeof (GInterfaceAttribute), false) [0] as GInterfaceAttribute;
				GInterfaceAdapter adapter = Activator.CreateInstance (attr.AdapterType, null) as GInterfaceAdapter;
				
				GInterfaceInfo info = adapter.Info;
				g_type_add_interface_static (gtype.Val, adapter.GType.Val, ref info);
			}
		}
예제 #39
0
파일: Object.cs 프로젝트: jwzl/ossbuild
		protected static void OverrideVirtualMethod (GType gtype, string name, Delegate cb)
		{
			Signal.OverrideDefaultHandler (gtype, name, cb);
		}
예제 #40
0
 public GenType(GType gType, string csharpTypeName)
 {
     GType = gType;
     CSharpTypeName = csharpTypeName;
 }
예제 #41
0
파일: ParamSpec.cs 프로젝트: jwzl/ossbuild
		public ParamSpec (string name, string nick, string blurb, GType type, bool readable, bool writable) : this (name, nick, blurb, type, (readable ? ParamFlags.Readable : ParamFlags.None) | (writable ? ParamFlags.Writable : ParamFlags.None)) {}
예제 #42
0
		public static void RegisterType (GType native_type, System.Type type)
		{
			GType.Register (native_type, type);
		}
예제 #43
0
파일: Value.cs 프로젝트: jwzl/ossbuild
		void InitForProperty (GType gtype, string name)
		{
			IntPtr p_name = Marshaller.StringToPtrGStrdup (name);
			IntPtr spec_ptr = g_object_class_find_property (gtype.GetClassPtr (), p_name);
			Marshaller.Free (p_name);

			if (spec_ptr == IntPtr.Zero)
				throw new Exception (String.Format ("No property with name '{0}' in type '{1}'", name, gtype.ToString()));
			
			ParamSpec spec = new ParamSpec (spec_ptr);
			g_value_init (ref this, spec.ValueType.Val);
		}
예제 #44
0
파일: Object.cs 프로젝트: jwzl/ossbuild
		static IntPtr RegisterProperty (GType type, string name, string nick, string blurb, uint property_id, GType property_type, bool can_read, bool can_write)
		{
			IntPtr declaring_class = type.GetClassPtr ();
			ParamSpec pspec = new ParamSpec (name, nick, blurb, property_type, can_read, can_write);

			g_object_class_install_property (declaring_class, property_id, pspec.Handle);
			return pspec.Handle;
		}
예제 #45
0
파일: Object.cs 프로젝트: jwzl/ossbuild
		private static void InvokeClassInitializers (GType gtype, System.Type t)
		{
			object[] parms = {gtype, t};

			BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic;

			foreach (TypeInitializerAttribute tia in t.GetCustomAttributes (typeof (TypeInitializerAttribute), true)) {
				MethodInfo m = tia.Type.GetMethod (tia.MethodName, flags);
				if (m != null)
					m.Invoke (null, parms);
			}

			for (Type curr = t; curr != typeof(Gst.GLib.Object); curr = curr.BaseType) {
 
				if (curr.Assembly.IsDefined (typeof (IgnoreClassInitializersAttribute), false))
					continue;
 
				foreach (MethodInfo minfo in curr.GetMethods(flags))
					if (minfo.IsDefined (typeof (ClassInitializerAttribute), true))
						minfo.Invoke (null, parms);
			}
 		}
예제 #46
0
파일: MiniObject.cs 프로젝트: jwzl/ossbuild
    private static void InvokeClassInitializers (GType gtype, System.Type t) {
      object[] parms = {gtype, t};

      BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic;

      foreach (TypeInitializerAttribute tia in t.GetCustomAttributes (typeof (TypeInitializerAttribute), true)) {
        MethodInfo m = tia.Type.GetMethod (tia.MethodName, flags);
        if (m != null)
          m.Invoke (null, parms);
      }
    }
예제 #47
0
파일: MiniObject.cs 프로젝트: jwzl/ossbuild
    private static GType RegisterGType (System.Type t) {
      GType parent_gtype = LookupGType (t.BaseType);
      string name = BuildEscapedName (t);
      IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
      GTypeQuery query;
      g_type_query (parent_gtype.Val, out query);
      GTypeInfo info = new GTypeInfo ();
      info.class_size = (ushort) query.class_size;
      info.instance_size = (ushort) query.instance_size;
      GType gtype = new GType (g_type_register_static (parent_gtype.Val, native_name, ref info, 0));
      Gst.GLib.Marshaller.Free (native_name);

      Gst.GLib.GType.Register (gtype, t);

      ConnectDefaultHandlers (gtype, t);
      InvokeClassInitializers (gtype, t);
      return gtype;
    }