internal override float GetItemOffset(RectangleF clientRect, PageViewItemSizeInfo sizeInfo, float proposedOffset)
        {
            int itemSpacing = this.layoutInfo.itemSpacing;
            ExplorerBarItemSizeInfo itemSizeInfo = sizeInfo as ExplorerBarItemSizeInfo;
            SizeF contentSize = itemSizeInfo.contentSize;

            switch (this.layoutInfo.position)
            {
            case StackViewPosition.Bottom:
            case StackViewPosition.Top:
                proposedOffset += contentSize.Height;
                break;

            default:
                proposedOffset += contentSize.Width;
                break;
            }

            if (itemSizeInfo.IsExpanded)
            {
                proposedOffset -= itemSpacing;
            }

            ExplorerBarLayoutInfo info = this.layoutInfo as ExplorerBarLayoutInfo;

            info.fullLayoutLength = (int)proposedOffset;

            return(proposedOffset);
        }
        internal virtual Size GetItemContentMetrics(ExplorerBarItemSizeInfo itemSizeInfo)
        {
            RadPageViewPage            itemPage        = itemSizeInfo.item.Page;
            RadPageViewExplorerBarItem explorerBarItem = itemSizeInfo.item as RadPageViewExplorerBarItem;
            Padding contentAreaPadding = explorerBarItem.AssociatedContentAreaElement.Padding;
            Size    result             = explorerBarItem.AssociatedContentAreaElement.MinSize;

            if (itemPage != null)
            {
                foreach (Control ctrl in itemPage.Controls)
                {
                    if (result.Width < ctrl.Left)
                    {
                        result.Width = ctrl.Left;
                    }

                    if (result.Height < ctrl.Bottom)
                    {
                        result.Height = ctrl.Bottom;
                    }
                }
            }

            result.Width  += contentAreaPadding.Horizontal;
            result.Height += contentAreaPadding.Vertical;
            return(result);
        }
        internal override SizeF GetContentSizeForItem(PageViewItemSizeInfo sizeInfo, System.Drawing.RectangleF clientRect)
        {
            if (sizeInfo == null)
            {
                return(SizeF.Empty);
            }
            ExplorerBarItemSizeInfo explorerBarSizeInfo = sizeInfo as ExplorerBarItemSizeInfo;

            if (!explorerBarSizeInfo.IsExpanded)
            {
                return(SizeF.Empty);
            }

            SizeF result = SizeF.Empty;

            switch (this.layoutInfo.position)
            {
            case StackViewPosition.Top:
                result.Width  = clientRect.Width;
                result.Height = this.GetContentLength(explorerBarSizeInfo, clientRect.Height);
                break;

            case StackViewPosition.Left:
                result.Width  = this.GetContentLength(explorerBarSizeInfo, clientRect.Width);
                result.Height = clientRect.Height;
                break;
            }

            return(result);
        }
示例#4
0
        public override PageViewItemSizeInfo CreateItemSizeInfo(RadPageViewItem item)
        {
            RadPageViewExplorerBarItem viewExplorerBarItem = item as RadPageViewExplorerBarItem;
            bool isVertical = this.GetIsVertical();
            bool isExpanded = viewExplorerBarItem.IsExpanded;
            ExplorerBarItemSizeInfo explorerBarItemSizeInfo = new ExplorerBarItemSizeInfo(viewExplorerBarItem, isVertical, isExpanded);

            if (isExpanded)
            {
                this.ExpandedItems.Add(explorerBarItemSizeInfo);
                ++this.expandedItemsCount;
            }
            return((PageViewItemSizeInfo)explorerBarItemSizeInfo);
        }
        public override PageViewItemSizeInfo CreateItemSizeInfo(RadPageViewItem item)
        {
            RadPageViewExplorerBarItem explorerBarItem = item as RadPageViewExplorerBarItem;
            bool isVertical     = this.GetIsVertical();
            bool isItemExpanded = explorerBarItem.IsExpanded;
            ExplorerBarItemSizeInfo sizeInfo = new ExplorerBarItemSizeInfo(explorerBarItem, isVertical, isItemExpanded);

            if (isItemExpanded)
            {
                this.ExpandedItems.Add(sizeInfo);
                this.expandedItemsCount++;
            }

            return(sizeInfo);
        }
        internal virtual float GetContentLength(ExplorerBarItemSizeInfo itemSizeInfo, float availableLength)
        {
            switch (this.ContentSizeMode)
            {
            case ExplorerBarContentSizeMode.FixedLength:
                return(itemSizeInfo.item.PageLength);

            case ExplorerBarContentSizeMode.AutoSizeToBestFit:

                if (Owner == null)
                {
                    switch (this.layoutInfo.position)
                    {
                    case StackViewPosition.Top:
                        return(itemSizeInfo.contentSize.Height);

                    case StackViewPosition.Left:
                        return(itemSizeInfo.contentSize.Width);
                    }
                }
                else
                {
                    Size contentMetrics = this.GetItemContentMetrics(itemSizeInfo);
                    switch (this.layoutInfo.position)
                    {
                    case StackViewPosition.Top:
                        return(contentMetrics.Height);

                    case StackViewPosition.Left:
                        return(contentMetrics.Width);
                    }
                }

                break;

            case ExplorerBarContentSizeMode.EqualLength:
                float itemLength = this.layoutInfo.layoutLength;
                ExplorerBarLayoutInfo explorerLayoutInfo = this.layoutInfo as ExplorerBarLayoutInfo;
                return((availableLength - itemLength) / explorerLayoutInfo.expandedItemsCount);
            }

            return(availableLength);
        }