Esempio n. 1
0
        public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem("LegendItemCell", indexPath) as LegendItemController;

            item.Init(Data[(int)indexPath.Item], Resources, Events);
            return(item);
        }
            public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
            {
                var item = collectionView.MakeItem(nameof(ImageListItem), indexPath) as ImageListItemController;

                item.View.ImageView.SetImage(new NSUrl(images[(int)indexPath.Item]), NSImage.ImageNamed("placeholder"));
                return(item);
            }
        public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem("HexArchiveCell", indexPath) as HexArchiveItemController;

            item.HexArchive = Data[(int)indexPath.Item];
            return(item);
        }
Esempio n. 4
0
        public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem(IsOnlyImage ? MacInspectorToolbarImageCollectionViewItem.Name : MacInspectorToolbarCollectionViewItem.Name, indexPath);

            if (item is MacInspectorToolbarCollectionViewItem itmView)
            {
                var selectedItem = items[(int)indexPath.Section].Items[(int)indexPath.Item];

                itmView.View.ToolTip                     = selectedItem.ToolTip ?? "";
                itmView.TextField.StringValue            = selectedItem.Label;
                itmView.DescriptionTextField.StringValue = string.Format("- {0}", selectedItem.Description);
                itmView.TextField.AccessibilityTitle     = selectedItem.AccessibilityLabel ?? "";
                itmView.TextField.AccessibilityHelp      = selectedItem.AccessibilityHelp ?? "";
                itmView.ImageView.Image                  = selectedItem.Image?.NativeObject as NSImage;
                //TODO: carefull wih this deprecation (we need a better fix)
                //ImageView needs modify the AccessibilityElement from it's cell, doesn't work from main view
                itmView.ImageView.Cell.AccessibilityElement = false;
            }
            else if (item is MacInspectorToolbarImageCollectionViewItem imgView)
            {
                var selectedItem = items[(int)indexPath.Section].Items[(int)indexPath.Item];
                imgView.View.ToolTip = selectedItem.Label ?? "";
                imgView.Image        = selectedItem.Image?.NativeObject as NSImage;
                imgView.ImageView.AccessibilityTitle   = selectedItem.Label ?? "";
                imgView.ImageView.AccessibilityElement = true;
            }
            return(item);
        }
        /// <summary>
        /// Gets the item for the give section and item index.
        /// </summary>
        /// <returns>The item.</returns>
        /// <param name="collectionView">The parent Collection view.</param>
        /// <param name="indexPath">Index path specifying the section and index.</param>
        public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem("EmployeeCell", indexPath) as EmployeeItemController;

            item.Person = Data[(int)indexPath.Item];

            return(item);
        }
        public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem("ItemViewCell", indexPath) as ItemViewController;

            item.ViewModel = Data[(int)indexPath.Item];
            item.UpdateUI();
            return(item);
        }
Esempio n. 7
0
        public NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem("ArtistItemView", indexPath) as ArtistItemView;

            var artist = viewModel.Search.Artists [(int)indexPath.Item];

            item.Artist = artist;

            return(item);
        }
        public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath)
        {
            var item = collectionView.MakeItem("LayerCell", indexPath) as LayerItemController;

            item.Layer = Data[(int)indexPath.Item];

            // set item's background color based on index number
            NSColor color = indexPath.Item % 2 == 0 ? LayerItemController.EvenColor : LayerItemController.OddColor;

            item.SetBackgroundColor(color);

            return(item);
        }
Esempio n. 9
0
        public NSCollectionViewItem GetCollectionCell(NSCollectionView collectionView, Foundation.NSIndexPath indexPath)
        {
            var cell = collectionView.MakeItem ("cell", indexPath);
            if (cell == null) {
                cell = new NSCollectionViewItem (){

                };
                cell.View = new NSTextField (new CGRect (0, 0, 100, 100)) {
                    Editable = false,
                };
            }
            var text = cell.View as NSTextField;
            //var cell = collectionView.NewItemForRepresentedObject ((NSString)Caption);
            //var cell = collectionView.GetItem ( indexPath) ;
            cell.Identifier = "cell";
            text.StringValue = Caption;
            return cell;
        }