Пример #1
0
        public override CGSize SizeForItem(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, NSIndexPath indexPath)
        {
            var macToolboxWidget = (MacToolboxWidget)collectionView;
            var dataSource       = (MacToolboxWidgetDataSource)collectionView.DataSource;
            var flowLayout       = (NSCollectionViewFlowLayout)collectionViewLayout;

            return(flowLayout.ItemSize);
        }
Пример #2
0
        public override CGSize SizeForItem(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, NSIndexPath indexPath)
        {
            var delegateFlowLayout = (MacToolbarFlowLayout)collectionViewLayout;

            if (delegateFlowLayout.SectionAtIndexIsCollapsed((nuint)indexPath.Section))
            {
                return(new CGSize(0, 0));
            }
            if (IsOnlyImage)
            {
                return(MacInspectorToolbarImageCollectionViewItem.Size);
            }
            var sectionInset = delegateFlowLayout.SectionInset;

            return(new CGSize(collectionView.Frame.Width - sectionInset.Left - sectionInset.Right, MacInspectorToolbarCollectionViewItem.ItemHeight));
        }
 public override CGSize ReferenceSizeForHeader(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, nint section)
 {
     return(new CGSize(Width - 1, Height));
 }
 public override NSEdgeInsets InsetForSection(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, nint section)
 {
     return(new NSEdgeInsets(0, 0, 0, 0));
 }
        public override CGSize SizeForItem(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, NSIndexPath indexPath)
        {
            var flowLayout = (NSCollectionViewFlowLayout)collectionViewLayout;

            return(flowLayout.ItemSize);
        }
Пример #6
0
 public override CGSize ReferenceSizeForFooter(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, nint section)
 {
     return(CGSize.Empty);
 }
Пример #7
0
        public override CGSize ReferenceSizeForHeader(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, nint section)
        {
            if (!IsShowCategories)
            {
                return(CGSize.Empty);
            }
            var delegateFlowLayout = ((MacToolbarFlowLayout)collectionViewLayout);
            var sectionInset       = delegateFlowLayout.SectionInset;

            return(new CGSize(collectionView.Frame.Width, MacInspectorToolbarHeaderCollectionViewItem.SectionHeight));
        }
Пример #8
0
        public override CoreGraphics.CGSize SizeForItem(NSCollectionView collectionView, NSCollectionViewLayout collectionViewLayout, NSIndexPath indexPath)
        {
            // NSCollectionView sucks. It's hard to make it calc items sizes.
            // Calculating the size manually here.

            var i = dataSource.Data[(int)indexPath.Item];

            using (var g = new Graphics())
            {
                var sz = g.MeasureString(i.Label, resources.AxesFont);
                sz.Width +=
                    40                     /* preview width */
                    + 3                    /* preview left padding */
                    + 3                    /* space between preview and label */
                    + 1 /* extra space just in case */;
                sz.Height +=
                    1 /* extra space just in case */;

                return(sz.ToCGSize());
            }
        }