protected virtual ValueSize SetChildSize(IVisualElement child, RenderRectangle current) { ElementsRendered[child] = new ValueRenderRectangle(current); return(ValueSize.Empty); }
public ValueRenderRectangle PushContentBounds(ValueRenderRectangle bounds) { var location = CurrentElementRect.Location; bounds = new ValueRenderRectangle(bounds.X + location.X, bounds.Y + location.Y, bounds.Width, bounds.Height, bounds.Offset); PushRect(bounds); return(bounds); }
public override void Arrange <TRenderSize>(TRenderSize availableSpace, IRenderContext renderContext) { // SCROLL PANEL var tabPageRect = new ValueRenderRectangle( tabsLeft, 0, availableSpace.Width, availableSpace.Height, availableSpace.Offset); //new ValuePoint2D(0, 0)); //renderContext.DrawElement(_scrollPanel, tabPageRect); // BOTTOM SEPARATOR var separatorRect = new ValueRenderRectangle( /* X */ tabsLeft, /* Y */ _tabsUsed.Height, //+ SEPARATOR_GAP_TOP, /* W */ _tabsUsed.Width, /* H */ SEPARATOR_LINE_HEIGHT, availableSpace.Offset); //renderContext.DrawElement(_separator, separatorRect); // INDICATOR if (_indicatorRect.IsEmpty) { if (_itemsControl.SelectedTab != null) { if (MoveIndicatorRect()) { InvalidateMeasure(); } } } else { var indicatorOffset = new ValuePoint2D(availableSpace.Offset.X + _scrollPanel.HorizontalOffset, availableSpace.Offset.Y); var indicatorRect = new ValueRenderRectangle( 0 - _scrollPanel.HorizontalOffset, availableSpace.Height - (/*SEPARATOR_GAP_BOTTOM +*/ INDICATOR_LINE_HEIGHT), _indicatord, indicatorOffset); renderContext.DrawElement(_indicator, indicatorRect); } renderContext.DrawElement(_separator, separatorRect); renderContext.DrawElement(_scrollPanel, tabPageRect); }
public override void Arrange <TRenderSize>(TRenderSize availableSpace, IRenderContext renderContext) { var h = availableSpace.Height * 0.7; var center = new ValuePoint2D(0, h); if (Brush is { } brush) { renderContext.FillPie(center, h, 0, -90, brush); } var rect = new ValueRenderRectangle(_offsetX, 0, availableSpace.Width - _offsetX, h, Point2D.Empty); renderContext.DrawElement(_label, rect); }
protected override ValueRenderRectangle GetElementBounds(IVisualElement child, ValueRenderRectangle precedingVisualBounds) { return(new(_lastOrientation == Orientations.Vertical // X ? precedingVisualBounds.Left : precedingVisualBounds.Right, _lastOrientation == Orientations.Vertical // Y ? precedingVisualBounds.Bottom : precedingVisualBounds.Top, _maxWidth, _maxHeight, ValuePoint2D.Empty)); }
public override void Arrange <TRenderSize>(TRenderSize availableSpace, IRenderContext renderContext) { if (_totalWidthMeasured.IsZero()) { return; } var widthRatio = availableSpace.Width / _totalWidthMeasured; lock (_cellLock) { var totalHeight = 0.0; for (var r = 0; r < _rowHeights.Count; r++) { totalHeight += _rowHeights[r]; } if (totalHeight.IsZero()) { return; } var x = 0.0; for (var col = 0; col < _columnWidths.Count; col++) { var renderer = _columnIndexRenderers[col]; var width = _columnWidths[col] * widthRatio; var colBounds = new ValueRenderRectangle(x, 0, width, availableSpace.Height, new Point2D(availableSpace.Offset.X + x, availableSpace.Offset.Y)); renderer.Arrange(Orientations.Vertical, colBounds, renderContext); x += colBounds.Width; } } }
protected override ValueRenderRectangle GetElementBounds(IVisualElement child, ValueRenderRectangle precedingVisualBounds) { var useY = _currentY; var topGap = 0.0; var consider = base.GetElementBounds(child, precedingVisualBounds); var currentRowHeight = _rowHeights[_currentRow]; switch (child.VerticalAlignment) { case VerticalAlignments.Top: case VerticalAlignments.Stretch: break; case VerticalAlignments.Bottom: topGap = currentRowHeight - consider.Height; break; case VerticalAlignments.Center: case VerticalAlignments.Default: topGap = (currentRowHeight - consider.Height) / 2; break; default: throw new ArgumentOutOfRangeException(); } var useHeight = currentRowHeight - topGap; useY += topGap; _currentRow++; _currentY += currentRowHeight; return(new ValueRenderRectangle(consider.X, useY, new ValueSize(consider.Width, useHeight), consider.Offset)); }
private void PushRect(ValueRenderRectangle rect) { _locations.Push(rect); CurrentElementRect = rect; }
private static ValueRenderRectangle GetElementRenderBounds(IVisualElement child, ValueRenderRectangle current, Orientations orientation, IRenderRectangle bounds) { var useX = current.X; var useY = current.Y; switch (orientation) { case Orientations.Vertical: // may need to adjust the X based on alignment var useHorzAlign = child.HorizontalAlignment; switch (useHorzAlign) { case HorizontalAlignments.Right: useX += bounds.Width - current.Width; break; case HorizontalAlignments.Center: useX += (bounds.Width - current.Width) / 2; break; case HorizontalAlignments.Left: case HorizontalAlignments.Default: case HorizontalAlignments.Stretch: break; default: throw new ArgumentOutOfRangeException(); } break; case Orientations.Horizontal: var useVertAlign = child.VerticalAlignment; switch (useVertAlign) { case VerticalAlignments.Bottom: useY += bounds.Height - current.Height; break; case VerticalAlignments.Center: useY += (bounds.Height - current.Height) / 2; break; case VerticalAlignments.Top: case VerticalAlignments.Default: case VerticalAlignments.Stretch: break; default: throw new ArgumentOutOfRangeException(); } break; } current = new ValueRenderRectangle(useX, useY, //bounds.Width, //this draws things (picture frame) too wide current.Width, current.Height, current.Offset); return(current); }
protected virtual ValueRenderRectangle GetElementBounds(IVisualElement child, ValueRenderRectangle precedingVisualBounds) { return(ElementsRendered[child]); }