/// <summary> /// Measures the cell. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public virtual void Measure(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength) { CollectionWithSeparator = collectionWithSeparator; ReferenceContainer = referenceContainer; SeparatorLength = separatorLength; Debug.Assert(StateView != null); Debug.Assert(StateView.ControllerView != null); ILayoutMeasureContext MeasureContext = StateView.ControllerView.MeasureContext; Debug.Assert(MeasureContext != null); Size MeasuredSize; if (Frame is ILayoutMeasurableFrame AsMeasurableFrame) { AsMeasurableFrame.Measure(MeasureContext, this, collectionWithSeparator, referenceContainer, separatorLength, out Size Size, out Padding Padding); MeasuredSize = Size; CellPadding = Padding; } else { Debug.Assert(ChildStateView != null); ChildStateView.MeasureCells(collectionWithSeparator, referenceContainer, separatorLength); MeasuredSize = ChildStateView.CellSize; } CellSize = MeasuredSize; ActualCellSize = RegionHelper.InvalidSize; Debug.Assert(RegionHelper.IsValid(CellSize)); }
/// <summary> /// Measures a cell created with this frame. /// </summary> /// <param name="measureContext">The context used to measure the cell.</param> /// <param name="cellView">The cell to measure.</param> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> /// <param name="size">The cell size upon return, padding included.</param> /// <param name="padding">The cell padding.</param> public virtual void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { size = measureContext.MeasureSymbolSize(Symbols.InsertSign); measureContext.UpdatePadding(LeftMargin, RightMargin, ref size, out padding); Debug.Assert(RegionHelper.IsValid(size)); }
/// <summary> /// Measures a cell created with this frame. /// </summary> /// <param name="measureContext">The context used to measure the cell.</param> /// <param name="cellView">The cell to measure.</param> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> /// <param name="size">The cell size upon return, padding included.</param> /// <param name="padding">The cell padding.</param> public virtual void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { padding = Padding.Empty; ILayoutCommentCellView CommentCellView = cellView as ILayoutCommentCellView; Debug.Assert(CommentCellView != null); string Text = CommentHelper.Get(CommentCellView.Documentation); CommentDisplayModes DisplayMode = cellView.StateView.ControllerView.CommentDisplayMode; Debug.Assert(DisplayMode == CommentDisplayModes.OnFocus || DisplayMode == CommentDisplayModes.All); bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView; if (IsFocused && Text == null) { Text = string.Empty; } bool IsDisplayed = Text != null && ((DisplayMode == CommentDisplayModes.OnFocus && IsFocused) || DisplayMode == CommentDisplayModes.All); if (IsDisplayed) { size = measureContext.MeasureText(Text, TextStyles.Comment, Controller.Measure.Floating); } else { size = Size.Empty; } Debug.Assert(RegionHelper.IsValid(size)); }
/// <summary> /// Draws a cell created with this frame. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { INode Node = cellView.StateView.State.Node; string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName); Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); drawContext.DrawNumber(Text, OriginWithPadding); // The caret is drawn separately. }
/// <summary> /// Prints a cell created with this frame. /// </summary> /// <param name="printContext">The context used to print the cell.</param> /// <param name="cellView">The cell to print.</param> /// <param name="origin">The location where to start printing.</param> /// <param name="size">The printing size, padding included.</param> /// <param name="padding">The padding to use when printing.</param> public virtual void Print(ILayoutPrintContext printContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { INode Node = cellView.StateView.State.Node; string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName); Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); printContext.PrintNumber(Text, OriginWithPadding); }
/// <summary> /// Draws a cell created with this frame. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView; Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyle); drawContext.DrawText(Text, OriginWithPadding, TextStyle, IsFocused); }
/// <summary> /// Measures the cell. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public virtual void Measure(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength) { CollectionWithSeparator = collectionWithSeparator; ReferenceContainer = referenceContainer; SeparatorLength = separatorLength; CellSize = Size.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <summary> /// Measure all cells in this state view. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public void MeasureCells(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength) { Debug.Assert(RootCellView != null); RootCellView.Measure(collectionWithSeparator, referenceContainer, separatorLength); CellSize = RootCellView.CellSize; ActualCellSize = RegionHelper.InvalidSize; Debug.Assert(RegionHelper.IsValid(CellSize)); }
/// <summary> /// Measures a cell created with this frame. /// </summary> /// <param name="measureContext">The context used to measure the cell.</param> /// <param name="cellView">The cell to measure.</param> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> /// <param name="size">The cell size upon return, padding included.</param> /// <param name="padding">The cell padding.</param> public virtual void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { INode Node = cellView.StateView.State.Node; string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName); size = measureContext.MeasureNumber(Text); measureContext.UpdatePadding(LeftMargin, RightMargin, ref size, out padding); Debug.Assert(RegionHelper.IsValid(size)); }
/// <summary> /// Prints a cell created with this frame. /// </summary> /// <param name="printContext">The context used to print the cell.</param> /// <param name="cellView">The cell to print.</param> /// <param name="origin">The location where to start printing.</param> /// <param name="size">The printing size, padding included.</param> /// <param name="padding">The padding to use when printing.</param> public virtual void Print(ILayoutPrintContext printContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { INode Node = cellView.StateView.State.Node; string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName); Debug.Assert(!string.IsNullOrEmpty(Text)); Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); printContext.PrintText(Text, OriginWithPadding, TextStyles.Character); }
/// <summary> /// Prints a cell created with this frame. /// </summary> /// <param name="printContext">The context used to print the cell.</param> /// <param name="cellView">The cell to print.</param> /// <param name="origin">The location where to start printing.</param> /// <param name="size">The printing size, padding included.</param> /// <param name="padding">The padding to use when printing.</param> public virtual void Print(ILayoutPrintContext printContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { ILayoutDiscreteContentFocusableCellView DiscreteContentFocusableCellView = cellView as ILayoutDiscreteContentFocusableCellView; Debug.Assert(DiscreteContentFocusableCellView != null); ILayoutKeywordFrame KeywordFrame = DiscreteContentFocusableCellView.KeywordFrame; Debug.Assert(KeywordFrame != null); KeywordFrame.Print(printContext, DiscreteContentFocusableCellView, origin, size, padding); }
/// <summary> /// Measures the cell. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public virtual void Measure(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength) { CollectionWithSeparator = collectionWithSeparator; ReferenceContainer = referenceContainer; SeparatorLength = separatorLength; Debug.Assert(BlockStateView != null); BlockStateView.MeasureCells(collectionWithSeparator, referenceContainer, separatorLength); CellSize = BlockStateView.CellSize; ActualCellSize = RegionHelper.InvalidSize; Debug.Assert(RegionHelper.IsValid(CellSize)); }
/// <summary> /// Draws a cell created with this frame. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { INode Node = cellView.StateView.State.Node; string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName); Debug.Assert(!string.IsNullOrEmpty(Text)); bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView; Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyles.Character); drawContext.DrawText(Text, OriginWithPadding, TextStyles.Character, IsFocused); }
/// <summary> /// Measures a cell created with this frame. /// </summary> /// <param name="measureContext">The context used to measure the cell.</param> /// <param name="cellView">The cell to measure.</param> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> /// <param name="size">The cell size upon return, padding included.</param> /// <param name="padding">The cell padding.</param> public virtual void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { ILayoutDiscreteContentFocusableCellView DiscreteContentFocusableCellView = cellView as ILayoutDiscreteContentFocusableCellView; Debug.Assert(DiscreteContentFocusableCellView != null); ILayoutKeywordFrame KeywordFrame = DiscreteContentFocusableCellView.KeywordFrame; Debug.Assert(KeywordFrame != null); KeywordFrame.Measure(measureContext, DiscreteContentFocusableCellView, collectionWithSeparator, referenceContainer, separatorLength, out size, out padding); Debug.Assert(padding.IsEmpty); measureContext.UpdatePadding(LeftMargin, RightMargin, ref size, out padding); Debug.Assert(RegionHelper.IsValid(size)); }
/// <summary> /// Measures a cell created with this frame. /// </summary> /// <param name="measureContext">The context used to measure the cell.</param> /// <param name="cellView">The cell to measure.</param> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> /// <param name="size">The cell size upon return, padding included.</param> /// <param name="padding">The cell padding.</param> public virtual void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { ILayoutContainerCellView ContainerCellView = cellView as ILayoutContainerCellView; Debug.Assert(ContainerCellView != null); ILayoutNodeStateView ChildStateView = ContainerCellView.ChildStateView; Debug.Assert(ChildStateView != null); ChildStateView.MeasureCells(collectionWithSeparator, referenceContainer, separatorLength); Debug.Assert(RegionHelper.IsValid(ChildStateView.CellSize)); size = ChildStateView.CellSize; measureContext.UpdatePadding(LeftMargin, RightMargin, ref size, out padding); Debug.Assert(RegionHelper.IsValid(size)); }
/// <summary> /// Draws a cell created with this frame. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { ILayoutCommentCellView CommentCellView = cellView as ILayoutCommentCellView; Debug.Assert(CommentCellView != null); string Text = CommentHelper.Get(CommentCellView.Documentation); CommentDisplayModes DisplayMode = cellView.StateView.ControllerView.CommentDisplayMode; Debug.Assert(DisplayMode == CommentDisplayModes.OnFocus || DisplayMode == CommentDisplayModes.All); bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView; if (IsFocused && Text == null) { Text = string.Empty; } if (Text != null) { if ((DisplayMode == CommentDisplayModes.OnFocus && IsFocused) || DisplayMode == CommentDisplayModes.All) { Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyles.Comment); LayoutControllerView ControllerView = cellView.StateView.ControllerView; if (ControllerView.Selection is ILayoutCommentSelection AsCommentSelection && AsCommentSelection.StateView == cellView.StateView) { int Start = AsCommentSelection.Start; int End = AsCommentSelection.End; Debug.Assert(Start <= End); drawContext.DrawSelectionText(Text, OriginWithPadding, TextStyles.Comment, Start, End); } drawContext.DrawText(Text, OriginWithPadding, TextStyles.Comment, isFocused: false); // The caret is drawn separately. } else if (DisplayMode == CommentDisplayModes.OnFocus && cellView.StateView.ControllerView.ShowUnfocusedComments) { drawContext.DrawCommentIcon(new Rect(cellView.CellOrigin, Size.Empty)); } } }
/// <summary> /// Prints a cell created with this frame. /// </summary> /// <param name="printContext">The context used to print the cell.</param> /// <param name="cellView">The cell to print.</param> /// <param name="origin">The location where to start printing.</param> /// <param name="size">The printing size, padding included.</param> /// <param name="padding">The padding to use when printing.</param> public virtual void Print(ILayoutPrintContext printContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { ILayoutCommentCellView CommentCellView = cellView as ILayoutCommentCellView; Debug.Assert(CommentCellView != null); string Text = CommentHelper.Get(CommentCellView.Documentation); if (Text != null) { CommentDisplayModes DisplayMode = cellView.StateView.ControllerView.CommentDisplayMode; Debug.Assert(DisplayMode == CommentDisplayModes.OnFocus || DisplayMode == CommentDisplayModes.All); if (DisplayMode == CommentDisplayModes.All) { Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); printContext.PrintText(Text, OriginWithPadding, TextStyles.Comment); } } }
/// <summary> /// Arranges the cell. /// </summary> /// <param name="origin">The cell location.</param> public virtual void Arrange(Point origin) { CellOrigin = origin; Debug.Assert(StateView != null); Debug.Assert(StateView.ControllerView != null); ILayoutMeasureContext MeasureContext = StateView.ControllerView.MeasureContext; Debug.Assert(MeasureContext != null); Measure LeftPadding = (Frame is ILayoutVerticalTabulatedFrame AsTabulatedFrame && AsTabulatedFrame.HasTabulationMargin) ? MeasureContext.TabulationWidth : Controller.Measure.Zero; Measure OriginX = origin.X + LeftPadding + (HasBlockGeometry ? MeasureContext.BlockGeometryWidth : Controller.Measure.Zero); Measure OriginY = origin.Y; for (int i = 0; i < CellViewList.Count; i++) { ILayoutCellView CellView = (ILayoutCellView)CellViewList[i]; // The separator length has been calculated in Measure(). if (i > 0) { OriginY += CellView.SeparatorLength; } Point LineOrigin = new Point(OriginX, OriginY); CellView.Arrange(LineOrigin); Size NestedCellSize = CellView.CellSize; Debug.Assert(!NestedCellSize.Height.IsFloating); OriginY += NestedCellSize.Height; } Point FinalOrigin = new Point(OriginX, OriginY); Point ExpectedOrigin = CellOrigin.Moved(LeftPadding + (HasBlockGeometry ? MeasureContext.BlockGeometryWidth : Controller.Measure.Zero), CellSize.Height); bool IsEqual = Point.IsEqual(FinalOrigin, ExpectedOrigin); Debug.Assert(IsEqual); }
/// <summary> /// Draws a cell created with this frame. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { Node Node = cellView.StateView.State.Node; string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName); Point OriginWithPadding = origin.Moved(padding.Left, padding.Top); drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyle); LayoutControllerView ControllerView = cellView.StateView.ControllerView; if (ControllerView.Selection is ILayoutStringContentSelection AsStringContentSelection && AsStringContentSelection.StateView == cellView.StateView) { int Start = AsStringContentSelection.Start; int End = AsStringContentSelection.End; Debug.Assert(Start <= End); drawContext.DrawSelectionText(Text, OriginWithPadding, TextStyle, Start, End); } drawContext.DrawText(Text, OriginWithPadding, TextStyle, isFocused: false); // The caret is drawn separately. }
/// <summary> /// Arranges the cell. /// </summary> /// <param name="origin">The cell location.</param> public virtual void Arrange(Point origin) { CellOrigin = origin; Debug.Assert(StateView != null); Debug.Assert(StateView.ControllerView != null); ILayoutMeasureContext MeasureContext = StateView.ControllerView.MeasureContext; Debug.Assert(MeasureContext != null); Measure OriginX = origin.X; Measure OriginY = origin.Y + (HasBlockGeometry ? MeasureContext.BlockGeometryHeight : Controller.Measure.Zero); for (int i = 0; i < CellViewList.Count; i++) { ILayoutCellView CellView = CellViewList[i]; // The separator length has been calculated in Measure(). if (i > 0) { OriginX += CellView.SeparatorLength; } Point ColumnOrigin = new Point(OriginX, OriginY); CellView.Arrange(ColumnOrigin); Size NestedCellSize = CellView.CellSize; Debug.Assert(!NestedCellSize.Width.IsFloating); OriginX += NestedCellSize.Width; } Point FinalOrigin = new Point(OriginX, OriginY); Point ExpectedOrigin = CellOrigin.Moved(CellSize.Width, HasBlockGeometry ? MeasureContext.BlockGeometryHeight : Controller.Measure.Zero); bool IsEqual = Point.IsEqual(FinalOrigin, ExpectedOrigin); Debug.Assert(IsEqual); }
private protected virtual bool GetPlaceholderCellViewCollection(ILayoutCellView rootCellView, out ILayoutCellViewCollection cellViewCollection) { cellViewCollection = null; if (rootCellView is ILayoutCellViewCollection AsCellViewCollection) { if (AsCellViewCollection.Frame is ILayoutCollectionPlaceholderFrame) { cellViewCollection = AsCellViewCollection; return(true); } foreach (ILayoutCellView CellView in AsCellViewCollection.CellViewList) { if (GetPlaceholderCellViewCollection(CellView, out cellViewCollection)) { return(true); } } } return(false); }
/// <summary> /// Measures the cell. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public virtual void Measure(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength) { CollectionWithSeparator = collectionWithSeparator; ReferenceContainer = referenceContainer; SeparatorLength = separatorLength; Debug.Assert(StateView != null); Debug.Assert(StateView.ControllerView != null); ILayoutMeasureContext MeasureContext = StateView.ControllerView.MeasureContext; Debug.Assert(MeasureContext != null); ILayoutDiscreteFrame AsDiscreteFrame = KeywordFrame.ParentFrame as ILayoutDiscreteFrame; Debug.Assert(AsDiscreteFrame != null); AsDiscreteFrame.Measure(MeasureContext, this, collectionWithSeparator, referenceContainer, separatorLength, out Size Size, out Padding Padding); CellSize = Size; ActualCellSize = RegionHelper.InvalidSize; CellPadding = Padding; Debug.Assert(RegionHelper.IsValid(CellSize)); }
/// <summary> /// Prints a cell created with this frame. /// </summary> /// <param name="printContext">The context used to print the cell.</param> /// <param name="cellView">The cell to print.</param> /// <param name="origin">The location where to start printing.</param> /// <param name="size">The printing size, padding included.</param> /// <param name="padding">The padding to use when printing.</param> public virtual void Print(ILayoutPrintContext printContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { printContext.PrintSymbol(Symbols.InsertSign, origin, size, padding); }
/// <summary> /// Draws container or separator after an element of a collection. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public abstract void DrawAfterItem(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding);
/// <summary> /// Measure all cells in this state view. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public abstract void MeasureCells(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength);
/// <summary> /// Measures the cell. /// </summary> /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param> /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param> /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param> public virtual void Measure(ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength) { CollectionWithSeparator = collectionWithSeparator; ReferenceContainer = referenceContainer; SeparatorLength = separatorLength; Debug.Assert(StateView != null); Debug.Assert(StateView.ControllerView != null); ILayoutMeasureContext MeasureContext = StateView.ControllerView.MeasureContext; Debug.Assert(MeasureContext != null); ILayoutFrameWithHorizontalSeparator AsFrameWithHorizontalSeparator = Frame as ILayoutFrameWithHorizontalSeparator; Debug.Assert(AsFrameWithHorizontalSeparator != null); bool OverrideReferenceContainer = false; // Ensures arguments of Arrange() are valid. This only happens for the root cell view, where there is no separator. if (collectionWithSeparator == null && referenceContainer == null) { collectionWithSeparator = this; OverrideReferenceContainer = true; separatorLength = Controller.Measure.Zero; } Measure Width = Controller.Measure.Zero; Measure Height = Controller.Measure.Floating; for (int i = 0; i < CellViewList.Count; i++) { ILayoutCellView CellView = CellViewList[i]; if (i > 0) { // Starting with the second cell, we use the separator of our frame. if (i == 1) { collectionWithSeparator = this; OverrideReferenceContainer = true; separatorLength = MeasureContext.GetHorizontalSeparatorWidth(AsFrameWithHorizontalSeparator.Separator); } Width += separatorLength; } if (OverrideReferenceContainer) { referenceContainer = CellView; } Debug.Assert(collectionWithSeparator != this || CellViewList.IndexOf(referenceContainer) == i); CellView.Measure(collectionWithSeparator, referenceContainer, separatorLength); Size NestedCellSize = CellView.CellSize; Debug.Assert(RegionHelper.IsValid(NestedCellSize)); bool IsFixed = RegionHelper.IsFixed(NestedCellSize); bool IsStretched = RegionHelper.IsStretchedVertically(NestedCellSize); Debug.Assert(IsFixed || IsStretched); Debug.Assert(!NestedCellSize.Width.IsFloating); Width += NestedCellSize.Width; if (IsFixed) { Debug.Assert(!NestedCellSize.Height.IsFloating); if (Height.IsFloating || Height.Draw < NestedCellSize.Height.Draw) { Height = NestedCellSize.Height; } } } Size AccumulatedSize = Size.Empty; if (!Width.IsZero) { AccumulatedSize = new Size(Width, Height + (HasBlockGeometry ? MeasureContext.BlockGeometryHeight : Controller.Measure.Zero)); } CellSize = AccumulatedSize; ActualCellSize = RegionHelper.InvalidSize; Debug.Assert(RegionHelper.IsValid(CellSize)); }
/// <summary> /// Prints container or separator after an element of a collection. /// </summary> /// <param name="printContext">The context used to print the cell.</param> /// <param name="cellView">The cell to print.</param> /// <param name="origin">The location where to start printing.</param> /// <param name="size">The printing size, padding included.</param> /// <param name="padding">The padding to use when printing.</param> public abstract void PrintAfterItem(ILayoutPrintContext printContext, ILayoutCellView cellView, Point origin, Size size, Padding padding);
public void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { size = new(); padding = new(); }
public void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { }
/// <summary> /// Draws a cell created with this frame. /// </summary> /// <param name="drawContext">The context used to draw the cell.</param> /// <param name="cellView">The cell to draw.</param> /// <param name="origin">The location where to start drawing.</param> /// <param name="size">The drawing size, padding included.</param> /// <param name="padding">The padding to use when drawing.</param> public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding) { bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView; drawContext.DrawSymbol(Symbols.InsertSign, origin, size, padding, IsFocused); }