Esempio n. 1
0
        private SizeF ArrangeItem(
            RadPageViewItem item,
            RectangleF clientRect,
            RectangleF clientNoOffset,
            PointF currentLocation)
        {
            SizeF size = item.ForcedLayoutSize;

            if ((this.layoutInfo.fitMode & StripViewItemFitMode.FillHeight) != StripViewItemFitMode.None)
            {
                switch (this.layoutInfo.align)
                {
                case StripViewAlignment.Top:
                case StripViewAlignment.Bottom:
                    size = new SizeF(size.Width, clientRect.Height);
                    break;

                case StripViewAlignment.Right:
                case StripViewAlignment.Left:
                    size = new SizeF(clientRect.Width, size.Height);
                    break;
                }
            }
            Padding margin   = item.Margin;
            PointF  location = PointF.Empty;
            SizeF   empty    = SizeF.Empty;

            switch (this.layoutInfo.align)
            {
            case StripViewAlignment.Top:
                location     = new PointF(currentLocation.X + (float)margin.Left, clientRect.Bottom - size.Height - (float)margin.Vertical);
                empty.Width += size.Width + (float)margin.Horizontal + (float)this.layoutInfo.itemSpacing;
                break;

            case StripViewAlignment.Right:
                location      = new PointF(clientRect.X + (float)margin.Left, currentLocation.Y + (float)margin.Top);
                empty.Height += size.Height + (float)margin.Vertical + (float)this.layoutInfo.itemSpacing;
                break;

            case StripViewAlignment.Bottom:
                location     = new PointF(currentLocation.X + (float)margin.Left, clientRect.Y + (float)margin.Top);
                empty.Width += size.Width + (float)margin.Horizontal + (float)this.layoutInfo.itemSpacing;
                break;

            case StripViewAlignment.Left:
                location      = new PointF(clientRect.Right - size.Width - (float)margin.Horizontal, currentLocation.Y + (float)margin.Top);
                empty.Height += size.Height + (float)margin.Vertical + (float)this.layoutInfo.itemSpacing;
                break;
            }
            RectangleF rectangleF = new RectangleF(location, size);

            if (this.RightToLeft && (this.layoutInfo.align == StripViewAlignment.Top || this.layoutInfo.align == StripViewAlignment.Bottom))
            {
                rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, item.IsPinned ? clientNoOffset : clientRect);
            }
            item.Arrange(rectangleF);
            return(empty);
        }
Esempio n. 2
0
        private void ArrangePreviewItem(RectangleF client, RectangleF clientNoOffset)
        {
            foreach (RadElement child in this.Children)
            {
                RadPageViewItem radPageViewItem = child as RadPageViewItem;
                if (radPageViewItem != null && radPageViewItem.Visibility != ElementVisibility.Collapsed && radPageViewItem.IsPreview)
                {
                    SizeF size = radPageViewItem.ForcedLayoutSize;
                    if ((this.layoutInfo.fitMode & StripViewItemFitMode.FillHeight) != StripViewItemFitMode.None)
                    {
                        switch (this.layoutInfo.align)
                        {
                        case StripViewAlignment.Top:
                        case StripViewAlignment.Bottom:
                            size = new SizeF(size.Width, client.Height);
                            break;

                        case StripViewAlignment.Right:
                        case StripViewAlignment.Left:
                            size = new SizeF(client.Width, size.Height);
                            break;
                        }
                    }
                    Padding margin   = radPageViewItem.Margin;
                    PointF  location = PointF.Empty;
                    switch (this.layoutInfo.align)
                    {
                    case StripViewAlignment.Top:
                        location = new PointF(clientNoOffset.Right - size.Width - (float)margin.Left, client.Bottom - size.Height - (float)margin.Vertical);
                        break;

                    case StripViewAlignment.Right:
                        location = new PointF(client.X + (float)margin.Left, clientNoOffset.Bottom - size.Height - (float)margin.Bottom);
                        break;

                    case StripViewAlignment.Bottom:
                        location = new PointF(clientNoOffset.Right - size.Width - (float)margin.Left, client.Y + (float)margin.Top);
                        break;

                    case StripViewAlignment.Left:
                        location = new PointF(client.Right - size.Width - (float)margin.Horizontal, clientNoOffset.Bottom - size.Height - (float)margin.Bottom);
                        break;
                    }
                    RectangleF rectangleF = new RectangleF(location, size);
                    if (this.RightToLeft && (this.layoutInfo.align == StripViewAlignment.Top || this.layoutInfo.align == StripViewAlignment.Bottom))
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, clientNoOffset);
                    }
                    radPageViewItem.Arrange(rectangleF);
                    this.layoutInfo.previewItemSize = size;
                }
            }
        }
Esempio n. 3
0
        private void ArrangeItemsMultiLine(RectangleF client)
        {
            PointF location = (PointF)Point.Empty;
            SortedDictionary <int, float> sortedDictionary1 = new SortedDictionary <int, float>();

            foreach (RadElement child in this.Children)
            {
                RadPageViewItem radPageViewItem = child as RadPageViewItem;
                if (radPageViewItem != null && !sortedDictionary1.ContainsKey(radPageViewItem.Row))
                {
                    sortedDictionary1.Add(radPageViewItem.Row, 0.0f);
                }
            }
            foreach (RadElement child in this.Children)
            {
                RadPageViewItem radPageViewItem = child as RadPageViewItem;
                if (radPageViewItem != null && radPageViewItem.Visibility != ElementVisibility.Collapsed)
                {
                    SizeF size = radPageViewItem.ForcedLayoutSize;
                    if ((this.layoutInfo.fitMode & StripViewItemFitMode.FillHeight) != StripViewItemFitMode.None)
                    {
                        switch (this.layoutInfo.align)
                        {
                        case StripViewAlignment.Top:
                        case StripViewAlignment.Bottom:
                            size = new SizeF(size.Width, size.Height);
                            break;

                        case StripViewAlignment.Right:
                        case StripViewAlignment.Left:
                            size = new SizeF(size.Width, size.Height);
                            break;
                        }
                    }
                    Padding margin = radPageViewItem.Margin;
                    switch (this.layoutInfo.align)
                    {
                    case StripViewAlignment.Top:
                        if (radPageViewItem.Row == 0 || radPageViewItem.Row == -1)
                        {
                            location = new PointF(sortedDictionary1[radPageViewItem.Row], client.Bottom - size.Height - (float)margin.Vertical);
                            SortedDictionary <int, float> sortedDictionary2;
                            int row;
                            (sortedDictionary2 = sortedDictionary1)[row = radPageViewItem.Row] = sortedDictionary2[row] + (size.Width + (float)margin.Horizontal + (float)this.layoutInfo.itemSpacing);
                            break;
                        }
                        float num1 = 0.0f;
                        for (int key = radPageViewItem.Row - 1; key >= -1; --key)
                        {
                            if (this.rowsSize.ContainsKey(key))
                            {
                                num1 += this.rowsSize[key].Height;
                            }
                        }
                        location = new PointF(sortedDictionary1[radPageViewItem.Row], Math.Max(0.0f, client.Bottom - num1 - radPageViewItem.DesiredSize.Height - (float)margin.Vertical));
                        SortedDictionary <int, float> sortedDictionary3;
                        int row1;
                        (sortedDictionary3 = sortedDictionary1)[row1 = radPageViewItem.Row] = sortedDictionary3[row1] + (size.Width + (float)margin.Horizontal + (float)this.layoutInfo.itemSpacing);
                        break;

                    case StripViewAlignment.Right:
                        if (radPageViewItem.Row == 0 || radPageViewItem.Row == -1)
                        {
                            location = new PointF(0.0f, sortedDictionary1[radPageViewItem.Row] + (float)margin.Vertical);
                            SortedDictionary <int, float> sortedDictionary2;
                            int row2;
                            (sortedDictionary2 = sortedDictionary1)[row2 = radPageViewItem.Row] = sortedDictionary2[row2] + (size.Height + (float)margin.Vertical + (float)this.layoutInfo.itemSpacing);
                            break;
                        }
                        float x = 0.0f;
                        for (int key = radPageViewItem.Row - 1; key >= -1; --key)
                        {
                            if (this.rowsSize.ContainsKey(key))
                            {
                                x += this.rowsSize[key].Width;
                            }
                        }
                        location = new PointF(x, sortedDictionary1[radPageViewItem.Row] + (float)margin.Vertical);
                        SortedDictionary <int, float> sortedDictionary4;
                        int row3;
                        (sortedDictionary4 = sortedDictionary1)[row3 = radPageViewItem.Row] = sortedDictionary4[row3] + (size.Height + (float)margin.Vertical + (float)this.layoutInfo.itemSpacing);
                        break;

                    case StripViewAlignment.Bottom:
                        if (radPageViewItem.Row == 0 || radPageViewItem.Row == -1)
                        {
                            location = new PointF(sortedDictionary1[radPageViewItem.Row], client.Top + (float)margin.Vertical);
                            SortedDictionary <int, float> sortedDictionary2;
                            int row2;
                            (sortedDictionary2 = sortedDictionary1)[row2 = radPageViewItem.Row] = sortedDictionary2[row2] + (size.Width + (float)margin.Horizontal + (float)this.layoutInfo.itemSpacing);
                            break;
                        }
                        float num2 = 0.0f;
                        for (int key = radPageViewItem.Row - 1; key >= -1; --key)
                        {
                            if (this.rowsSize.ContainsKey(key))
                            {
                                num2 += this.rowsSize[key].Height;
                            }
                        }
                        location = new PointF(sortedDictionary1[radPageViewItem.Row], Math.Max(0.0f, client.Top + num2 + (float)margin.Vertical));
                        SortedDictionary <int, float> sortedDictionary5;
                        int row4;
                        (sortedDictionary5 = sortedDictionary1)[row4 = radPageViewItem.Row] = sortedDictionary5[row4] + (size.Width + (float)margin.Horizontal + (float)this.layoutInfo.itemSpacing);
                        break;

                    case StripViewAlignment.Left:
                        if (radPageViewItem.Row == 0 || radPageViewItem.Row == -1)
                        {
                            location = new PointF(client.Right - size.Width - (float)margin.Horizontal, sortedDictionary1[radPageViewItem.Row] + (float)margin.Vertical);
                            SortedDictionary <int, float> sortedDictionary2;
                            int row2;
                            (sortedDictionary2 = sortedDictionary1)[row2 = radPageViewItem.Row] = sortedDictionary2[row2] + (size.Height + (float)margin.Vertical + (float)this.layoutInfo.itemSpacing);
                            break;
                        }
                        float num3 = 0.0f;
                        for (int key = radPageViewItem.Row - 1; key >= -1; --key)
                        {
                            if (this.rowsSize.ContainsKey(key))
                            {
                                num3 += this.rowsSize[key].Width;
                            }
                        }
                        location = new PointF(client.Right - size.Width - (float)margin.Horizontal - num3, sortedDictionary1[radPageViewItem.Row] + (float)margin.Vertical);
                        SortedDictionary <int, float> sortedDictionary6;
                        int row5;
                        (sortedDictionary6 = sortedDictionary1)[row5 = radPageViewItem.Row] = sortedDictionary6[row5] + (size.Height + (float)margin.Vertical + (float)this.layoutInfo.itemSpacing);
                        break;
                    }
                    RectangleF rectangleF = new RectangleF(location, size);
                    if (this.RightToLeft && (this.layoutInfo.align == StripViewAlignment.Top || this.layoutInfo.align == StripViewAlignment.Bottom))
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, client);
                    }
                    radPageViewItem.Arrange(rectangleF);
                }
            }
        }