Example #1
0
        //"outlineView:viewForTableColumn:item:"
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            if (SearchManager.IsGroupItem(item))
            {
                var cellView = (NSTableCellView)outlineView.MakeView("GroupItem", this);
                cellView.TextField.StringValue = item.ToString();
                return(cellView);
            }
            else
            {
                NSTableCellView cellView  = (NSTableCellView)outlineView.MakeView("SearchItem", this);
                NSView []       viewList  = cellView.Subviews;
                NSTextField     titleTF   = (NSTextField)viewList [0];
                NSTextField     sectionTF = (NSTextField)viewList [1];
                NSTextField     numberTF  = (NSTextField)viewList [2];
                NSDictionary    value     = (NSDictionary)item;
                titleTF.StringValue = value.ObjectForKey(NSObject.FromObject("key2")).ToString();
//				titleTF.Cell.DrawsBackground = true;
//				titleTF.Cell.BackgroundColor = NSColor.Clear;
                titleTF.ToolTip       = value.ObjectForKey(NSObject.FromObject("key2")).ToString();
                sectionTF.StringValue = value.ObjectForKey(NSObject.FromObject("key3")).ToString();
//				sectionTF.Cell.DrawsBackground = true;
//				sectionTF.Cell.BackgroundColor = NSColor.Clear;
                sectionTF.ToolTip = value.ObjectForKey(NSObject.FromObject("key3")).ToString();
//				numberTF.Cell.DrawsBackground = true;
//				numberTF.Cell.BackgroundColor = NSColor.Clear;
                numberTF.StringValue = "";
                numberTF.ToolTip     = "";
                return(cellView);
            }
        }
Example #2
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            CustomFeaturesTableCellView view = null;

            // Is this a group item?
            if (((FeaturesListItem)item).HasChildren)
            {
                view = (CustomFeaturesTableCellView)outlineView.MakeView("HeaderCell", this);
                view.FeatureHeader.StringValue = ((FeaturesListItem)item).Title;
            }
            else
            {
                view = (CustomFeaturesTableCellView)outlineView.MakeView("DataCell", this);
                view.FeatureIcon.Image            = ((FeaturesListItem)item).Icon;
                view.FeatureTextField.StringValue = ((FeaturesListItem)item).Title;
                // view.FeatureTextField.StringValue = ((FeaturesListItem)item).Title;

                view.NotifyButton.StringValue = ((FeaturesListItem)item).NotifyCount;
            }
            // Initialize view
            //  view.TextFieldC.StringValue = ((FeaturesListItem)item).Title;


            // Return new view
            return(view);
        }
Example #3
0
    public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
    {
        if (IsGroupItem(outlineView, item))
        {
            return(outlineView.MakeView("HeaderCell", this));
        }

        var view = outlineView.MakeView("DataCell", this);
        var node = (Node)item;

        ((NSTextField)view.Subviews[1]).StringValue = node.Text;
        ((NSTextField)view.Subviews[1]).Changed    += HandleChanged;

        return(view);
    }
 //"outlineView:viewForTableColumn:item:"
 public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
 {
     if (SearchManager.IsGroupItem(item))
     {
         var cellView = (NSTableCellView)outlineView.MakeView("GroupItem", this);
         cellView.TextField.StringValue = item.ToString();
         return(cellView);
     }
     else
     {
         var cellView = (NSTableCellView)outlineView.MakeView("GroupItem", this);
         cellView.TextField.StringValue = item.ToString();
         return(cellView);
     }
 }
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                var label = (UnfocusableTextField)outlineView.MakeView(LabelId, outlineView);

                if (label == null)
                {
                    label = new UnfocusableTextField {
                        Identifier = LabelId
                    };
                }

                string text   = String.Empty;
                var    facade = (NSObjectFacade)item;

                if (facade.Target is KeyValuePair <string, SimpleCollectionView> kvp)
                {
                    text = kvp.Key;
                }
                else if (facade.Target is ITypeInfo type)
                {
                    text = type.Name;
                }

                label.StringValue = text;
                return(label);
            }
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var view = (NSTextField)outlineView.MakeView(_cellIdentifier, this);

            if (view == null)
            {
                view = new NSTextField
                {
                    Identifier      = _cellIdentifier,
                    BackgroundColor = NSColor.Clear,
                    Bordered        = false,
                    Selectable      = false,
                    Editable        = false
                };
            }
            var endpoint = item as MacEndpoint;

            if (endpoint.IsGroup)
            {
                view.StringValue = endpoint.Title;
            }
            else
            {
                view.StringValue = endpoint.Name;
            }
            return(view);
        }
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject itemObj)
            {
                var item = itemObj as ScopeViewItem;

                if (item == null)
                {
                    return(null);
                }

                var cellIdentifier = "cell";
                var view           = (NSButton)outlineView.MakeView(cellIdentifier, this);

                if (view == null)
                {
                    view            = new NSButton();
                    view.Identifier = cellIdentifier;
                    view.SetButtonType(NSButtonType.Switch);
                    view.Action = new ObjCRuntime.Selector("ItemChecked:");
                }

                view.State  = item.IsChecked ? NSCellStateValue.On : NSCellStateValue.Off;
                view.Title  = new string(' ', item.PresentationObject.Indent * 4) + item.PresentationObject.ToString();
                view.Target = item;

                return(view);
            }
        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;
        }
        private NSView GetEditor(string identifier, EditorViewModel vm, NSOutlineView outlineView)
        {
            var view = outlineView.MakeView(identifier, this);

            if (view != null)
            {
                return(view);
            }

            if (vm != null)
            {
                IEditorView editor = this.editorSelector.GetEditor(this.hostResources, vm);

                var editorControl = editor?.NativeView as PropertyEditorControl;
                if (editorControl != null)
                {
                    editorControl.TableView = outlineView;
                }
                else if (editor?.NativeView != null)
                {
                    editor.NativeView.Identifier = identifier;
                    return(editor.NativeView);
                }

                return(new EditorContainer(this.hostResources, editor)
                {
                    Identifier = identifier
                });
            }
            else
            {
                return(new PanelHeaderEditorControl(this.hostResources));
            }
        }
Example #10
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            NSTextField view = (NSTextField)outlineView.MakeView(CellIdentifier, this);

            if (view == null)
            {
                view = new NSTextField
                {
                    Identifier      = CellIdentifier,
                    BackgroundColor = NSColor.Clear,
                    Bordered        = false,
                    Selectable      = true,
                    Editable        = false
                };
            }

            switch (item)
            {
            case Directory dir:
                view.StringValue = dir.Title;
                break;

            case ExcelFile excel:
                view.StringValue = excel.Title(true);
                break;

            default:
                break;
            }

            return(view);
        }
		public override NSView GetView (NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
		{
			var labelContainer = (UnfocusableTextField)outlineView.MakeView (PathIdentifier, this);
			if (labelContainer == null) {
				labelContainer = new UnfocusableTextField {
					Identifier = PathIdentifier,
				};
			}
			var target = (item as NSObjectFacade).Target;

			switch (target) {
			case PropertyTreeElement propertyTreeElement:
				labelContainer.StringValue = string.Format ("{0}: ({1})", propertyTreeElement.Property.Name, propertyTreeElement.Property.RealType.Name);
				break;

			case string targetName:
				labelContainer.StringValue = targetName;
				break;

			default:
				labelContainer.StringValue = Properties.Resources.TypeNotSupported;
				break;
			}

			return labelContainer;
		}
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                NSTableCellView view = (NSTableCellView)outlineView.MakeView("cell", this);

                if (view == null)
                {
                    view = new NSTableCellView()
                    {
                        Identifier = "cell",
                        ImageView  = new NSImageView(new CGRect(2, 0, 16, 16)),
                        TextField  = new NSTextField(new CGRect(20, 0, 900, 16))
                        {
                            AutoresizingMask = NSViewResizingMask.WidthSizable,
                            BackgroundColor  = NSColor.Clear,
                            Bordered         = false,
                            Selectable       = false,
                            Editable         = false
                        }
                    };
                    view.AddSubview(view.ImageView);
                    view.AddSubview(view.TextField);
                }

                var node = item as TreeNode;

                view.ImageView.Image       = NSImage.ImageNamed(node.IsGroup ? "iconGroup" : "iconSong");
                view.TextField.StringValue = node.Name;
                view.TextField.TextColor   = node.IsGroup ? NSColor.Blue : NSColor.ControlText;

                return(view);
            }
Example #13
0
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                var oview = outlineView.MakeView(tableColumn.Identifier, this);
                var view  = oview as NSTableCellView;

                if (view == null)
                {
                    view = new NSTableCellView();
                }

                if (item == null)
                {
                    view.TextField.StringValue = "ROOT";
                }
                else if (item is MacFindResultGroupViewModel groupViewModel)
                {
                    var attributedBuffer = new NSMutableAttributedString(groupViewModel.FileName);
                    attributedBuffer.BeginEditing();
                    if (!string.IsNullOrEmpty(groupViewModel.RelativeFilePath))
                    {
                        attributedBuffer.Append(new NSAttributedString(
                                                    $" {groupViewModel.RelativeFilePath}",
                                                    //font: slightly smaller
                                                    foregroundColor: NSColor.Gray));
                    }
                    attributedBuffer.EndEditing();
                    view.TextField.AttributedStringValue = attributedBuffer;
                }
                else if (item is MacFindResultViewModel resultViewModel)
                {
                    // TODO: Trim string, adjust offsets. Decide what to do if offsets are in leading/trailing space (probably don't trim at all?)

                    var attributedBuffer = new NSMutableAttributedString();
                    attributedBuffer.BeginEditing();

                    if (resultViewModel.StartColumn > 0)
                    {
                        attributedBuffer.Append(new NSAttributedString(
                                                    resultViewModel.PreviewText.Substring(0, resultViewModel.StartColumn)));
                    }

                    attributedBuffer.Append(new NSAttributedString(
                                                resultViewModel.PreviewText.Substring(
                                                    resultViewModel.StartColumn,
                                                    resultViewModel.EndColumn - resultViewModel.StartColumn),
                                                backgroundColor: NSColor.FromRgb(240, 193, 163)));//240	193	163

                    if (resultViewModel.EndColumn < resultViewModel.PreviewText.Length)
                    {
                        attributedBuffer.Append(new NSAttributedString(
                                                    resultViewModel.PreviewText.Substring(resultViewModel.EndColumn)));
                    }

                    attributedBuffer.EndEditing();
                    view.TextField.AttributedStringValue = attributedBuffer;
                }

                return(view);
            }
		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;
		}
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var view = (ItemView)outlineView.MakeView(nameof(ItemView), this);

            view.ViewModel = (ItemViewModel)item;
            view.UpdateUI();
            return(view);
        }
        //"outlineView:viewForTableColumn:item:"
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            string identifier = tableColumn == null? "IndexItem":tableColumn.Identifier;

            if (indexDataManager.IsGroupItem(item))
            {
                var cellView = (NSTableCellView)outlineView.MakeView(identifier, this);
                cellView.TextField.StringValue = item.ToString();
                return(cellView);
            }
            else
            {
                var cellView = (NSTableCellView)outlineView.MakeView(identifier, this);
                cellView.TextField.StringValue = item.ToString();
                return(cellView);
            }
        }
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            NSTableCellView view = null;

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

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

            return(view);
        }
Example #18
0
		/// <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;
		}
Example #19
0
        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
            NSTextField view = (NSTextField)outlineView.MakeView(tableColumn.Title, this);

            if (view == null)
            {
                view                 = new NSTextField();
                view.Identifier      = tableColumn.Title;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered        = false;
                view.Selectable      = false;
                view.Editable        = !product.IsProductGroup;
            }

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

            // Allow for edit
            view.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.StringValue;
                    break;

                case "Details":
                    prod.Description = view.StringValue;
                    break;
                }
            };

            // Setup view based on the column selected
            switch (tableColumn.Title)
            {
            case "Product":
                view.StringValue = product.Title;
                break;

            case "Details":
                view.StringValue = product.Description;
                break;
            }

            return(view);
        }
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            string text = ((NSString)outlineView.DataSource.GetObjectValue(outlineView, tableColumn, item)).ToString();

            NSTableCellView result;

            result = (NSTableCellView)outlineView.MakeView(imageCell.Identifier, this);
            result.ImageView.Image       = ((FileListOutlineDataSource)outlineView.DataSource).GetFileIcon(item);
            result.TextField.StringValue = text;
            return(result);
        }
Example #21
0
        public override NSTableRowView RowViewForItem(NSOutlineView outlineView, NSObject item)
        {
            var rowView = outlineView.MakeView("DataCell", this);

            if (rowView != null)
            {
                rowView            = new FeatureListTableRowView();
                rowView.Identifier = "DataCell";
            }
            return(rowView as NSTableRowView);
        }
Example #22
0
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                var col  = tableColumn as TableColumn;
                var cell = outlineView.MakeView(tableColumn.Identifier, this);

                if (cell == null)
                {
                    cell = col.CreateNewView();
                }
                return(cell);
            }
Example #23
0
        /// <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 GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            NSTableCellView view = null;

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

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

            // Return new view
            return(view);
        }
Example #24
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var facade   = item as NSObjectFacade;
            var resource = facade?.Target as Resource;

            switch (tableColumn.Identifier)
            {
            case ResourceOutlineView.ResourcePreviewColId:
                var cbv = (CommonBrushView)outlineView.MakeView(resourceIdentifier, this);
                if (cbv == null)
                {
                    cbv = new CommonBrushView(this.hostResources)
                    {
                        Identifier       = resourceIdentifier,
                        Frame            = new CGRect(0, 0, 30, 18),
                        AutoresizingMask = NSViewResizingMask.WidthSizable
                    };
                }

                var commonBrush = BrushPropertyViewModel.GetCommonBrushForResource(resource);
                if (commonBrush != null)
                {
                    cbv.Brush = commonBrush;
                }

                return(cbv);

            case ResourceOutlineView.ResourceNameColId:
            default:
                var utf = (UnfocusableTextField)outlineView.MakeView(labelIdentifier, this);
                if (utf == null)
                {
                    utf = new UnfocusableTextField {
                        Identifier = labelIdentifier,
                    };
                }
                utf.StringValue = resource.Name;
                return(utf);
            }
        }
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var node                  = (RoslynModel.Node)item;
            var projectNode           = node as RoslynModel.ProjectNode;
            var projectReferenceNode  = node as RoslynModel.ProjectReferenceNode;
            var metadataReferenceNode = node as RoslynModel.MetadataReferenceNode;

            var workspace = windowController.Workspace;

            var view = (NSTableCellView)outlineView.MakeView(tableColumn.Identifier, this);

            string name    = null;
            string details = null;

            if (projectNode != null)
            {
                name    = workspace.CurrentSolution.GetProject(projectNode.ProjectId).Name;
                details = projectNode.ProjectId.Id.ToString();
            }
            else if (projectReferenceNode != null)
            {
                var referenceId = projectReferenceNode.ReferenceId;
                name    = workspace.CurrentSolution.GetProject(referenceId).Name;
                details = projectReferenceNode.ReferenceId.Id.ToString();
            }
            else if (metadataReferenceNode != null)
            {
                details = metadataReferenceNode.Reference.Display;
                name    = Path.GetFileNameWithoutExtension(details);
            }
            else if (node is RoslynModel.ProjectReferencesFolderNode)
            {
                name = "Project References";
            }
            else if (node is RoslynModel.MetadataReferencesFolderNode)
            {
                name = "Metadata References";
            }

            switch (tableColumn.Identifier)
            {
            case "name":
                view.TextField.StringValue = name ?? String.Empty;
                break;

            case "details":
                view.TextField.StringValue = details ?? String.Empty;
                break;
            }

            return(view);
        }
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, Foundation.NSObject item)
        {
            var genericItem = item as GenericOutlineItemWrapper;
            var view        = outlineView.MakeView(GenericOutlineCellView.KIdentifier, this) as GenericOutlineCellView;

            if (view == null)
            {
                view = new GenericOutlineCellView();
            }

            view.SetItem(genericItem);

            return(view);
        }
Example #27
0
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                var colHandler = Handler.GetColumn(tableColumn);

                if (colHandler != null && colHandler.DataCell != null)
                {
                    var cellHandler = colHandler.DataCell.Handler as ICellHandler;
                    if (cellHandler != null)
                    {
                        return(cellHandler.GetViewForItem(outlineView, tableColumn, -1, item, (obj, row) => obj != null ? ((EtoTreeItem)obj).Item : null));
                    }
                }
                return(outlineView.MakeView(tableColumn.Identifier, this));
            }
Example #28
0
        public override NSTableRowView RowViewForItem(NSOutlineView outlineView, NSObject item)
        {
            TreeRowView view = (TreeRowView)outlineView.MakeView("row", this);

            if (view == null)
            {
                view = new TreeRowView()
                {
                    owner      = owner,
                    Identifier = "row"
                }
            }
            ;
            view.Update((Node)item);
            return(view);
        }
    };
Example #29
0
        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(CellIdentifier, this);

            if (view == null)
            {
                view                 = new NSTextField();
                view.Identifier      = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered        = false;
                view.Selectable      = false;
            }

            // Cast item
            var order = item as Order;

            // Setup view based on the column selected
            switch (tableColumn.Title)
            {
            case "Product Name":
                view.StringValue = order.ProductName;
                break;

            case "Cost":
                view.StringValue = order.ProductCost.ToString();
                break;

            case "Sale Price":
                view.StringValue = order.ProductSalePrice.ToString();
                break;

            case "Actual Price":
                view.StringValue = order.ProductActualPrice.ToString();
                break;

            case "Quantity":
                view.StringValue = order.ProductQuantity.ToString();
                break;
            }

            return(view);
        }
		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;
		}
Example #31
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var view = (NSTableCellView)outlineView.MakeView(tableColumn.Identifier, this);
            var node = (RoslynSyntaxOutlineViewDataSource.SyntaxNodeWrapper)item;

            switch (tableColumn.Identifier)
            {
            case "type":
                view.TextField.StringValue = node.SyntaxNode.GetType().Name;
                break;

            case "tostring":
                view.TextField.StringValue = node.SyntaxNode.ToString();
                break;
            }

            return(view);
        }
Example #32
0
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                if (owner.OnCreateView != null)
                {
                    return(owner.OnCreateView(tableColumn, ((NSNodeItem)item).ModelNode));
                }
                var view = (NSTextField)outlineView.MakeView("defaultView", this);

                if (view == null)
                {
                    view = NSTextField.CreateLabel(item.ToString());
                }
                else
                {
                    view.StringValue = item.ToString();
                }
                return(view);
            }
Example #33
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            NSTableCellView view = null;

            var menuItem = item as ProxyMenuItem;

            if (menuItem != null)
            {
                view = outlineView.MakeView("MenuCell", this) as NSTableCellView;

                if (view?.TextField != null)
                {
                    view.TextField.StringValue = menuItem.Title;
                }
            }

            return(view);
        }
Example #34
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var view = (MacDebuggerObjectCellViewBase)outlineView.MakeView(tableColumn.Identifier, this);

            switch (tableColumn.Identifier)
            {
            case "name":
                if (view == null)
                {
                    view = new MacDebuggerObjectNameView(treeView);
                }
                break;

            case "value":
                if (view == null)
                {
                    view = new MacDebuggerObjectValueView(treeView);
                }
                break;

            case "type":
                if (view == null)
                {
                    view = new MacDebuggerObjectTypeView(treeView);
                }
                break;

            case "pin":
                if (view == null)
                {
                    view = new MacDebuggerObjectPinView(treeView);
                }
                break;

            default:
                return(null);
            }

            view.Row         = outlineView.RowForItem(item);
            view.ObjectValue = item;

            return(view);
        }
Example #35
0
        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;
        }