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 RectangleF GetContentWithSelectedContentRectangle( PageViewItemSizeInfo item, RectangleF clientRect) { PageViewItemSizeInfo selectedItem = item; if (selectedItem == null) { return(clientRect); } RectangleF rectangleF = (RectangleF)Rectangle.Empty; SizeF contentSizeForItem = this.GetContentSizeForItem(item, clientRect); switch (this.layoutInfo.position) { case StackViewPosition.Left: rectangleF = this.GetLeftRightContentWithSelectedRectangle(true, selectedItem, contentSizeForItem, clientRect); break; case StackViewPosition.Top: rectangleF = this.GetTopBottomContentWithSelectedRectangle(true, selectedItem, contentSizeForItem, clientRect); break; case StackViewPosition.Right: rectangleF = this.GetLeftRightContentWithSelectedRectangle(false, selectedItem, contentSizeForItem, clientRect); break; case StackViewPosition.Bottom: rectangleF = this.GetTopBottomContentWithSelectedRectangle(false, selectedItem, contentSizeForItem, clientRect); break; } return(rectangleF); }
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); }
protected virtual RectangleF GetContentAreaRectangle(RectangleF clientRect) { RectangleF empty = (RectangleF)Rectangle.Empty; PageViewItemSizeInfo selectedItem = this.layoutInfo.selectedItem; return(this.layoutInfo.selectionMode == StackViewItemSelectionMode.Standard ? this.GetStandardContentRectangle(selectedItem, clientRect) : this.GetContentWithSelectedContentRectangle(selectedItem, clientRect)); }
private RectangleF GetStandardContentRectangle( PageViewItemSizeInfo item, RectangleF clientRect) { RectangleF rectangleF = (RectangleF)Rectangle.Empty; SizeF contentSizeForItem = this.GetContentSizeForItem(item, clientRect); float layoutLength = this.layoutInfo.layoutLength; switch (this.layoutInfo.position) { case StackViewPosition.Left: rectangleF = new RectangleF(clientRect.X + layoutLength, clientRect.Y, contentSizeForItem.Width, contentSizeForItem.Height); break; case StackViewPosition.Top: rectangleF = new RectangleF(clientRect.X, clientRect.Y + layoutLength, contentSizeForItem.Width, contentSizeForItem.Height); break; case StackViewPosition.Right: case StackViewPosition.Bottom: rectangleF = new RectangleF(clientRect.X, clientRect.Y, contentSizeForItem.Width, contentSizeForItem.Height); break; } return(rectangleF); }
private RectangleF GetTopBottomContentWithSelectedRectangle(bool isTop, PageViewItemSizeInfo selectedItem, SizeF contentAreaSize, RectangleF clientRect) { RectangleF selectedItemRect = selectedItem.itemRectangle; if (!isTop && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentWithSelected || (isTop && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected)) { return(new RectangleF( clientRect.Left, selectedItemRect.Bottom + selectedItem.item.Margin.Bottom, contentAreaSize.Width, contentAreaSize.Height)); } else if ((!isTop && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected) || (isTop && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentWithSelected)) { return(new RectangleF( clientRect.Left, selectedItemRect.Top - selectedItem.item.Margin.Top - contentAreaSize.Height, contentAreaSize.Width, contentAreaSize.Height)); } return(Rectangle.Empty); }
public virtual void Update() { this.sizeMode = (PageViewItemSizeMode) this.itemLayout.GetValue(RadPageViewElement.ItemSizeModeProperty); this.contentOrientation = (PageViewContentOrientation) this.itemLayout.GetValue(RadPageViewElement.ItemContentOrientationProperty); this.itemSpacing = (int) this.itemLayout.GetValue(RadPageViewElement.ItemSpacingProperty); this.vertical = this.GetIsVertical(); this.availableLength = this.vertical ? this.availableSize.Height : this.availableSize.Width; this.paddingLength = this.vertical ? (float) this.itemLayout.Padding.Vertical : (float) this.itemLayout.Padding.Horizontal; Padding borderThickness = LightVisualElement.GetBorderThickness(this.itemLayout, true); this.borderLength = this.vertical ? (float) borderThickness.Vertical : (float) borderThickness.Horizontal; int num = 0; foreach (RadElement child in this.itemLayout.Children) { RadPageViewItem radPageViewItem = child as RadPageViewItem; if (radPageViewItem != null && radPageViewItem.Visibility != ElementVisibility.Collapsed) { radPageViewItem.Measure(this.GetMeasureSizeConstraint((RadItem) radPageViewItem)); PageViewItemSizeInfo itemSizeInfo = this.CreateItemSizeInfo(radPageViewItem); itemSizeInfo.desiredSize = new SizeF(radPageViewItem.DesiredSize.Width, radPageViewItem.DesiredSize.Height); this.maxWidth = Math.Max(itemSizeInfo.desiredSize.Width, this.maxWidth); this.maxHeight = Math.Max(itemSizeInfo.desiredSize.Height, this.maxHeight); this.items.Add(itemSizeInfo); itemSizeInfo.itemIndex = num++; } } this.itemCount = this.items.Count; }
private RectangleF GetLeftRightContentWithSelectedRectangle(bool isLeft, PageViewItemSizeInfo selectedItem, SizeF contentAreaSize, RectangleF clientRect) { RectangleF selectedItemRect = selectedItem.itemRectangle; if ((!isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentWithSelected) || (isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected)) { return(new RectangleF( selectedItemRect.Right + selectedItem.item.Margin.Right, clientRect.Y, contentAreaSize.Width, contentAreaSize.Height)); } else if ((!isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected) || (isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentWithSelected)) { return(new RectangleF( (selectedItemRect.Left - selectedItem.item.Margin.Left) - contentAreaSize.Width, clientRect.Y, contentAreaSize.Width, contentAreaSize.Height)); } return(Rectangle.Empty); }
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); }
private void ExpandItem(PageViewItemSizeInfo item, int expand) { SizeF newSize = !this.layoutInfo.vertical ? new SizeF(item.currentSize.Width + (float)expand, item.layoutSize.Height) : new SizeF(item.layoutSize.Width, item.currentSize.Height + (float)expand); item.SetCurrentSize(newSize); item.SetLayoutSize(newSize); this.shrinkInfo.shrinkAmount -= (float)expand; }
private float GetExpandDifference(int index) { PageViewItemSizeInfo viewItemSizeInfo = this.layoutInfo.items[index]; float num = viewItemSizeInfo.layoutLength - viewItemSizeInfo.currentLength; viewItemSizeInfo.SetLayoutSize(viewItemSizeInfo.currentSize); return(num); }
private void CollapseItem(PageViewItemSizeInfo item, int collapse) { int num = Math.Min((int)Math.Max(0.0f, item.layoutLength - item.minLength), collapse); SizeF newSize = !this.layoutInfo.vertical ? new SizeF(item.layoutSize.Width - (float)num, item.layoutSize.Height) : new SizeF(item.layoutSize.Width, item.layoutSize.Height - (float)num); item.SetLayoutSize(newSize); this.shrinkInfo.shrinkAmount -= (float)collapse; }
private float GetItemHeight(PageViewItemSizeInfo item) { float num1 = item.desiredSize.Height; float num2 = this.layoutInfo.availableSize.Height - (float)item.marginLength; if ((double)num1 > (double)num2) { num1 = num2; } return(num1); }
public override PageViewItemSizeInfo CreateItemSizeInfo(RadPageViewItem item) { RadPageViewItem selectedItem = (this.itemLayout as RadPageViewElement).SelectedItem; PageViewItemSizeInfo itemSizeInfo = base.CreateItemSizeInfo(item); if (object.ReferenceEquals((object)selectedItem, (object)item)) { this.selectedItem = itemSizeInfo; } return(itemSizeInfo); }
private float GetCollapseDifference(int index1, int index2) { PageViewItemSizeInfo item1 = this.layoutInfo.items[index1]; PageViewItemSizeInfo item2 = this.layoutInfo.items[index2]; float differ = item1.layoutLength - item2.layoutLength; Debug.Assert(differ >= 0, "Invalid collapse algorithm"); return(differ); }
private float GetExpandDifference(int index) { PageViewItemSizeInfo item = this.layoutInfo.items[index]; float differ = item.layoutLength - item.currentLength; Debug.Assert(differ >= 0, "Invalid expand algorithm"); item.SetLayoutSize(item.currentSize); return(differ); }
private float GetItemHeight(PageViewItemSizeInfo item) { float result = item.desiredSize.Height; SizeF availableSize = this.layoutInfo.availableSize; float availableHeight = availableSize.Height - item.marginLength; if (result > availableHeight) { result = availableHeight; } return(result); }
private float GetItemWidth(PageViewItemSizeInfo item) { float result = item.desiredSize.Width; SizeF availableSize = this.layoutInfo.availableSize; float availableWidth = availableSize.Width - item.marginLength; if (result > availableWidth) { result = availableWidth; } return(result); }
protected virtual RectangleF GetContentAreaRectangle(RectangleF clientRect) { RectangleF contentRectangle = Rectangle.Empty; PageViewItemSizeInfo selectedItem = this.layoutInfo.selectedItem; if (this.layoutInfo.selectionMode != StackViewItemSelectionMode.Standard) { contentRectangle = this.GetContentWithSelectedContentRectangle(selectedItem, clientRect); } else { contentRectangle = this.GetStandardContentRectangle(selectedItem, clientRect); } return(contentRectangle); }
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); }
private void ExpandItem(PageViewItemSizeInfo item, int expand) { SizeF expandSize; if (this.layoutInfo.vertical) { expandSize = new SizeF(item.layoutSize.Width, item.currentSize.Height + expand); } else { expandSize = new SizeF(item.currentSize.Width + expand, item.layoutSize.Height); } item.SetCurrentSize(expandSize); item.SetLayoutSize(expandSize); this.shrinkInfo.shrinkAmount -= expand; }
private RectangleF GetLeftRightContentWithSelectedRectangle( bool isLeft, PageViewItemSizeInfo selectedItem, SizeF contentAreaSize, RectangleF clientRect) { RectangleF itemRectangle = selectedItem.itemRectangle; if (!isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentWithSelected || isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected) { return(new RectangleF(itemRectangle.Right + (float)selectedItem.item.Margin.Right, clientRect.Y, contentAreaSize.Width, contentAreaSize.Height)); } if (!isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected || isLeft && this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentWithSelected) { return(new RectangleF(itemRectangle.Left - (float)selectedItem.item.Margin.Left - contentAreaSize.Width, clientRect.Y, contentAreaSize.Width, contentAreaSize.Height)); } return((RectangleF)Rectangle.Empty); }
public virtual void Update() { this.sizeMode = (PageViewItemSizeMode)this.itemLayout.GetValue(RadPageViewElement.ItemSizeModeProperty); this.contentOrientation = (PageViewContentOrientation)this.itemLayout.GetValue(RadPageViewElement.ItemContentOrientationProperty); this.itemSpacing = (int)this.itemLayout.GetValue(RadPageViewElement.ItemSpacingProperty); this.vertical = this.GetIsVertical(); this.availableLength = this.vertical ? this.availableSize.Height : this.availableSize.Width; this.paddingLength = this.vertical ? this.itemLayout.Padding.Vertical : this.itemLayout.Padding.Horizontal; Padding border = this.itemLayout.GetBorderThickness(true); this.borderLength = this.vertical ? border.Vertical : border.Horizontal; int itemIndexCounter = 0; foreach (RadElement element in this.itemLayout.Children) { RadPageViewItem item = element as RadPageViewItem; if (item == null) { continue; } if (item.Visibility == ElementVisibility.Collapsed) { continue; } //TODO: Optimization - cache desired size per item and measure only when a layout property is changed item.Measure(this.GetMeasureSizeConstraint(item)); PageViewItemSizeInfo itemSizeInfo = this.CreateItemSizeInfo(item); this.maxWidth = Math.Max(itemSizeInfo.desiredSize.Width, this.maxWidth); this.maxHeight = Math.Max(itemSizeInfo.desiredSize.Height, this.maxHeight); this.items.Add(itemSizeInfo); itemSizeInfo.itemIndex = itemIndexCounter++; } this.itemCount = this.items.Count; }
protected override RectangleF ArrangeItems(RectangleF clientRect) { float itemOffset = this.GetInitialItemsOffset(clientRect); PointF itemLocation = PointF.Empty; int itemSpacing = this.layoutInfo.itemSpacing; for (int i = this.layoutInfo.items.Count - 1; i > -1; i--) { PageViewItemSizeInfo sizeInfo = this.layoutInfo.items[i]; if (this.layoutInfo.selectionMode == StackViewItemSelectionMode.ContentAfterSelected) { itemLocation = this.GetItemLocation(ref itemOffset, sizeInfo, clientRect); itemOffset = this.GetItemOffset(clientRect, sizeInfo, itemOffset); } else { itemOffset = this.GetItemOffset(clientRect, sizeInfo, itemOffset); itemLocation = this.GetItemLocation(ref itemOffset, sizeInfo, clientRect); } itemOffset += itemSpacing; sizeInfo.itemRectangle = new RectangleF(itemLocation, sizeInfo.desiredSize); if (Owner == null) { if (StackPosition == StackViewPosition.Left) { sizeInfo.itemRectangle.Height = clientRect.Height; } if (StackPosition == StackViewPosition.Left || StackPosition == StackViewPosition.Right) { sizeInfo.itemRectangle.Height -= this.layoutInfo.items[i].marginLength * 2; } } sizeInfo.item.Arrange(sizeInfo.itemRectangle); } return(this.GetContentAreaRectangle(clientRect)); }
internal virtual float GetItemOffset( RectangleF clientRect, PageViewItemSizeInfo sizeInfo, float proposedOffset) { if (object.ReferenceEquals((object)sizeInfo, (object)this.layoutInfo.selectedItem) && this.layoutInfo.selectionMode != StackViewItemSelectionMode.Standard) { SizeF contentSizeForItem = this.GetContentSizeForItem(sizeInfo, clientRect); switch (this.layoutInfo.position) { case StackViewPosition.Top: case StackViewPosition.Bottom: proposedOffset += contentSizeForItem.Height; break; default: proposedOffset += contentSizeForItem.Width; break; } proposedOffset = this.CorrectOffsetBasedOnSelectionContext(proposedOffset); } return(proposedOffset); }
private void CollapseItem(PageViewItemSizeInfo item, int collapse) { float layoutLength = item.layoutLength; float minLength = item.minLength; int maxCollapse = (int)Math.Max(0, layoutLength - minLength); maxCollapse = Math.Min(maxCollapse, collapse); SizeF forcedSize; if (this.layoutInfo.vertical) { forcedSize = new SizeF(item.layoutSize.Width, item.layoutSize.Height - maxCollapse); } else { forcedSize = new SizeF(item.layoutSize.Width - maxCollapse, item.layoutSize.Height); } item.SetLayoutSize(forcedSize); this.shrinkInfo.shrinkAmount -= collapse; }
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); }
private PointF GetItemLocation( ref float currentItemOffset, PageViewItemSizeInfo item, RectangleF clientRect) { PointF pointF = PointF.Empty; Padding itemMargin = this.GetItemMargin(item); SizeF desiredSize = item.desiredSize; switch (this.layoutInfo.position) { case StackViewPosition.Left: currentItemOffset += (float)itemMargin.Left; pointF = new PointF(clientRect.X + currentItemOffset, clientRect.Y + (this.Owner == null ? 0.0f : (float)itemMargin.Top)); currentItemOffset += (float)itemMargin.Right + desiredSize.Width; break; case StackViewPosition.Top: currentItemOffset += (float)itemMargin.Top; pointF = new PointF(clientRect.X + (float)itemMargin.Left, clientRect.Y + currentItemOffset); currentItemOffset += desiredSize.Height + (float)itemMargin.Bottom; break; case StackViewPosition.Right: currentItemOffset += desiredSize.Width + (float)itemMargin.Right; pointF = new PointF(clientRect.Right - currentItemOffset, clientRect.Y + (this.Owner == null ? 0.0f : (float)itemMargin.Top)); currentItemOffset += (float)itemMargin.Left; break; case StackViewPosition.Bottom: currentItemOffset += desiredSize.Height + (float)itemMargin.Bottom; pointF = new PointF(clientRect.X + (float)itemMargin.Left, clientRect.Bottom - currentItemOffset); currentItemOffset += (float)itemMargin.Top; break; } return(pointF); }
internal virtual SizeF GetContentSizeForItem(PageViewItemSizeInfo sizeInfo, RectangleF clientRect) { return(this.GetAvailableSizeForContent(clientRect)); }
internal System.Windows.Forms.Padding GetItemMargin(PageViewItemSizeInfo item) { return(this.GetItemMargin(item.item as RadPageViewStackItem)); }