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

C# NSOutlineView类代码示例

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

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



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

示例1: SetupOutlineView

		// This sets up a NSOutlineView for demonstration
		internal static NSView SetupOutlineView (CGRect frame)
		{
			// Create our NSOutlineView and set it's frame to a reasonable size. It will be autosized via the NSClipView
			NSOutlineView outlineView = new NSOutlineView () {
				Frame = frame
			};

			// Every NSOutlineView must have at least one column or your Delegate will not be called.
			NSTableColumn column = new NSTableColumn ("Values");
			outlineView.AddColumn (column);
			// You must set OutlineTableColumn or the arrows showing children/expansion will not be drawn
			outlineView.OutlineTableColumn = column;

			// Setup the Delegate/DataSource instances to be interrogated for data and view information
			// In Unified, these take an interface instead of a base class and you can combine these into
			// one instance. 
			outlineView.Delegate = new OutlineViewDelegate ();
			outlineView.DataSource = new OutlineViewDataSource ();

			// NSOutlineView expects to be hosted inside an NSClipView and won't draw correctly otherwise  
			NSClipView clipView = new NSClipView (frame) {
				AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable
			};
			clipView.DocumentView = outlineView;
			return clipView;
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:27,代码来源:NSOutlineViewExample.cs


示例2: GetViewForItem

        public NSView GetViewForItem(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var libraryBrowserItem = (LibraryBrowserItem)item;
            var view = (NSTableCellView)outlineView.MakeView("cellLibrary", this);
            view.TextField.Font = NSFont.FromFontName("Roboto", 11);
            view.TextField.StringValue = libraryBrowserItem.Entity.Title;

            switch (libraryBrowserItem.Entity.EntityType)
            {
                case LibraryBrowserEntityType.AllSongs:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_artists");
                    break;
                case LibraryBrowserEntityType.Artists:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_artists");
                    break;
                case LibraryBrowserEntityType.Album:
                case LibraryBrowserEntityType.Albums:
                case LibraryBrowserEntityType.ArtistAlbum:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_vinyl");
                    break;
                case LibraryBrowserEntityType.Artist:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_user");
                    break;
            } 

            return view;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:27,代码来源:LibraryBrowserOutlineViewDelegate.cs


示例3: GetCell

        public override NSCell GetCell(NSOutlineView view, NSTableColumn column, MonoMac.Foundation.NSObject item)
        {
            NSCmisTree cmis = item as NSCmisTree;
            if (cmis == null) {
                Console.WriteLine ("GetCell Error");
                return null;
            }
            if (column == null) {
                return null;
            } else if (column.Identifier.Equals ("Name")) {
//                Console.WriteLine ("GetCell " + cmis);
                NSButtonCell cell = new NSButtonCell ();
                if (cmis.Parent != null)
                    cell.SetButtonType (NSButtonType.Switch);
                else
                    cell.SetButtonType (NSButtonType.Radio);
                // FIXME cell.AllowsMixedState = true;
                cell.Title = cmis.Name;
                cell.Editable = true;
                return cell;
            } else {
                NSTextFieldCell cell = new NSTextFieldCell ();
                return cell;
            }
        }
开发者ID:pcreignou,项目名称:CmisSync,代码行数:25,代码来源:OutlineViewDelegate.cs


示例4: ItemExpandable

        public override bool ItemExpandable (NSOutlineView outlineView, NSObject item)
        {
            if (item != null) {
                try { 
                    if (item is DirectoryNode) {
                        DirectoryNode node = item as DirectoryNode;
                        node.PopulateChildren (node.Name);
                        return (node.NumberOfChildren () != 0);
                    } else if (item is ScopeNode) {
                        ScopeNode passedNode = item as ScopeNode; // cast to appropriate type of node

                        return (passedNode.NumberOfChildren () != 0);
                    } else {
                        System.Diagnostics.Debug.WriteLine ("passedNode cast failed.");
                        return false;
                    }
                } catch (Exception e) {
                    System.Diagnostics.Debug.WriteLine (e.Message);
                    return false;
                }
            } else {
                // if null, it's asking about the root element
                return true;
            }
        }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:25,代码来源:OutlineViewDataSource.cs


示例5: GetView

		public override NSView GetView (NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item) {
			// Cast item
			var product = item as Product;

			// This pattern allows you reuse existing views when they are no-longer in use.
			// If the returned view is null, you instance up a new view
			// If a non-null view is returned, you modify it enough to reflect the new data
			NSTableCellView view = (NSTableCellView)outlineView.MakeView (tableColumn.Title, this);
			if (view == null) {
				view = new NSTableCellView ();
				if (tableColumn.Title == "Product") {
					view.ImageView = new NSImageView (new CGRect (0, 0, 16, 16));
					view.AddSubview (view.ImageView);
					view.TextField = new NSTextField (new CGRect (20, 0, 400, 16));
				} else {
					view.TextField = new NSTextField (new CGRect (0, 0, 400, 16));
				}
				view.TextField.AutoresizingMask = NSViewResizingMask.WidthSizable;
				view.AddSubview (view.TextField);
				view.Identifier = tableColumn.Title;
				view.TextField.BackgroundColor = NSColor.Clear;
				view.TextField.Bordered = false;
				view.TextField.Selectable = false;
				view.TextField.Editable = !product.IsProductGroup;
			}

			// Tag view
			view.TextField.Tag = outlineView.RowForItem (item);

			// Allow for edit
			view.TextField.EditingEnded += (sender, e) => {

				// Grab product
				var prod = outlineView.ItemAtRow(view.Tag) as Product;

				// Take action based on type
				switch(view.Identifier) {
				case "Product":
					prod.Title = view.TextField.StringValue;
					break;
				case "Details":
					prod.Description = view.TextField.StringValue;
					break; 
				}
			};

			// Setup view based on the column selected
			switch (tableColumn.Title) {
			case "Product":
				view.ImageView.Image = NSImage.ImageNamed (product.IsProductGroup ? "tags.png" : "tag.png");
				view.TextField.StringValue = product.Title;
				break;
			case "Details":
				view.TextField.StringValue = product.Description;
				break;
			}

			return view;
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:59,代码来源:ProductOutlineDelegate.cs


示例6: ItemExpandable

		public override bool ItemExpandable (NSOutlineView outlineView, NSObject item)
		{
			var result = item as ResultWrapper;
			if (result != null)
				return result.HasChildren;
			else
				return false;
		}
开发者ID:RafasTavares,项目名称:mac-samples,代码行数:8,代码来源:UnitTestDataSource.cs


示例7: GetObjectValue

		public override NSObject GetObjectValue (NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem)
		{
			TreeDataNode nodeItem = byItem as TreeDataNode;
			if (nodeItem == null)
				return null;

			return (NSString)nodeItem.CombinedName;
		}
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:8,代码来源:TreeDataSource.cs


示例8: GetChildrenCount

		/// <summary>
		/// Gets the children count.
		/// </summary>
		/// <returns>The children count.</returns>
		/// <param name="outlineView">Outline view.</param>
		/// <param name="item">Item.</param>
		public override nint GetChildrenCount (NSOutlineView outlineView, Foundation.NSObject item)
		{
			if (item == null) {
				return Items.Count;
			} else {
				return ((SourceListItem)item).Count;
			}
		}
开发者ID:pbbpage,项目名称:mac-samples,代码行数:14,代码来源:SourceListDataSource.cs


示例9: WillDisplayCell

		public override void WillDisplayCell (NSOutlineView outlineView, NSObject cell, NSTableColumn tableColumn, NSObject item)
		{
			var textCell = cell as MacImageListItemCell;
			if (textCell != null) {
				textCell.UseTextShadow = true;
				textCell.SetGroupItem (this.IsGroupItem (outlineView, item), outlineView, NSFont.SmallSystemFontSize, NSFont.SmallSystemFontSize);
			}
		}
开发者ID:neiz,项目名称:JabbR.Eto,代码行数:8,代码来源:CustomTreeViewDelegate.cs


示例10: GetChild

		/// <summary>
		/// Gets the child.
		/// </summary>
		/// <returns>The child.</returns>
		/// <param name="outlineView">Outline view.</param>
		/// <param name="childIndex">Child index.</param>
		/// <param name="item">Item.</param>
		public override NSObject GetChild (NSOutlineView outlineView, nint childIndex, Foundation.NSObject item)
		{
			if (item == null) {
				return Items [(int)childIndex];
			} else {
				return ((SourceListItem)item) [(int)childIndex]; 
			}
		}
开发者ID:pbbpage,项目名称:mac-samples,代码行数:15,代码来源:SourceListDataSource.cs


示例11: ItemExpandable

		public override bool ItemExpandable (NSOutlineView outlineView, NSObject item)
		{
			if (item == null) {
				return Products [0].IsProductGroup;
			} else {
				return ((Product)item).IsProductGroup;
			}
		
		}
开发者ID:pbbpage,项目名称:mac-samples,代码行数:9,代码来源:ProductOutlineDataSource.cs


示例12: GetChild

		public override NSObject GetChild (NSOutlineView outlineView, nint childIndex, NSObject item)
		{
			if (item == null) {
				return Products [(int)childIndex];
			} else {
				return ((Product)item).Products [(int)childIndex];
			}
				
		}
开发者ID:pbbpage,项目名称:mac-samples,代码行数:9,代码来源:ProductOutlineDataSource.cs


示例13: GetChildrenCount

		public override nint GetChildrenCount (NSOutlineView outlineView, NSObject item)
		{
			if (item == null) {
				return Products.Count;
			} else {
				return ((Product)item).Products.Count;
			}

		}
开发者ID:pbbpage,项目名称:mac-samples,代码行数:9,代码来源:ProductOutlineDataSource.cs


示例14: GetChildrenCount

		public override int GetChildrenCount (NSOutlineView outlineView, NSObject item)
		{
			if (item is TreeDataNode) {
				TreeDataNode nodeItem = item as TreeDataNode;
				return nodeItem.Nodes.Count;
			}

			return _nodes.Count;
		}
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:9,代码来源:TreeDataSource.cs


示例15: GetChild

 public override NSObject GetChild(NSOutlineView outlineView, int childIndex, NSObject ofItem)
 {
     if (ofItem != null) {
     return ((SidebarListItem)ofItem).Children [childIndex];
      }
      else {
     return rootItems [childIndex];
      }
 }
开发者ID:enecciari,项目名称:mackeepass,代码行数:9,代码来源:SidebarDataSource.cs


示例16: IsGroupItem

 public override bool IsGroupItem(NSOutlineView outlineView, NSObject item)
 {
     if (((SidebarListItem)item).IsHeader) {
     return true;
      }
      else {
     return false;
      }
 }
开发者ID:enecciari,项目名称:mackeepass,代码行数:9,代码来源:SidebarDelegate.cs


示例17: GetChildrenCount

 public override int GetChildrenCount(NSOutlineView outlineView, NSObject item)
 {
     if (item == null) {
     return rootItems.Count;
      }
      else {
     return ((SidebarListItem)item).Children.Count;
      }
 }
开发者ID:enecciari,项目名称:mackeepass,代码行数:9,代码来源:SidebarDataSource.cs


示例18: ItemExpandable

		public override bool ItemExpandable (NSOutlineView outlineView, NSObject item)
		{
			TreeDataNode nodeItem = item as TreeDataNode;
			if (nodeItem != null) {
				return nodeItem.HasChildren;
			}

			return false;
		}
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:9,代码来源:TreeDataSource.cs


示例19: GetChild

 public override NSObject GetChild (NSOutlineView outlineView, nint childIndex, NSObject item)
 {
     // null means it's asking for the root
     if (item == null) {
         return (NSObject)RootNode;
     } else {
         return (NSObject)((item as ScopeNode).ChildAtIndex ((int)childIndex));
     }
 }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:9,代码来源:OutlineViewDataSource.cs


示例20: GetChild

		public override NSObject GetChild (NSOutlineView outlineView, int childIndex, NSObject ofItem)
		{
			TreeDataNode nodeItem = ofItem as TreeDataNode;
			if (nodeItem != null) {
				return nodeItem.Nodes [childIndex];
			}

			return Nodes[childIndex];
		}
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:9,代码来源:TreeDataSource.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# NSRange类代码示例发布时间:2022-05-24
下一篇:
C# NSObjectFlag类代码示例发布时间: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