protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (this.ChildNodes.Count == 0) { return; } style.Align = dfMarkupTextAlign.Left; var listContainer = new dfMarkupBox(this, dfMarkupDisplayType.block, style); container.AddChild(listContainer); calculateBulletWidth(style); for (int i = 0; i < ChildNodes.Count; i++) { var child = ChildNodes[i] as dfMarkupTag; if (child == null || child.TagName != "li") { continue; } child.PerformLayout(listContainer, style); } listContainer.FitToContents(); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { var headingMargins = new dfMarkupBorders(); var headingStyle = applyDefaultStyles(style, ref headingMargins); headingStyle = applyTextStyleAttributes(headingStyle); // Allow overriding of margins var marginAttribute = findAttribute("margin"); if (marginAttribute != null) { headingMargins = dfMarkupBorders.Parse(marginAttribute.Value); } var headingBox = new dfMarkupBox(this, dfMarkupDisplayType.block, headingStyle); headingBox.Margins = headingMargins; container.AddChild(headingBox); base._PerformLayoutImpl(headingBox, headingStyle); headingBox.FitToContents(); }
public dfList <dfRenderData> RenderMultiple() { if (!this.isVisible || this.Font == null) { return(null); } var matrix = this.transform.localToWorldMatrix; if (!this.isControlInvalidated && viewportBox != null) { for (int i = 0; i < buffers.Count; i++) { buffers[i].Transform = matrix; } return(this.buffers); } try { // Clear the 'dirty' flag first, because some events (like font texture rebuild) // should be able to set the control to 'dirty' again. this.isControlInvalidated = false; // Parse the markup and perform document layout if (isMarkupInvalidated) { isMarkupInvalidated = false; processMarkup(); } // Ensure that our viewport box has been properly resized to // fully encompass all nodes, because the resulting size of // the viewport box will be used to update scrollbars and // determine max scroll position. viewportBox.FitToContents(); // Perform auto-sizing if indicated if (autoHeight) { this.Height = viewportBox.Height; } // Update scrollbars to match rendered height updateScrollbars(); //@Profiler.BeginSample( "Gather markup render buffers" ); buffers.Clear(); gatherRenderBuffers(viewportBox, this.buffers); return(this.buffers); } finally { updateCollider(); } }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.ChildNodes.Count == 0) { return; } float size = container.Size.x; dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.listItem, style); _dfMarkupBox.Margins.top = 10; container.AddChild(_dfMarkupBox); dfMarkupTagList parent = base.Parent as dfMarkupTagList; if (parent == null) { base._PerformLayoutImpl(container, style); return; } style.VerticalAlign = dfMarkupVerticalAlign.Baseline; string str = "•"; if (parent.TagName == "ol") { str = string.Concat(container.Children.Count, "."); } dfMarkupStyle _dfMarkupStyle = style; _dfMarkupStyle.VerticalAlign = dfMarkupVerticalAlign.Baseline; _dfMarkupStyle.Align = dfMarkupTextAlign.Right; dfMarkupBoxText bulletWidth = dfMarkupBoxText.Obtain(this, dfMarkupDisplayType.inlineBlock, _dfMarkupStyle); bulletWidth.SetText(str); bulletWidth.Width = parent.BulletWidth; bulletWidth.Margins.left = style.FontSize * 2; _dfMarkupBox.AddChild(bulletWidth); dfMarkupBox vector2 = new dfMarkupBox(this, dfMarkupDisplayType.inlineBlock, style); int fontSize = style.FontSize; float single = size - bulletWidth.Size.x - (float)bulletWidth.Margins.left - (float)fontSize; vector2.Size = new Vector2(single, (float)fontSize); vector2.Margins.left = (int)((float)style.FontSize * 0.5f); _dfMarkupBox.AddChild(vector2); for (int i = 0; i < base.ChildNodes.Count; i++) { base.ChildNodes[i].PerformLayout(vector2, style); } vector2.FitToContents(false); vector2.Parent.FitToContents(false); _dfMarkupBox.FitToContents(false); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.ChildNodes.Count != 0) { float x = container.Size.x; dfMarkupBox box = new dfMarkupBox(this, dfMarkupDisplayType.listItem, style); box.Margins.top = 10; container.AddChild(box); dfMarkupTagList parent = base.Parent as dfMarkupTagList; if (parent == null) { base._PerformLayoutImpl(container, style); } else { style.VerticalAlign = dfMarkupVerticalAlign.Baseline; string str = "•"; if (parent.TagName == "ol") { str = container.Children.Count + "."; } dfMarkupStyle style2 = style; style2.VerticalAlign = dfMarkupVerticalAlign.Baseline; style2.Align = dfMarkupTextAlign.Right; dfMarkupBoxText text = dfMarkupBoxText.Obtain(this, dfMarkupDisplayType.inlineBlock, style2); text.SetText(str); text.Width = parent.BulletWidth; text.Margins.left = style.FontSize * 2; box.AddChild(text); dfMarkupBox box2 = new dfMarkupBox(this, dfMarkupDisplayType.inlineBlock, style); int fontSize = style.FontSize; float num3 = ((x - text.Size.x) - text.Margins.left) - fontSize; box2.Size = new Vector2(num3, (float)fontSize); box2.Margins.left = (int)(style.FontSize * 0.5f); box.AddChild(box2); for (int i = 0; i < base.ChildNodes.Count; i++) { base.ChildNodes[i].PerformLayout(box2, style); } box2.FitToContents(false); box2.Parent.FitToContents(false); box.FitToContents(false); } } }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.ChildNodes.Count != 0) { style.Align = dfMarkupTextAlign.Left; dfMarkupBox box = new dfMarkupBox(this, dfMarkupDisplayType.block, style); container.AddChild(box); this.calculateBulletWidth(style); for (int i = 0; i < base.ChildNodes.Count; i++) { dfMarkupTag tag = base.ChildNodes[i] as dfMarkupTag; if ((tag != null) && (tag.TagName == "li")) { tag.PerformLayout(box, style); } } box.FitToContents(false); } }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.ChildNodes.Count == 0) { return; } style.Align = dfMarkupTextAlign.Left; dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style); container.AddChild(_dfMarkupBox); this.calculateBulletWidth(style); for (int i = 0; i < base.ChildNodes.Count; i++) { dfMarkupTag item = base.ChildNodes[i] as dfMarkupTag; if (item != null && !(item.TagName != "li")) { item.PerformLayout(_dfMarkupBox, style); } } _dfMarkupBox.FitToContents(false); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { dfMarkupBorders dfMarkupBorder = new dfMarkupBorders(); dfMarkupStyle _dfMarkupStyle = this.applyDefaultStyles(style, ref dfMarkupBorder); _dfMarkupStyle = base.applyTextStyleAttributes(_dfMarkupStyle); dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "margin" }); if (_dfMarkupAttribute != null) { dfMarkupBorder = dfMarkupBorders.Parse(_dfMarkupAttribute.Value); } dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, _dfMarkupStyle) { Margins = dfMarkupBorder }; container.AddChild(_dfMarkupBox); base._PerformLayoutImpl(_dfMarkupBox, _dfMarkupStyle); _dfMarkupBox.FitToContents(false); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { dfMarkupBorders margins = new dfMarkupBorders(); dfMarkupStyle style2 = this.applyDefaultStyles(style, ref margins); style2 = base.applyTextStyleAttributes(style2); string[] names = new string[] { "margin" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { margins = dfMarkupBorders.Parse(attribute.Value); } dfMarkupBox box = new dfMarkupBox(this, dfMarkupDisplayType.block, style2) { Margins = margins }; container.AddChild(box); base._PerformLayoutImpl(box, style2); box.FitToContents(false); }
protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style ) { if( this.ChildNodes.Count == 0 ) return; var containerWidth = container.Size.x; var listItemContainer = new dfMarkupBox( this, dfMarkupDisplayType.listItem, style ); listItemContainer.Margins.top = 10; container.AddChild( listItemContainer ); var list = this.Parent as dfMarkupTagList; if( list == null ) { // If the list item is not contained in a list, process its // child elements as normal html elements base._PerformLayoutImpl( container, style ); return; } style.VerticalAlign = dfMarkupVerticalAlign.Baseline; var bulletText = "•"; if( list.TagName == "ol" ) { bulletText = container.Children.Count + "."; } var bulletBoxStyle = style; bulletBoxStyle.VerticalAlign = dfMarkupVerticalAlign.Baseline; bulletBoxStyle.Align = dfMarkupTextAlign.Right; // TODO: Pre-measure bullet item size (for ordered lists) at the <UL> tag level var listBulletElement = dfMarkupBoxText.Obtain( this, dfMarkupDisplayType.inlineBlock, bulletBoxStyle ); listBulletElement.SetText( bulletText ); listBulletElement.Width = list.BulletWidth; listBulletElement.Margins.left = style.FontSize * 2; listItemContainer.AddChild( listBulletElement ); var listItemBox = new dfMarkupBox( this, dfMarkupDisplayType.inlineBlock, style ); var listItemLeftMargin = style.FontSize; var listItemWidth = containerWidth - listBulletElement.Size.x - listBulletElement.Margins.left - listItemLeftMargin; listItemBox.Size = new Vector2( listItemWidth, listItemLeftMargin ); listItemBox.Margins.left = (int)( style.FontSize * 0.5f ); listItemContainer.AddChild( listItemBox ); for( int i = 0; i < ChildNodes.Count; i++ ) { ChildNodes[ i ].PerformLayout( listItemBox, style ); } listItemBox.FitToContents(); // The listItemBox.Parent property will actually refer to an internal // linebox that hosts the listItemBox, which needs to be fit to the // contents of the list item box. if( listItemBox.Parent != null ) { listItemBox.Parent.FitToContents(); } listItemContainer.FitToContents(); }
protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style ) { if( this.ChildNodes.Count == 0 ) return; style.Align = dfMarkupTextAlign.Left; var listContainer = new dfMarkupBox( this, dfMarkupDisplayType.block, style ); container.AddChild( listContainer ); calculateBulletWidth( style ); for( int i = 0; i < ChildNodes.Count; i++ ) { var child = ChildNodes[ i ] as dfMarkupTag; if( child == null || child.TagName != "li" ) { continue; } child.PerformLayout( listContainer, style ); } listContainer.FitToContents(); }
protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style ) { var headingMargins = new dfMarkupBorders(); var headingStyle = applyDefaultStyles( style, ref headingMargins ); headingStyle = applyTextStyleAttributes( headingStyle ); // Allow overriding of margins var marginAttribute = findAttribute( "margin" ); if( marginAttribute != null ) { headingMargins = dfMarkupBorders.Parse( marginAttribute.Value ); } var headingBox = new dfMarkupBox( this, dfMarkupDisplayType.block, headingStyle ); headingBox.Margins = headingMargins; container.AddChild( headingBox ); base._PerformLayoutImpl( headingBox, headingStyle ); headingBox.FitToContents(); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (this.ChildNodes.Count == 0) { return; } var containerWidth = container.Size.x; var listItemContainer = new dfMarkupBox(this, dfMarkupDisplayType.listItem, style); listItemContainer.Margins.top = 10; container.AddChild(listItemContainer); var list = this.Parent as dfMarkupTagList; if (list == null) { // If the list item is not contained in a list, process its // child elements as normal html elements base._PerformLayoutImpl(container, style); return; } style.VerticalAlign = dfMarkupVerticalAlign.Baseline; var bulletText = "•"; if (list.TagName == "ol") { bulletText = container.Children.Count + "."; } var bulletBoxStyle = style; bulletBoxStyle.VerticalAlign = dfMarkupVerticalAlign.Baseline; bulletBoxStyle.Align = dfMarkupTextAlign.Right; // TODO: Pre-measure bullet item size (for ordered lists) at the <UL> tag level var listBulletElement = dfMarkupBoxText.Obtain(this, dfMarkupDisplayType.inlineBlock, bulletBoxStyle); listBulletElement.SetText(bulletText); listBulletElement.Width = list.BulletWidth; listBulletElement.Margins.left = style.FontSize * 2; listItemContainer.AddChild(listBulletElement); var listItemBox = new dfMarkupBox(this, dfMarkupDisplayType.inlineBlock, style); var listItemLeftMargin = style.FontSize; var listItemWidth = containerWidth - listBulletElement.Size.x - listBulletElement.Margins.left - listItemLeftMargin; listItemBox.Size = new Vector2(listItemWidth, listItemLeftMargin); listItemBox.Margins.left = (int)(style.FontSize * 0.5f); listItemContainer.AddChild(listItemBox); for (int i = 0; i < ChildNodes.Count; i++) { ChildNodes[i].PerformLayout(listItemBox, style); } listItemBox.FitToContents(); // The listItemBox.Parent property will actually refer to an internal // linebox that hosts the listItemBox, which needs to be fit to the // contents of the list item box. if (listItemBox.Parent != null) { listItemBox.Parent.FitToContents(); } listItemContainer.FitToContents(); }