public override void Update()
        {
            base.Update();

            this.selectionMode = (StackViewItemSelectionMode)this.itemLayout.GetValue(RadPageViewStackElement.ItemSelectionModeProperty);
            this.position      = (StackViewPosition)this.itemLayout.GetValue(RadPageViewStackElement.StackPositionProperty);
        }
        internal RectangleF GetContentWithSelectedContentRectangle(PageViewItemSizeInfo item, RectangleF clientRect)
        {
            PageViewItemSizeInfo selectedItem = item;

            if (selectedItem == null)
            {
                return(clientRect);
            }
            RectangleF contentRectangle = Rectangle.Empty;
            SizeF      contentAreaSize  = this.GetContentSizeForItem(item, clientRect);//this.GetAvailableSizeForContent(clientRect);

            StackViewPosition position = this.layoutInfo.position;

            switch (position)
            {
            case StackViewPosition.Bottom:
                contentRectangle = this.GetTopBottomContentWithSelectedRectangle(false, selectedItem, contentAreaSize, clientRect);
                break;

            case StackViewPosition.Top:
                contentRectangle = this.GetTopBottomContentWithSelectedRectangle(true, selectedItem, contentAreaSize, clientRect);
                break;

            case StackViewPosition.Right:
                contentRectangle = this.GetLeftRightContentWithSelectedRectangle(false, selectedItem, contentAreaSize, clientRect);
                break;

            case StackViewPosition.Left:
                contentRectangle = this.GetLeftRightContentWithSelectedRectangle(true, selectedItem, contentAreaSize, clientRect);
                break;
            }
            return(contentRectangle);
        }
        public override bool GetIsVertical()
        {
            RadPageViewStackElement stackElement  = this.itemLayout as RadPageViewStackElement;
            StackViewPosition       stackPosition = stackElement.StackPosition;

            return(stackPosition == StackViewPosition.Top || stackPosition == StackViewPosition.Bottom);
        }
Exemple #4
0
        public override bool GetIsVertical()
        {
            StackViewPosition stackPosition = (this.itemLayout as RadPageViewStackElement).StackPosition;

            if (stackPosition != StackViewPosition.Top)
            {
                return(stackPosition == StackViewPosition.Bottom);
            }
            return(true);
        }
        private void SetInitialScrollbarParameters(StackViewPosition stackPosition)
        {
            bool isTopBottom = stackPosition == StackViewPosition.Top ||
                               stackPosition == StackViewPosition.Bottom;

            this.scrollbar.ScrollType = isTopBottom ? ScrollType.Vertical : ScrollType.Horizontal;
            this.scrollbar.Visibility = ElementVisibility.Visible;

            this.ResetLayoutOffset(true);
            this.InvalidateMeasure();
        }
        protected override SizeF MeasureItems(SizeF availableSize)
        {
            SizeF desiredSize = SizeF.Empty;

            this.layoutInfo = this.CreateLayoutInfo(availableSize);
            StackViewPosition stackPosition = this.layoutInfo.position;

            switch (stackPosition)
            {
            case StackViewPosition.Bottom:
            case StackViewPosition.Top:
                this.ApplyItemMetricsHorizontal();
                break;

            case StackViewPosition.Left:
            case StackViewPosition.Right:
                this.ApplyItemMetricsVertical();
                break;
            }

            this.MeasureItemsCore();

            if (stackPosition == StackViewPosition.Top || stackPosition == StackViewPosition.Bottom)
            {
                availableSize.Height -= layoutInfo.layoutLength;
                desiredSize.Height    = layoutInfo.layoutLength;
                desiredSize.Width     = layoutInfo.maxWidth;
            }
            else
            {
                availableSize.Width -= layoutInfo.layoutLength;
                desiredSize.Width    = layoutInfo.layoutLength;
                desiredSize.Height   = layoutInfo.maxHeight;
            }

            SizeF contentAreaDesiredSize = MeasureContentArea(ref availableSize);

            if (stackPosition == StackViewPosition.Top || stackPosition == StackViewPosition.Bottom)
            {
                desiredSize.Height += contentAreaDesiredSize.Height;
                desiredSize.Width   = Math.Max(desiredSize.Width, contentAreaDesiredSize.Width);
            }
            else
            {
                desiredSize.Width += contentAreaDesiredSize.Width;
                desiredSize.Height = Math.Max(desiredSize.Height, contentAreaDesiredSize.Height);
            }

            return(desiredSize);
        }
        protected internal override bool IsPreviousKey(System.Windows.Forms.Keys key)
        {
            StackViewPosition position = this.layoutInfo.position;

            switch (position)
            {
            case StackViewPosition.Top:
                return(key == System.Windows.Forms.Keys.Down);

            case StackViewPosition.Left:
                return(key == System.Windows.Forms.Keys.Right);
            }
            return(base.IsPreviousKey(key));
        }
        private void MeasureItemsCore()
        {
            StackViewPosition position = this.layoutInfo.position;
            int integralItemSpacing    = this.layoutInfo.itemSpacing * (this.layoutInfo.itemCount - 1);

            this.layoutInfo.layoutLength += integralItemSpacing;
            foreach (PageViewItemSizeInfo info in this.layoutInfo.items)
            {
                System.Windows.Forms.Padding itemMargin = this.GetItemMargin(info);
                if (info.layoutSize != info.desiredSize)
                {
                    SizeF availableSize = info.layoutSize;
                    info.item.Measure(availableSize);
                    if (this.Owner == null)
                    {
                        SizeF desiredSize = info.item.DesiredSize;
                        if ((position == StackViewPosition.Top || position == StackViewPosition.Bottom) &&
                            info.item.StretchHorizontally && !float.IsInfinity(info.layoutSize.Width))
                        {
                            desiredSize.Width = info.layoutSize.Width;
                        }
                        if ((position == StackViewPosition.Left || position == StackViewPosition.Right) &&
                            info.item.StretchVertically && !float.IsInfinity(info.layoutSize.Height))
                        {
                            desiredSize.Height = info.layoutSize.Height;
                        }
                        info.desiredSize = desiredSize;
                    }
                    else
                    {
                        info.desiredSize = info.layoutSize;
                    }
                }

                switch (position)
                {
                case StackViewPosition.Top:
                case StackViewPosition.Bottom:
                    this.layoutInfo.layoutLength += (info.desiredSize.Height + itemMargin.Vertical);
                    break;

                case StackViewPosition.Left:
                case StackViewPosition.Right:
                    this.layoutInfo.layoutLength += (info.desiredSize.Width + itemMargin.Horizontal);
                    break;
                }
            }
        }
        protected internal override PageViewContentOrientation GetAutomaticItemOrientation(bool content)
        {
            StackViewPosition stackPosition = this.StackPosition;

            switch (stackPosition)
            {
            case StackViewPosition.Left:
                return(PageViewContentOrientation.Vertical270);

            case StackViewPosition.Right:
                return(PageViewContentOrientation.Vertical90);

            default:
                return(PageViewContentOrientation.Horizontal);
            }
        }
Exemple #10
0
        private void MeasureItemsCore()
        {
            StackViewPosition position = this.layoutInfo.position;

            this.layoutInfo.layoutLength += (float)(this.layoutInfo.itemSpacing * (this.layoutInfo.itemCount - 1));
            foreach (PageViewItemSizeInfo viewItemSizeInfo in this.layoutInfo.items)
            {
                Padding itemMargin = this.GetItemMargin(viewItemSizeInfo);
                if (viewItemSizeInfo.layoutSize != viewItemSizeInfo.desiredSize)
                {
                    SizeF layoutSize = viewItemSizeInfo.layoutSize;
                    viewItemSizeInfo.item.Measure(layoutSize);
                    if (this.Owner == null)
                    {
                        SizeF desiredSize = viewItemSizeInfo.item.DesiredSize;
                        if ((position == StackViewPosition.Top || position == StackViewPosition.Bottom) && (viewItemSizeInfo.item.StretchHorizontally && !float.IsInfinity(viewItemSizeInfo.layoutSize.Width)))
                        {
                            desiredSize.Width = viewItemSizeInfo.layoutSize.Width;
                        }
                        if ((position == StackViewPosition.Left || position == StackViewPosition.Right) && (viewItemSizeInfo.item.StretchVertically && !float.IsInfinity(viewItemSizeInfo.layoutSize.Height)))
                        {
                            desiredSize.Height = viewItemSizeInfo.layoutSize.Height;
                        }
                        viewItemSizeInfo.desiredSize = desiredSize;
                    }
                    else
                    {
                        viewItemSizeInfo.desiredSize = viewItemSizeInfo.layoutSize;
                    }
                }
                switch (position)
                {
                case StackViewPosition.Left:
                case StackViewPosition.Right:
                    this.layoutInfo.layoutLength += viewItemSizeInfo.desiredSize.Width + (float)itemMargin.Horizontal;
                    continue;

                case StackViewPosition.Top:
                case StackViewPosition.Bottom:
                    this.layoutInfo.layoutLength += viewItemSizeInfo.desiredSize.Height + (float)itemMargin.Vertical;
                    continue;

                default:
                    continue;
                }
            }
        }
Exemple #11
0
        protected override SizeF MeasureItems(SizeF availableSize)
        {
            SizeF empty = SizeF.Empty;

            this.layoutInfo = this.CreateLayoutInfo(availableSize);
            StackViewPosition position = this.layoutInfo.position;

            switch (position)
            {
            case StackViewPosition.Left:
            case StackViewPosition.Right:
                this.ApplyItemMetricsVertical();
                break;

            case StackViewPosition.Top:
            case StackViewPosition.Bottom:
                this.ApplyItemMetricsHorizontal();
                break;
            }
            this.MeasureItemsCore();
            if (position == StackViewPosition.Top || position == StackViewPosition.Bottom)
            {
                availableSize.Height -= this.layoutInfo.layoutLength;
                empty.Height          = this.layoutInfo.layoutLength;
                empty.Width           = this.layoutInfo.maxWidth;
            }
            else
            {
                availableSize.Width -= this.layoutInfo.layoutLength;
                empty.Width          = this.layoutInfo.layoutLength;
                empty.Height         = this.layoutInfo.maxHeight;
            }
            SizeF sizeF = this.MeasureContentArea(ref availableSize);

            if (position == StackViewPosition.Top || position == StackViewPosition.Bottom)
            {
                empty.Height += sizeF.Height;
                empty.Width   = Math.Max(empty.Width, sizeF.Width);
            }
            else
            {
                empty.Width += sizeF.Width;
                empty.Height = Math.Max(empty.Height, sizeF.Height);
            }
            return(empty);
        }
        private PointF GetItemLocation(ref float currentItemOffset, PageViewItemSizeInfo item, RectangleF clientRect)
        {
            PointF itemLocation = PointF.Empty;

            System.Windows.Forms.Padding itemMargin = this.GetItemMargin(item);
            SizeF             itemSize = item.desiredSize;
            StackViewPosition position = this.layoutInfo.position;

            switch (position)
            {
            case StackViewPosition.Bottom:
                currentItemOffset += itemSize.Height + itemMargin.Bottom;
                itemLocation       = new PointF(
                    clientRect.X + itemMargin.Left,
                    clientRect.Bottom - currentItemOffset);
                currentItemOffset += itemMargin.Top;
                break;

            case StackViewPosition.Left:
                currentItemOffset += itemMargin.Left;
                itemLocation       = new PointF(
                    clientRect.X + currentItemOffset,
                    clientRect.Y + (this.Owner == null ? 0 : itemMargin.Top));
                currentItemOffset += itemMargin.Right + itemSize.Width;
                break;

            case StackViewPosition.Top:
                currentItemOffset += itemMargin.Top;
                itemLocation       = new PointF(
                    clientRect.X + itemMargin.Left,
                    clientRect.Y + currentItemOffset);
                currentItemOffset += itemSize.Height + itemMargin.Bottom;
                break;

            case StackViewPosition.Right:
                currentItemOffset += itemSize.Width + itemMargin.Right;
                itemLocation       = new PointF(
                    clientRect.Right - currentItemOffset,
                    clientRect.Y + (this.Owner == null ? 0 : itemMargin.Top));
                currentItemOffset += itemMargin.Left;
                break;
            }

            return(itemLocation);
        }
Exemple #13
0
        internal Padding GetItemMargin(RadPageViewStackItem item)
        {
            StackViewPosition position = this.layoutInfo.position;
            Padding           margin   = item.Margin;

            if (!item.AutoFlipMargin)
            {
                return(margin);
            }
            switch (position)
            {
            case StackViewPosition.Left:
                return(new Padding(margin.Top, margin.Right, margin.Bottom, margin.Left));

            case StackViewPosition.Right:
                return(new Padding(margin.Bottom, margin.Left, margin.Top, margin.Right));

            default:
                return(margin);
            }
        }
        internal System.Windows.Forms.Padding GetItemMargin(RadPageViewStackItem item)
        {
            StackViewPosition position = this.layoutInfo.position;

            System.Windows.Forms.Padding itemMargin = item.Margin;

            if (!item.AutoFlipMargin)
            {
                return(itemMargin);
            }

            switch (position)
            {
            case StackViewPosition.Left:
                return(new System.Windows.Forms.Padding(itemMargin.Top, itemMargin.Right, itemMargin.Bottom, itemMargin.Left));

            case StackViewPosition.Right:
                return(new System.Windows.Forms.Padding(itemMargin.Bottom, itemMargin.Left, itemMargin.Top, itemMargin.Right));

            default:
                return(itemMargin);
            }
        }
        private RectangleF GetStandardContentRectangle(PageViewItemSizeInfo item, RectangleF clientRect)
        {
            RectangleF contentRectangle = Rectangle.Empty;

            SizeF             contentAreaSize = this.GetContentSizeForItem(item, clientRect);
            float             itemsLength     = this.layoutInfo.layoutLength;
            StackViewPosition position        = this.layoutInfo.position;

            switch (position)
            {
            case StackViewPosition.Bottom:
            case StackViewPosition.Right:
                contentRectangle = new RectangleF(
                    clientRect.X,
                    clientRect.Y,
                    contentAreaSize.Width,
                    contentAreaSize.Height);
                break;

            case StackViewPosition.Top:
                contentRectangle = new RectangleF(
                    clientRect.X,
                    clientRect.Y + itemsLength,
                    contentAreaSize.Width,
                    contentAreaSize.Height);
                break;

            case StackViewPosition.Left:
                contentRectangle = new RectangleF(
                    clientRect.X + itemsLength,
                    clientRect.Y,
                    contentAreaSize.Width,
                    contentAreaSize.Height);
                break;
            }
            return(contentRectangle);
        }