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


C# NSOutlineView.MakeView方法代码示例

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


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

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

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

示例3: ViewForTableColumn

		/// <summary>
		/// Views for table column.
		/// </summary>
		/// <returns>The for table column.</returns>
		/// <param name="outlineView">Outline view.</param>
		/// <param name="tableColumn">Table column.</param>
		/// <param name="item">Item.</param>
		public override NSView ViewForTableColumn (NSOutlineView outlineView, NSTableColumn tableColumn, Foundation.NSObject item)
		{
			NSTableCellView view = null;

			// Is this a group item?
			if (((SourceListItem)item).HasChildren) {
				view = (NSTableCellView)outlineView.MakeView ("HeaderCell", this);
			} else {
				view = (NSTableCellView)outlineView.MakeView ("DataCell", this);
				view.ImageView.Image = ((SourceListItem)item).Icon;
			}

			// Initialize view
			view.TextField.StringValue = ((SourceListItem)item).Title;

			// Return new view
			return view;
		}
开发者ID:pbbpage,项目名称:mac-samples,代码行数:25,代码来源:SourceListDelegate.cs

示例4: GetView

		public override NSView GetView (NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
		{
			// 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
			NSTextField view = (NSTextField)outlineView.MakeView (identifer, this);
			if (view == null) {
				view = new NSTextField () { 
					Identifier = identifer,
					Bordered = false,
					Selectable = false,
					Editable = false
				};
			}

			view.StringValue = ((Node)item).Name;
			return view;
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:18,代码来源:NSOutlineViewExample.cs

示例5: GetViewForItem

        public NSView GetViewForItem(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            //Console.WriteLine("SyncMenuWindowController - GetViewForItem");
            var syncMenuItem = (SyncMenuItem)item;

            NSTableCellView view = null;
            string tableColumnIdentifier = ((NSString)(tableColumn.Identifier)).ToString();
            if (tableColumnIdentifier == "columnTitle")
            {
                // Create view
                view = (NSTableCellView)outlineView.MakeView("cellTitle", this);
                view.TextField.Font = NSFont.FromFontName("Roboto", 11);

                switch (syncMenuItem.Entity.ItemType)
                {
                    case SyncMenuItemEntityType.Artist:
                        view.TextField.StringValue = syncMenuItem.Entity.ArtistName;
                        view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_user");
                        break;
                    case SyncMenuItemEntityType.Album:
                        view.TextField.StringValue = syncMenuItem.Entity.AlbumTitle;
                        view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_vinyl");
                        break;
                    case SyncMenuItemEntityType.Song:
                        view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_song");
                        if (syncMenuItem.Entity.Song != null)
                            view.TextField.StringValue = syncMenuItem.Entity.Song.Title;
                        break;
                }
            } 

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


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