protected override void InsertInternal(int index, Element element)
 {
     if (!(element is SectionElement))
     {
         throw new ArgumentException();
     }
     base.InsertInternal(index, element);
 }
 public VisualElementCollection(Element owner)
     : base(owner)
 {
 }
Beispiel #3
0
 public void AddElement(Element element, string name)
 {
     if (this._currentSection == null)
     {
         throw new InvalidOperationException("No current panel");
     }
     element.SetName(name);
     this._currentSection.Elements.Add(element);
 }
Beispiel #4
0
 protected void AddElementInternal(Element element, string name)
 {
     this.EnsurePageCreationData();
     this._data.AddElement(element, name);
 }
Beispiel #5
0
 private void CollectNamedElements(Element parentElement)
 {
     ElementCollection elements = parentElement.Elements;
     if (elements.Count != 0)
     {
         foreach (Element element in elements)
         {
             if (element.Name != null)
             {
                 this._namedElements[element.Name] = element;
                 if (!(element is INameScopeElement))
                 {
                     this.CollectNamedElements(element);
                 }
             }
         }
     }
 }
Beispiel #6
0
 protected virtual void InsertInternal(int index, Element element)
 {
     this.EnsureStorage();
     if ((index < -1) || (index >= this._elements.Count))
     {
         throw new ArgumentOutOfRangeException("index");
     }
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     if (element.Parent != null)
     {
         element.Parent.Elements.Remove(element);
     }
     element.SetParent(this._owner);
     if (index == -1)
     {
         this._elements.Add(element);
     }
     else
     {
         this._elements.Insert(index, element);
     }
     if (element.Name != null)
     {
         this.DirtyNamedElements();
     }
     this._owner.OnElementsChanged();
 }
Beispiel #7
0
 private void ApplyFormatting(Element element, bool applyFont)
 {
     if (applyFont)
     {
         FontStyle fontStyle = element.FontStyle;
         if (this._boldCount != 0)
         {
             fontStyle |= FontStyle.Bold;
         }
         if (this._italicCount != 0)
         {
             fontStyle |= FontStyle.Italic;
         }
         if (this._strikeoutCount != 0)
         {
             fontStyle |= FontStyle.Strikeout;
         }
         if (this._underlineCount != 0)
         {
             fontStyle |= FontStyle.Underline;
         }
         element.FontStyle = fontStyle;
         if ((this._fontSizeStack != null) && (this._fontSizeStack.Count != 0))
         {
             element.FontSize = (float) this._fontSizeStack.Peek();
         }
         if ((this._fontFamilyStack != null) && (this._fontFamilyStack.Count != 0))
         {
             element.FontFamily = (string) this._fontFamilyStack.Peek();
         }
     }
     if ((this._foreColorStack != null) && (this._foreColorStack.Count != 0))
     {
         element.ForeColor = (Color) this._foreColorStack.Peek();
     }
     if ((this._backColorStack != null) && (this._backColorStack.Count != 0))
     {
         element.BackColor = (Color) this._backColorStack.Peek();
     }
 }
 public EmptyElementCollection(Element owner)
     : base(owner)
 {
 }
Beispiel #9
0
 public int IndexOf(Element element)
 {
     if ((element != null) && (this._elements != null))
     {
         int count = this.Count;
         for (int i = 0; i < count; i++)
         {
             if (this[i] == element)
             {
                 return i;
             }
         }
     }
     return -1;
 }
Beispiel #10
0
 public ElementCollection(Element owner)
 {
     this._owner = owner;
 }
Beispiel #11
0
 public bool Contains(Element element)
 {
     if (this._elements == null)
     {
         return false;
     }
     return (this.IndexOf(element) != -1);
 }
Beispiel #12
0
 public void Add(Element element)
 {
     this.InsertInternal(-1, element);
 }
Beispiel #13
0
 private void RaiseElementClickEvent(Element element)
 {
     ElementEventArgs e = new ElementEventArgs(element);
     if (this._page.RaiseElementClickEvent(e))
     {
         this.OnElementClick(e);
     }
 }
Beispiel #14
0
 public void AddElement(Element element, string name)
 {
     this.AddElement(element, name, true);
 }
Beispiel #15
0
 public void AddElement(Element element)
 {
     this.AddElement(element, null, true);
 }
Beispiel #16
0
 internal void SetParent(Element parent)
 {
     this._parent = parent;
     this._nameScope = null;
 }
Beispiel #17
0
 public void Insert(int index, Element element)
 {
     this.InsertInternal(index, element);
 }
Beispiel #18
0
 public void Remove(Element element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     int index = this.IndexOf(element);
     if (index == -1)
     {
         throw new ArgumentException();
     }
     this.RemoveAt(index);
 }
Beispiel #19
0
 protected virtual void GenerateDocumentation(Element documentationContainer)
 {
     TextElement element = new TextElement("[Doc-comment support is not yet implemented.]");
     element.ForeColor = Color.Gray;
     documentationContainer.Elements.Add(element);
 }
Beispiel #20
0
 protected void AddElement(Element element, string name, bool applyFont)
 {
     this.ApplyFormatting(element, applyFont);
     base.AddElementInternal(element, name);
 }