private protected override void ValidateDiscreteContentFocusableCellView(IFrameCellViewTreeContext context, IFrameKeywordFrame keywordFrame, IFrameDiscreteContentFocusableCellView cellView) { Debug.Assert(((ILayoutDiscreteContentFocusableCellView)cellView).StateView == ((ILayoutCellViewTreeContext)context).StateView); Debug.Assert(((ILayoutDiscreteContentFocusableCellView)cellView).Frame == this); Debug.Assert(((ILayoutDiscreteContentFocusableCellView)cellView).KeywordFrame == (ILayoutKeywordFrame)keywordFrame); ILayoutCellViewCollection ParentCellView = ((ILayoutDiscreteContentFocusableCellView)cellView).ParentCellView; }
/// <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> /// Initializes a new instance of the <see cref="LayoutCommentCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="frame">The frame that created this cell view.</param> /// <param name="documentation">The comment this cell is displaying.</param> public LayoutCommentCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame, Document documentation) : base(stateView, parentCellView, frame, documentation) { CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <summary> /// Initializes a new instance of the <see cref="LayoutCellViewCollection"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="cellViewList">The list of child cell views.</param> /// <param name="frame">The frame that was used to create this cell. Can be null.</param> public LayoutCellViewCollection(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutCellViewList cellViewList, ILayoutFrame frame) : base(stateView, parentCellView, cellViewList, frame) { CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; ActualCellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; }
/// <summary> /// Initializes a new instance of the <see cref="LayoutBlockCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view.</param> /// <param name="blockStateView">The block state view of the state associated to this cell.</param> public LayoutBlockCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, LayoutBlockStateView blockStateView) : base(stateView, parentCellView, blockStateView) { CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <summary> /// Initializes a new instance of the <see cref="LayoutContentFocusableCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="frame">The frame that created this cell view.</param> /// <param name="propertyName">Property corresponding to the component of the node.</param> public LayoutContentFocusableCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame, string propertyName) : base(stateView, parentCellView, frame, propertyName) { CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <summary> /// Initializes a new instance of the <see cref="LayoutContainerCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view.</param> /// <param name="childStateView">The state view of the state associated to this cell.</param> /// <param name="frame">The frame that was used to create this cell.</param> public LayoutContainerCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutNodeStateView childStateView, ILayoutFrame frame) : base(stateView, parentCellView, childStateView, frame) { CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <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> /// Initializes a new instance of the <see cref="LayoutLine"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="cellViewList">The list of child cell views.</param> /// <param name="frame">Frame providing the horizontal separator to insert between cells. Can be null.</param> public LayoutLine(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutCellViewList cellViewList, ILayoutFrame frame) : base(stateView, parentCellView, cellViewList, frame) { Debug.Assert(frame is ILayoutFrameWithHorizontalSeparator); CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <summary> /// Initializes a new instance of the <see cref="LayoutFocusableCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="frame">The frame that created this cell view.</param> public LayoutFocusableCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame) : base(stateView, parentCellView, frame) { Debug.Assert(frame is ILayoutMeasurableFrame); Debug.Assert(frame is ILayoutDrawableFrame); CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <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> /// 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> /// 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> /// Initializes a new instance of the <see cref="LayoutDiscreteContentFocusableCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="frame">The frame that created this cell view.</param> /// <param name="propertyName">Property corresponding to the component of the node.</param> /// <param name="keywordFrame">The keyword frame that was used to create this cell.</param> public LayoutDiscreteContentFocusableCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame, string propertyName, ILayoutKeywordFrame keywordFrame) : base(stateView, parentCellView, frame, propertyName, keywordFrame) { Debug.Assert(keywordFrame.ParentFrame is ILayoutDiscreteFrame); CellOrigin = RegionHelper.InvalidOrigin; CellSize = RegionHelper.InvalidSize; CellPadding = Padding.Empty; ActualCellSize = RegionHelper.InvalidSize; }
/// <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)); }
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); }
private protected override void ValidateEmptyCellView(IFocusCellViewTreeContext context, IFocusEmptyCellView emptyCellView) { Debug.Assert(((ILayoutEmptyCellView)emptyCellView).StateView == ((ILayoutCellViewTreeContext)context).StateView); ILayoutCellViewCollection ParentCellView = ((ILayoutEmptyCellView)emptyCellView).ParentCellView; }
/// <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) { 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)); }
private protected override void ValidateVisibleCellView(IFrameCellViewTreeContext context, IFrameVisibleCellView cellView) { Debug.Assert(((ILayoutVisibleCellView)cellView).StateView == ((ILayoutCellViewTreeContext)context).StateView); Debug.Assert(((ILayoutVisibleCellView)cellView).Frame == this); ILayoutCellViewCollection ParentCellView = ((ILayoutVisibleCellView)cellView).ParentCellView; }
private protected override void ValidateEmbeddingCellView(IFrameCellViewTreeContext context, IFrameCellViewCollection embeddingCellView) { Debug.Assert(((ILayoutCellViewCollection)embeddingCellView).StateView == ((ILayoutCellViewTreeContext)context).StateView); ILayoutCellViewCollection ParentCellView = ((ILayoutCellViewCollection)embeddingCellView).ParentCellView; }
/// <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) { 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)); }
public void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding) { size = new(); padding = new(); }