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


C# Gtk.Widget类代码示例

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


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


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