当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.GetType方法代码示例

本文整理汇总了C#中Gtk.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetType方法的具体用法?C# Gtk.GetType怎么用?C# Gtk.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk的用法示例。


在下文中一共展示了Gtk.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FixContainerLeak

		// Works around BXC #3801 - Managed Container subclasses are incorrectly resurrected, then leak.
		// It does this by registering an alternative callback for gtksharp_container_override_forall, which
		// ignores callbacks if the wrapper no longer exists. This means that the objects no longer enter a
		// finalized->release->dispose->re-wrap resurrection cycle.
		// We use a dynamic method to access internal/private GTK# API in a performant way without having to track
		// per-instance delegates.
		public static void FixContainerLeak (Gtk.Container c)
		{
			if (containerLeakFixed) {
				return;
			}
			FixContainerLeak (c.GetType ());
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:13,代码来源:GtkWorkarounds.cs

示例2: RegisterActions

        internal static void RegisterActions(Gtk.Widget source, params Gtk.Action[] actions)
        {
            if(_actions == null)
                _actions = new Dictionary<ResourceManager, List<Gtk.Action>>();

            var sourceType = source.GetType();
            var baseName = string.Format("xCom.CamManager.Resources.{0}Strings", sourceType.Name);
            var rm = new ResourceManager(baseName, sourceType.Assembly);

            _actions.Add(rm, new List<Gtk.Action>(actions));
        }
开发者ID:x-company,项目名称:CamManager,代码行数:11,代码来源:CultureManager.cs

示例3: RegisterWidgets

        internal static void RegisterWidgets(Gtk.Widget source, params Gtk.Widget[] widgets)
        {
            if(_widgets == null)
                _widgets = new Dictionary<ResourceManager, List<Gtk.Widget>>();

            var sourceType = source.GetType();
            var baseName = string.Format("xCom.CamManager.Resources.{0}Strings", sourceType.Name);
            var rm = new ResourceManager(baseName, sourceType.Assembly);

            if(source is Gtk.Dialog)
            {
                if(widgets == null)
                    widgets = new Gtk.Widget[] { };

                var widgetsAsList = widgets.ToList();
                widgetsAsList.Add(source);
                widgets = widgetsAsList.ToArray();
            }

            _widgets.Add(rm, new List<Gtk.Widget>(widgets));
        }
开发者ID:x-company,项目名称:CamManager,代码行数:21,代码来源:CultureManager.cs

示例4: UpdateCulture

        internal static void UpdateCulture(Gtk.Widget source)
        {
            if(_widgets == null)
                _widgets = new Dictionary<ResourceManager, List<Gtk.Widget>>();

            var sourceType = source.GetType();
            var baseName = string.Format("xCom.CamManager.Resources.{0}Strings", sourceType.Name);

            foreach(var kvp in _widgets)
            {
                if(string.Compare(kvp.Key.BaseName.ToUpper(), baseName.ToUpper()) == 0)
                {
                    kvp.Value.ForEach(x => x.Translate(kvp.Key));
                    break;
                }
            }
        }
开发者ID:x-company,项目名称:CamManager,代码行数:17,代码来源:CultureManager.cs

示例5: AttachToWidget

        public void AttachToWidget(Gtk.Widget widget)
        {
            if (widget == null)
                throw new ArgumentNullException ("widget");

            int x, y;
            widget.GdkWindow.GetOrigin (out x, out y);

            if (widget.GetType() != typeof (Gtk.Window) || ! widget.GetType().IsSubclassOf(typeof (Gtk.Window))) {
                x += widget.Allocation.X;
                y += widget.Allocation.Y;
            }

            x += widget.Allocation.Width / 2;
            y += widget.Allocation.Height / 2;

            SetGeometryHints (widget.Screen, x, y);
        }
开发者ID:ArsenShnurkov,项目名称:monsoon,代码行数:18,代码来源:Notification.cs

示例6: SendKeyEvent

        void SendKeyEvent(Gtk.Widget target, uint keyval, Gdk.ModifierType state, Gdk.EventType eventType, string subWindow)
        {
            Gdk.KeymapKey[] keyms = Gdk.Keymap.Default.GetEntriesForKeyval (keyval);
            if (keyms.Length == 0)
                throw new Exception ("Keyval not found");

            Gdk.Window win;
            if (subWindow == null)
                win = target.GdkWindow;
            else
                win = (Gdk.Window) GetValue (target, target.GetType (), subWindow);

            var nativeEvent = new NativeEventKeyStruct {
                type = eventType,
                send_event = 1,
                window = win.Handle,
                state = (uint)state,
                keyval = keyval,
                group = (byte)keyms [0].Group,
                hardware_keycode = (ushort)keyms [0].Keycode,
                length = 0,
                time = Gtk.Global.CurrentEventTime
            };

            IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc (nativeEvent);
            try {
                Gdk.EventHelper.Put (new Gdk.EventKey (ptr));
            } finally {
                Marshal.FreeHGlobal (ptr);
            }
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:31,代码来源:AutoTestSession.cs

示例7: LocalizeWidget

        /// <summary>
        /// Localizes the widget.
        /// </summary>
        /// <param name="widget">Widget.</param>
        public static void LocalizeWidget(Gtk.Widget widget)
        {
            if (widget.GetType() == typeof(Gtk.Label))
            {
                Gtk.Label label = (Gtk.Label)widget;
                label.Text = Localize(label.Text);
            }

            if (widget.GetType() == typeof(Gtk.CheckButton))
            {
                Gtk.CheckButton checkButton = (Gtk.CheckButton)widget;
                checkButton.Label = Localize(checkButton.Label);
            }
            LocalizeWChildrens(widget);
        }
开发者ID:bella9221,项目名称:huggle,代码行数:19,代码来源:Languages.cs

示例8: LocalizeWChildrens

        /// <summary>
        /// Localizes the W childrens.
        /// </summary>
        /// <param name="widget">Widget.</param>
        public static void LocalizeWChildrens(Gtk.Widget widget)
        {
            if (widget.GetType() == typeof(Gtk.VBox))
            {
                foreach (Gtk.Widget ch in ((Gtk.VBox)widget).Children)
                {
                    LocalizeWidget(ch);
                }
            }

            if (widget.GetType() == typeof(Gtk.HBox))
            {
                foreach (Gtk.Widget ch in ((Gtk.HBox)widget).Children)
                {
                    LocalizeWidget(ch);
                }
            }

            if (widget.GetType() == typeof(Gtk.Table))
            {
                foreach (Gtk.Widget ch in ((Gtk.Table)widget).Children)
                {
                    LocalizeWidget(ch);
                }
            }
        }
开发者ID:bella9221,项目名称:huggle,代码行数:30,代码来源:Languages.cs

示例9: AttachToWidget

        public void AttachToWidget(Gtk.Widget widget)
        {
            int x, y;

            widget.GdkWindow.GetOrigin (out x, out y);

            if (widget.GetType() != typeof (Gtk.Window) || ! widget.GetType().IsSubclassOf(typeof (Gtk.Window))) {
                x += widget.Allocation.X;
                y += widget.Allocation.Y;
            }

            x += widget.Allocation.Width / 2;
            y += widget.Allocation.Height / 2;

            SetGeometryHints (widget.Screen, x, y);
            attach_widget = widget;
            status_icon = null;
        }
开发者ID:zhendi,项目名称:SparkleShare,代码行数:18,代码来源:Notification.cs

示例10: FormatLocalizedWithPrefix

 // special case: no fmt string arguments
 public static string FormatLocalizedWithPrefix(this string key, Gtk.Bin o)
 {
     return (o.GetType().Namespace+"."+key).FormatLocalized();
 }
开发者ID:Michael--,项目名称:DockingFramework,代码行数:5,代码来源:LocalizationExtensions.cs

示例11: SetControlText

        /// <summary>
        /// Sets the given control's text property.
        /// </summary>
        /// <param name="control">Control to set</param>
        /// <param name="tip">ToolTip control</param>
        /// <history>
        /// [Curtis_Beard]		07/31/2006	Created
        /// [Curtis_Beard]		11/06/2006	CHG: Use Gtk controls
        /// </history>
        public static void SetControlText(Gtk.Widget control, Gtk.Tooltips tip)
        {
            if (__RootNode != null)
             {
            string formName = "";
            XmlNode node = __RootNode.SelectSingleNode("screen[@name='" + formName + "']");
            XmlNode controlNode;

            if (node != null)
            {
               //node found, find control
               controlNode = node.SelectSingleNode("control[@name='" + control.Name + "']");

               if (controlNode != null)
               {
                  //found control node
                  string value = controlNode.Attributes["value"].Value;

                  //text
                  if (control.GetType() == typeof(Gtk.Label))
                  {
                     ((Gtk.Label)control).Text = value;
                  }
                  else if (control.GetType() == typeof(Gtk.Button))
                  {
                     ((Gtk.Button)control).Label = value;
                  }
                  else if (control.GetType() == typeof(Gtk.CheckButton))
                  {
                     ((Gtk.CheckButton)control).Label = value;
                  }
                  else if (control.GetType() == typeof(Gtk.Frame))
                  {
                     ((Gtk.Frame)control).Label = value;
                  }

                  //tooltip
                  if (tip != null && controlNode.Attributes["tooltip"] != null)
                     tip.SetTip(control, controlNode.Attributes["tooltip"].Value, string.Empty);
               }
            }
             }
        }
开发者ID:joshball,项目名称:astrogrep,代码行数:52,代码来源:Language.cs


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