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

C# Gtk.Widget类代码示例

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

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



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

示例1: Visit

		public bool Visit (object ob)
		{
			if (activeWidget == null && ob is Gtk.Widget)
				activeWidget = (Gtk.Widget) ob;

			if (ob == ((DefaultWorkbench)IdeApp.Workbench.RootWindow).ActiveWorkbenchWindow)
				visitedCurrentDoc = true;

			if (ob is MonoDevelop.Components.Docking.AutoHideBox) {
				found = true;
				return true;
			}
			if (ob is PropertyPad) {
				// Don't change the property grid selection when the focus is inside the property grid itself
				found = true;
				return true;
			}
			else if (ob is IPropertyPadProvider) {
				DesignerSupport.Service.SetPadContent ((IPropertyPadProvider)ob, activeWidget);
				found = true;
				return true;
			}
			else if (ob is ICustomPropertyPadProvider) {
				DesignerSupport.Service.SetPadContent ((ICustomPropertyPadProvider)ob, activeWidget);
				found = true;
				return true;
			}
			else
				return false;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:30,代码来源:PropertyPadVisitor.cs


示例2: SizingHelper

        public SizingHelper(Gtk.Widget window, Gtk.Widget border, bool allow_sizing, uint marginSize)
        {
            this._window = window;
            this._border = border;
            this._marginSize = marginSize;
            this._allow_sizing = allow_sizing;

            // check size request
            {
                int vw, vh;
                this._window.GetSizeRequest(out vw, out vh);
                vw = vw <= 0 ? 100 : vw;
                vh = vh <= 0 ? 100 : vh;
                this._window.SetSizeRequest(100, 100);
            }

            if (_allow_sizing) {
                this._border.AddEvents((int)Gdk.EventMask.PointerMotionMask);

                this._border.EnterNotifyEvent += HandleEnterNotifyEvent;
                this._border.LeaveNotifyEvent += HandleLeaveNotifyEvent;
                this._border.ButtonPressEvent += HandleButtonPressEvent;
                this._border.ButtonReleaseEvent += HandleButtonReleaseEvent;
                this._border.MotionNotifyEvent += HandleMotionNotifyEvent;
            }

            // Set style for border from resource style
            Gdk.Color bgc = this._window.Style.Background(Gtk.StateType.Selected);
            //Gdk.Color.Parse("black", ref bgc);
            this._border.ModifyBg(Gtk.StateType.Normal, bgc);
        }
开发者ID:cr3a70r,项目名称:DGLE2,代码行数:31,代码来源:SizingHelper.cs


示例3: EditorView

		public EditorView(ViewContent content)
		{
			try {
				this.content = content;
				
				var editorWidget = content.Control.GetNativeWidget<Gtk.Widget> ();
				editorWidget.ShowAll ();
				MonoDevelop.Components.Control previewNative;
				if (Platform.Instance.IsMac)
				{
					var editor = new GtkEmbed2(editorWidget);
					var editorEto = editor.ToEto();
					preview = new PreviewEditorView(editorEto, null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text);
					var nspreview = XamMac2Helpers.ToNative(preview, true);
					var nsviewContainer = new NSViewContainer2(nspreview);
					previewNative = nsviewContainer;
				}
				else
				{
					preview = new PreviewEditorView(editorWidget.ToEto(), null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text);
					previewNative = Gtk2Helpers.ToNative(preview, true);
				}

				var commandRouterContainer = new CommandRouterContainer (previewNative, content, true);
				commandRouterContainer.ShowAll ();
				control = commandRouterContainer;

				content.DirtyChanged += content_DirtyChanged;
				IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged;
				ContentName = content.ContentName;

			} catch (Exception ex) {
				Debug.WriteLine ($"{ex}");
			}
		}
开发者ID:picoe,项目名称:Eto,代码行数:35,代码来源:EditorView.cs


示例4: ExtensionModelBrowserWidget

		public ExtensionModelBrowserWidget ()
		{
			this.Build ();
			NodeBuilder[] builders = new NodeBuilder [] {
				new ExtensionNodeBuilder (),
				new ExtensionNodeNodeBuilder (),
				new ExtensionPointNodeBuilder (),
				new AddinNodeBuilder (),
				new SolutionNodeBuilder (true),
				new RegistryNodeBuilder (),
				new AddinCategoryNodeBuilder (),
				new MonoDevelop.Ide.Gui.Pads.ProjectPad.WorkspaceNodeBuilder (),
				new MonoDevelop.Ide.Gui.Pads.ProjectPad.SolutionFolderNodeBuilder ()
			};
			TreePadOption[] options = new TreePadOption [] {
				new TreePadOption ("ShowExistingNodes", GettextCatalog.GetString ("Show existing nodes"), true)
			};
			
			tree = new ExtensibleTreeView (builders, options);
			tree.ShowAll ();
			paned.Add1 (tree);
			
			foreach (Solution sol in IdeApp.Workspace.GetAllSolutions ())
				AddSolution (sol);
			
			docView = new Gtk.Label ();
			paned.Add2 (docView);
			
			tree.ShadowType = Gtk.ShadowType.In;
			tree.Tree.Selection.Changed += HandleSelectionChanged;
			
			AddinAuthoringService.RegistryChanged += OnRegistryChanged;
			IdeApp.Workspace.WorkspaceItemLoaded += OnSolutionLoaded;
			IdeApp.Workspace.WorkspaceItemUnloaded += OnSolutionUnloaded;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:35,代码来源:ExtensionModelBrowserWidget.cs


示例5: BaseWidgetAccessible

 public BaseWidgetAccessible(Gtk.Widget widget)
 {
     this.widget = widget;
     widget.SizeAllocated += OnAllocated;
     widget.Mapped += OnMap;
     widget.Unmapped += OnMap;
     widget.FocusInEvent += OnFocus;
     widget.FocusOutEvent += OnFocus;
     widget.AddNotification ("sensitive", (o, a) => NotifyStateChange (StateType.Sensitive, widget.Sensitive));
     widget.AddNotification ("visible",   (o, a) => NotifyStateChange (StateType.Visible, widget.Visible));
 }
开发者ID:dufoli,项目名称:hyena,代码行数:11,代码来源:BaseWidgetAccessible.cs


示例6: CustomListModel

 public CustomListModel(IListDataSource source, Gtk.Widget w)
 {
     parent = w;
     this.source = source;
     adapter = new Gtk.TreeModelAdapter (this);
     colTypes = source.ColumnTypes;
     source.RowChanged += HandleRowChanged;
     source.RowDeleted += HandleRowDeleted;
     source.RowInserted += HandleRowInserted;
     source.RowsReordered += HandleRowsReordered;
 }
开发者ID:RevolutionSmythe,项目名称:xwt,代码行数:11,代码来源:CustomListModel.cs


示例7: PadFontChanger

		public PadFontChanger (Gtk.Widget styleSource, Action<FontDescription> updater, Action resizer)
		{
			this.styleSource = styleSource;
			this.updater = updater;
			this.resizer = resizer;
			
			if (styleSource != null) {
				IdeApp.Preferences.CustomPadFont.Changed += PropertyChanged;
			}
			
			Update ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:12,代码来源:PadFontChanger.cs


示例8: PListEditorViewContent

		public PListEditorViewContent (IPlistEditingHandler handler, Project proj)
		{
			if (handler != null) {
				widget =  new PListEditorWidget (handler, proj);
				control = (Gtk.Widget) widget;
			} else {
				widget = new CustomPropertiesWidget ();
				var csw =  new MonoDevelop.Components.CompactScrolledWindow ();
				csw.Show ();
				csw.AddWithViewport ((Gtk.Widget)widget);
				control = csw;
			}
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:13,代码来源:PListEditorViewContent.cs


示例9: OnComboVisualizersChanged

		protected virtual void OnComboVisualizersChanged (object sender, System.EventArgs e)
		{
			if (currentWidget != null)
				mainBox.Remove (currentWidget);
			if (comboVisualizers.Active == -1) {
				buttonOk.Sensitive = false;
				return;
			}
			buttonOk.Sensitive = true;
			currentVisualizer = visualizers [comboVisualizers.Active];
			currentWidget = currentVisualizer.GetVisualizerWidget (value);
			mainBox.PackStart (currentWidget, true, true, 0);
			currentWidget.Show ();
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:14,代码来源:ValueVisualizerDialog.cs


示例10: FillMenu

		public void FillMenu (ActionTree actionTree)
		{
			addLabel = null;

			if (this.actionTree != null) {
				this.actionTree.ChildNodeAdded -= OnChildAdded;
				this.actionTree.ChildNodeRemoved -= OnChildRemoved;
			}
			
			this.actionTree = actionTree;
			if (actionTree == null) {
				AddSpacerItem ();
				return;
			}
				
			actionTree.ChildNodeAdded += OnChildAdded;
			actionTree.ChildNodeRemoved += OnChildRemoved;
			
			HideSpacerItem ();
			toolItems.Clear ();
			Widget wrapper = Stetic.Wrapper.Widget.Lookup (this);
			
			foreach (Gtk.Widget w in Children) {
				Remove (w);
				w.Destroy ();
			}

			foreach (ActionTreeNode node in actionTree.Children) {
				ActionToolItem aitem = new ActionToolItem (wrapper, this, node);
				AddItem (aitem, -1);
				toolItems.Add (aitem);
			}
			
			if (actionTree.Children.Count == 0) {
				// If there are no buttons in the toolbar, give it some height so it is selectable.
				AddSpacerItem ();
			}

			if (showPlaceholder) {
				AddCreateItemLabel ();
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:42,代码来源:ActionToolbar.cs


示例11: 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


示例12: FillMenu

		public void FillMenu (ActionTree actionTree)
		{
			addLabel = null;

			if (this.actionTree != null) {
				this.actionTree.ChildNodeAdded -= OnChildAdded;
				this.actionTree.ChildNodeRemoved -= OnChildRemoved;
			}
			
			this.actionTree = actionTree;
			if (actionTree == null) {
				AddSpacerItem ();
				return;
			}
				
			actionTree.ChildNodeAdded += OnChildAdded;
			actionTree.ChildNodeRemoved += OnChildRemoved;
			
			HideSpacerItem ();
			menuItems.Clear ();
			Widget wrapper = Widget.Lookup (this);
			
			foreach (Gtk.Widget w in Children) {
				Remove (w);
				w.Destroy ();
			}

			foreach (ActionTreeNode node in actionTree.Children) {
				ActionMenuItem aitem = new ActionMenuItem (wrapper, this, node);
				AddItem (aitem, -1);
				menuItems.Add (aitem);
			}

			if (showPlaceholder) {
				AddCreateItemLabel ();
			} else if (actionTree.Children.Count == 0) {
				// Give some height to the toolbar
				AddSpacerItem ();
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:40,代码来源:ActionMenuBar.cs


示例13: SetChild

		public void SetChild (IWidgetBackend child)
		{
			RemoveChildPlacement (currentChild);

			if (Widget.Child != null) {
				if (Widget.Child is Gtk.Bin) {
					Gtk.Bin vp = (Gtk.Bin) Widget.Child;
					vp.Remove (vp.Child);
				}
				Widget.Remove (Widget.Child);
			}
			
			if (child != null) {
				
				var w = currentChild = GetWidgetWithPlacement (child);
				
				WidgetBackend wb = (WidgetBackend) child;
				
				if (wb.EventSink.SupportsCustomScrolling ()) {
					CustomViewPort vp = new CustomViewPort (wb.EventSink);
					vp.Show ();
					vp.Add (w);
					Widget.Child = vp;
				}
				else if (w is Gtk.Viewport)
					Widget.Child = w;
				else {
					Gtk.Viewport vp = new Gtk.Viewport ();
					vp.Show ();
					vp.Add (w);
					Widget.Child = vp;
				}
			}
			
			UpdateBorder ();
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:36,代码来源:ScrollViewBackend.cs


示例14: Drop

        public static Gtk.Widget Drop(Gdk.DragContext ctx, Gtk.Widget target, uint time)
        {
            if (dropCallback != null) {
                dragWidget = dropCallback ();
            }

            if (dragWidget == null) {
                Gtk.Drag.GetData (target, ctx, GladeUtils.ApplicationXGladeAtom, time);
                return null;
            }

            Gtk.Widget w = Cancel ();
            Gtk.Drag.Finish (ctx, true, true, time);
            return w;
        }
开发者ID:mono,项目名称:stetic,代码行数:15,代码来源:DND.cs


示例15: Cancel

        // Call this from a DragEnd event to check if the widget wasn't dropped
        public static Gtk.Widget Cancel()
        {
            if (dragWidget == null)
                return null;

            Gtk.Widget w = dragWidget;
            dragWidget = null;

            // Remove the widget from its dragWindow
            Gtk.Container parent = w.Parent as Gtk.Container;
            if (parent != null) {
                parent.Remove (w);
                parent.Destroy ();
            }
            return w;
        }
开发者ID:mono,项目名称:stetic,代码行数:17,代码来源:DND.cs


示例16: typeof

		Control IOptionsPanel.CreatePanelWidget ()
		{
			Gtk.VBox cbox = new Gtk.VBox (false, 6);
			Gtk.HBox combosBox = new Gtk.HBox (false, 6);
			cbox.PackStart (combosBox, false, false, 0);
			combosBox.PackStart (new Gtk.Label (GettextCatalog.GetString ("Configuration:")), false, false, 0);
			configListStore = new Gtk.ListStore (typeof(string), typeof(string));
			configCombo = new Gtk.ComboBox (configListStore);
			var cell = new Gtk.CellRendererText ();
			configCombo.PackStart (cell, true);
			configCombo.AddAttribute (cell, "text", 0);
			combosBox.PackStart (configCombo, false, false, 0);
			combosBox.PackStart (new Gtk.Label (GettextCatalog.GetString ("Platform:")), false, false, 0);
			platformCombo = Gtk.ComboBox.NewText ();
			combosBox.PackStart (platformCombo, false, false, 0);
			cbox.PackStart (new Gtk.HSeparator (), false, false, 0);
			cbox.ShowAll ();

			cbox.Hidden += OnPageHidden;
			cbox.Shown += OnPageShown;
			
			lastConfigSelection = -1;
			lastPlatformSelection = -1;
			
			FillConfigurations ();
			UpdateSelection ();
			
			configCombo.Changed += OnConfigChanged;
			platformCombo.Changed += OnConfigChanged;
			
			bool oldMixed = allowMixedConfigurations;
			Gtk.Widget child = CreatePanelWidget ();
			
			//HACK: work around bug 469427 - broken themes match on widget names
			if (child.Name.IndexOf ("Panel") > 0)
				child.Name = child.Name.Replace ("Panel", "_");
			
			cbox.PackStart (child, true, true, 0);
			
			if (allowMixedConfigurations != oldMixed) {
				// If mixed mode has changed, update the configuration list
				FillConfigurations ();
				UpdateSelection ();
			}
			widgetCreated = true;
			panelWidget = child;
			
			if (currentConfigs.Count > 0) {
				panelWidget.Sensitive = true;
				LoadConfigData ();
			}
			else
				panelWidget.Sensitive = false;
			
			return cbox;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:56,代码来源:MultiConfigItemOptionsPanel.cs


示例17: ThreadedRenderer

		public ThreadedRenderer (Gtk.Widget owner)
		{
			this.owner = owner;
			runningSignal = new ManualResetEventSlim (true);
		}
开发者ID:jmloeffler,项目名称:monodevelop,代码行数:5,代码来源:ThreadedRenderer.cs


示例18: CreateControls

		void CreateControls ()
		{
			Gtk.Widget icon = null;
			Gtk.Widget label = null;
			dropButton = null;
			
			if (Child != null) {
				Gtk.Widget w = Child;
				Remove (w);
				w.Destroy ();
			}
			
			if (node.Type == Gtk.UIManagerItemType.Separator) {
				Gtk.Widget sep;
				if (parentToolbar.Orientation == Gtk.Orientation.Horizontal) {
					sep = new Gtk.VSeparator ();
				} else {
					sep = new Gtk.HSeparator ();
				}
				Gtk.HBox box = new Gtk.HBox ();
				box.BorderWidth = 6;
				box.PackStart (sep, true, true, 0);
				Add (box);
				return;
			}
			
			if (node.Action == null)
				return;
				
			Gtk.Action gaction = node.Action.GtkAction;
			
			bool showText = parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Text;
			bool showIcon = parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Icons;
			if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Both) {
				showText = showIcon = true;
			}
			else if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.BothHoriz) {
				showText = parentToolbar.Orientation == Gtk.Orientation.Vertical || gaction.IsImportant;
				showIcon = true;
			}
		
			string text = node.Action.ToolLabel;
			showingText = showText;

			if (showIcon)
			{
				if (gaction.StockId != null) {
					icon = node.Action.CreateIcon (parentToolbar.IconSize);
				} else if (!gaction.IsImportant) {
					icon = CreateFakeItem ();
				}
			}
			
			if (editing) {
				Gtk.HBox bbox = new Gtk.HBox ();
				bbox.Spacing = 3;
				if (icon != null) {
					bbox.PackStart (icon, false, false, 0);
				}
				bbox.PackStart (new Gtk.Arrow (Gtk.ArrowType.Down, Gtk.ShadowType.In), false, false, 0);
				Gtk.Button b = new Gtk.Button (bbox);
				b.TooltipText = Catalog.GetString ("Select action type");
				b.Relief = Gtk.ReliefStyle.None;
				b.ButtonPressEvent += OnSelectIcon;
				dropButton = b;
				icon = b;
				
				if (showText) {
					Gtk.Entry entry = new Gtk.Entry ();
					entry.Text = text;
					entry.Changed += OnLabelChanged;
					entry.Activated += OnLabelActivated;
					entry.HasFrame = false;
					label = entry;
					entry.TooltipText = Catalog.GetString ("Action label");
				}
			} else if (showText && text != null && text.Length > 0) {
				label = new Gtk.Label (text);
				label.Sensitive = editing || node.Action == null || node.Action.GtkAction.Sensitive;
			}
			
			if (icon != null && label != null) {
				if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.BothHoriz) {
					Gtk.HBox box = new Gtk.HBox ();
					box.PackStart (icon, false, false, 0);
					box.PackStart (label, true, true, 0);
					icon = box;
				} else if (parentToolbar.ToolbarStyle == Gtk.ToolbarStyle.Both) {
					Gtk.VBox box = new Gtk.VBox ();
					Gtk.Alignment al = new Gtk.Alignment (0.5f, 0f, 0f, 0f);
					al.Add (icon);
					box.PackStart (al, false, false, 0);
					box.PackStart (label, true, true, 0);
					icon = box;
				}
			} else if (label != null) {
				icon = label;
			}
			
			if (icon == null) {
//.........这里部分代码省略.........
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:101,代码来源:ActionToolItem.cs


示例19: Drag

        // Drag function for automatic sources, called from DragBegin
        static void Drag(Gtk.Widget source, Gdk.DragContext ctx, WidgetDropCallback dropCallback, Gtk.Widget dragWidget)
        {
            if (ctx == null)
                return;

            Gtk.Window dragWin;
            Gtk.Requisition req;

            ShowFaults ();
            DND.dragWidget = dragWidget;
            DND.dropCallback = dropCallback;

            dragWin = new Gtk.Window (Gtk.WindowType.Popup);
            dragWin.Add (dragWidget);

            req = dragWidget.SizeRequest ();
            if (req.Width < 20 && req.Height < 20)
                dragWin.SetSizeRequest (20, 20);
            else if (req.Width < 20)
                dragWin.SetSizeRequest (20, -1);
            else if (req.Height < 20)
                dragWin.SetSizeRequest (-1, 20);

            req = dragWin.SizeRequest ();

            int px, py, rx, ry;
            Gdk.ModifierType pmask;
            ctx.SourceWindow.GetPointer (out px, out py, out pmask);
            ctx.SourceWindow.GetRootOrigin (out rx, out ry);

            dragWin.Move (rx + px, ry + py);
            dragWin.Show ();

            dragHotX = req.Width / 2;
            dragHotY = -3;

            Gtk.Drag.SetIconWidget (ctx, dragWin, dragHotX, dragHotY);

            if (source != null) {
                source.DragDataGet += DragDataGet;
                source.DragEnd += DragEnded;
            }
        }
开发者ID:mono,项目名称:stetic,代码行数:44,代码来源:DND.cs


示例20: OnAdded

 protected override void OnAdded(Gtk.Widget widget)
 {
     base.OnAdded (widget);
     child = widget;
 }
开发者ID:jfreax,项目名称:xwt,代码行数:5,代码来源:ScrollViewBackend.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Gtk.Window类代码示例发布时间:2022-05-24
下一篇:
C# Gtk.VBox类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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