using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace FormulaEditor
{
    /// <summary>
    /// The symbol of brackets
    /// </summary>
    [Serializable()]
    public class BracketsSymbol : SimpleSymbol
    {

        /// <summary>
        /// Constructor 
        /// </summary>
        public BracketsSymbol()
            : base('P')
        {
            type = (byte)2;
            s = "( )";
        }

        public BracketsSymbol(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
        }

        public BracketsSymbol(BracketsSymbol s)
            : this()
        {
        }


        public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            base.GetObjectData(info, context);
        }

        /// <summary>
        /// Sets itself to formula
        /// </summary>
        /// <param name="formula">The formula to set</param>
        public override void SetToFormula(MathFormula formula)
        {
            base.SetToFormula(formula);
            //font = fonts[level];
            if ((this is FractionSymbol) | (this is BinaryFunctionSymbol))
            {
                return;
            }
            MathFormula child1 = new MathFormula((byte)(level), sizes);
            children.Add(child1);
            //childPositions = new Point[]{new Point()};
            if (sizes == null)
            {
                return;
            }
            if (level < (sizes.Length - 1))
            {
                MathFormula child2 = new MathFormula((byte)(level + 1), sizes);
                children.Add(child2);
                //childPositions = new Point[]{new Point(), new Point()};
                return;
            }
        }

        /// <summary>
        /// Clones itself
        /// </summary>
        /// <returns>The clone</returns>
        public override object Clone()
        {
            return new BracketsSymbol();
        }

    }
}
