// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using System.Collections.Generic; using System.Windows.Documents; using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Snippets { /// /// A snippet element that has sub-elements. /// [Serializable] public class SnippetContainerElement : SnippetElement { NullSafeCollection elements = new NullSafeCollection(); /// /// Gets the list of child elements. /// public IList Elements { get { return elements; } } /// public override void Insert(InsertionContext context) { foreach (SnippetElement e in this.Elements) { e.Insert(context); } } /// public override Inline ToTextRun() { Span span = new Span(); foreach (SnippetElement e in this.Elements) { Inline r = e.ToTextRun(); if (r != null) span.Inlines.Add(r); } return span; } } }