• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GLib.GType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GLib.GType的典型用法代码示例。如果您正苦于以下问题:C# GType类的具体用法?C# GType怎么用?C# GType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GType类属于GLib命名空间,在下文中一共展示了GType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OverrideNewWindowPolicyDecisionRequested

		static void OverrideNewWindowPolicyDecisionRequested (GType gtype)
		{
			if (EtoWebView.NewWindowPolicyDecisionRequestedVMCallback == null) {
				EtoWebView.NewWindowPolicyDecisionRequestedVMCallback = new EtoWebView.NewWindowPolicyDecisionRequestedVMDelegate (EtoWebView.newwindowpolicydecisionrequested_cb);
			}
			GLib.Object.OverrideVirtualMethod (gtype, "new-window-policy-decision-requested", EtoWebView.NewWindowPolicyDecisionRequestedVMCallback);
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:7,代码来源:EtoWebView.cs


示例2: GetClassPtr

 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;
 }
开发者ID:abock,项目名称:clutter-sharp,代码行数:7,代码来源:GTypeExtensions.cs


示例3: Register

		public static void Register (GType native_type, System.Type type)
		{
			if (native_type != GType.Pointer && native_type != GType.Boxed && native_type != ManagedValue.GType)
				types[native_type.Val] = type;
			if (type != null)
				gtypes[type] = native_type;
		}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:7,代码来源:GType.cs


示例4: GetBaseType

 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);
 }
开发者ID:abock,项目名称:clutter-sharp,代码行数:8,代码来源:GTypeExtensions.cs


示例5: GetThresholdType

 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;
 }
开发者ID:abock,项目名称:clutter-sharp,代码行数:8,代码来源:GTypeExtensions.cs


示例6: ParamSpec

        public ParamSpec(string name, string nick, string blurb, GType type, bool readable, bool writable)
        {
            ParamFlags pflags = ParamFlags.None;
            if (readable) pflags |= ParamFlags.Readable;
            if (writable) pflags |= ParamFlags.Writable;
            int flags = (int) pflags;

            IntPtr p_name = GLib.Marshaller.StringToPtrGStrdup (name);
            IntPtr p_nick = GLib.Marshaller.StringToPtrGStrdup (nick);
            IntPtr p_blurb = 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");

            GLib.Marshaller.Free (p_name);
            GLib.Marshaller.Free (p_nick);
            GLib.Marshaller.Free (p_blurb);
        }
开发者ID:saraa,项目名称:fishtastic,代码行数:56,代码来源:ParamSpec.cs


示例7: ConnectDefaultHandlers

    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, null, new Type[] { typeof (GType) }, new ParameterModifier [0]);
                object[] parms = new object [1];
                parms [0] = gtype;
                connector.Invoke (null, parms);
                break;
            }
        }
    }
开发者ID:abock,项目名称:clutter-sharp,代码行数:17,代码来源:patch.cs


示例8: PropertyInfo

        public PropertyInfo(IntPtr pspec_ptr)
        {
            GParamSpec pspec = (GParamSpec) Marshal.PtrToStructure (pspec_ptr, typeof (GParamSpec));
              IntPtr name = g_param_spec_get_name (pspec_ptr);
              IntPtr nick = g_param_spec_get_nick (pspec_ptr);
              IntPtr blurb = g_param_spec_get_blurb (pspec_ptr);

              this.name = GLib.Marshaller.Utf8PtrToString (name);
              this.nick = GLib.Marshaller.Utf8PtrToString (nick);
              this.blurb = GLib.Marshaller.Utf8PtrToString (blurb);

              this.readable = ( (pspec.Flags & (1 << 0)) != 0);
              this.writeable = ( (pspec.Flags & (1 << 1)) != 0);
              this.controllable = ( (pspec.Flags & (1 << 9)) != 0);
              /* TODO: Add more flags later, like the mutable flags */

              this.gtype = new GLib.GType (pspec.ValueType);
              this.type = (System.Type) this.gtype;

              this.dflt = this.min = this.max = null;

              try {
            GLib.Value v = new GLib.Value (new GLib.GType (pspec.ValueType));
            g_param_value_set_default (pspec_ptr, ref v);
            this.dflt = v.Val;
            v.Dispose ();

            if (EnumInfo.IsEnumType (this.gtype)) {
              EnumInfo ei = new EnumInfo (this.gtype);
              this.min = ei.Min;
              this.max = ei.Max;
            } else {
              GLib.Value min = new GLib.Value (new GLib.GType (pspec.ValueType));
              GLib.Value max = new GLib.Value (new GLib.GType (pspec.ValueType));
              if (gstsharp_g_param_spec_get_range (pspec_ptr, ref min, ref max)) {
            this.min = (object) min.Val;
            this.max = (object) max.Val;
              }
              min.Dispose ();
              max.Dispose ();
            }
              } catch (Exception) {}
        }
开发者ID:Forage,项目名称:gstreamer-sharp,代码行数:43,代码来源:PropertyInfo.cs


示例9: InvokeTypeInitializers

        private static void InvokeTypeInitializers(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);
            }
        }
开发者ID:sergey-litvinov,项目名称:gtk-sharp,代码行数:12,代码来源:Object.cs


示例10: AddInterfaces

        static void AddInterfaces(GType gtype, Type t, ref bool handlers_overridden)
        {
            foreach (Type iface in t.GetInterfaces ()) {
                if (!iface.IsDefined (typeof (GInterfaceAttribute), true))
                    continue;

                GInterfaceAttribute attr = iface.GetCustomAttributes (typeof (GInterfaceAttribute), false) [0] as GInterfaceAttribute;
                GInterfaceAdapter adapter = Activator.CreateInstance (attr.AdapterType, null) as GInterfaceAdapter;
                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;
                }

                if (!iface.IsAssignableFrom (t.BaseType)) {
                    GInterfaceInfo info = adapter.Info;
                    info.Data = gtype.GetClassPtr ();
                    //FIXME:  overiding prop is done inside the init of interface adapter
                    // not sure that it is the good solution but
                    // it is the only one I found without exception or loop
                    g_type_add_interface_static (gtype.Val, adapter.GType.Val, ref info);
                }
                foreach (PropertyInfo p in iface.GetProperties ()) {
                    PropertyAttribute[] attrs = p.GetCustomAttributes (typeof (PropertyAttribute), true) as PropertyAttribute [];
                    if (attrs.Length == 0)
                        continue;
                    PropertyAttribute property_attr = attrs [0];
                    PropertyInfo declared_prop = t.GetProperty (p.Name, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);
                    if (declared_prop == null)
                        continue;
                    IntPtr param_spec = FindInterfaceProperty (adapter.GType, property_attr.Name);

                    Properties [param_spec] = declared_prop;
                }
            }
        }
开发者ID:sergey-litvinov,项目名称:gtk-sharp,代码行数:39,代码来源:Object.cs


示例11: AddProperties

        static void AddProperties(GType gtype, System.Type t, bool register_instance_prop, ref bool handlers_overridden)
        {
            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++;
            }

            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("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 ("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));
                    }
                }
            }
        }
开发者ID:sergey-litvinov,项目名称:gtk-sharp,代码行数:33,代码来源:Object.cs


示例12: ParamSpec

 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))
 {
 }
开发者ID:Gravecorp,项目名称:gtk-sharp,代码行数:4,代码来源:ParamSpec.cs


示例13: AddInterfaces

        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);
            }
        }
开发者ID:shana,项目名称:gtk-sharp,代码行数:13,代码来源:Object.cs


示例14: InitForProperty

		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);
		}
开发者ID:knocte,项目名称:gtk-sharp,代码行数:12,代码来源:Value.cs


示例15: ToString

 public override string ToString()
 {
     GParamSpec spec = (GParamSpec) Marshal.PtrToStructure (Handle, typeof (GParamSpec));
     GType valtype= new GType (spec.value_type);
     GType ownertype= new GType (spec.owner_type);
     return "ParamSpec: name=" +  Marshaller.Utf8PtrToString (spec.name) + " value_type=" + valtype.ToString() + " owner_type=" + ownertype.ToString();
 }
开发者ID:Gravecorp,项目名称:gtk-sharp,代码行数:7,代码来源:ParamSpec.cs


示例16: TreeStore

 protected TreeStore(GType gtype)
     : base(gtype)
 {
 }
开发者ID:langpavel,项目名称:LPS-old,代码行数:4,代码来源:TreeStore.cs


示例17: OverrideVirtualMethod

 protected static void OverrideVirtualMethod(GType gtype, string name, Delegate cb)
 {
     Signal.OverrideDefaultHandler (gtype, name, cb);
 }
开发者ID:0x6e3078,项目名称:gtk-sharp,代码行数:4,代码来源:Object.cs


示例18: GetClassSize

 public static uint GetClassSize(GType type)
 {
     GTypeQuery query;
     g_type_query (type.Val, out query);
     return query.class_size;
 }
开发者ID:abock,项目名称:clutter-sharp,代码行数:6,代码来源:GTypeExtensions.cs


示例19: RegisterProperty

        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;
        }
开发者ID:0x6e3078,项目名称:gtk-sharp,代码行数:8,代码来源:Object.cs


示例20: GTypeSignalKey

 public GTypeSignalKey(GType type, string name)
 {
     this.type = type;
     signal_name = name;
 }
开发者ID:knocte,项目名称:gstreamer-sharp-1,代码行数:5,代码来源:DynamicSignal.cs



注:本文中的GLib.GType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GLib.List类代码示例发布时间:2022-05-26
下一篇:
C# Utility.SqlDataAccess类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap