public MpeTextArea(MpeTextArea textarea) : base(textarea)
 {
     MpeLog.Debug("MpeTextArea(textarea)");
     label      = new MpeLabel(textarea.label);
     spinButton = new MpeSpinButton(textarea.spinButton);
     Controls.Add(label);
     Controls.Add(spinButton);
 }
Beispiel #2
0
 public MpeTextArea(MpeTextArea textarea) : base(textarea)
 {
   MpeLog.Debug("MpeTextArea(textarea)");
   label = new MpeLabel(textarea.label);
   spinButton = new MpeSpinButton(textarea.spinButton);
   Controls.Add(label);
   Controls.Add(spinButton);
 }
        public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference)
        {
            base.Save(doc, node, parser, reference);
            MpeTextArea textarea = null;

            if (reference != null && reference is MpeTextArea)
            {
                textarea = (MpeTextArea)reference;
            }
            // Label Properties
            Point p = label.AbsoluteLocation;

            parser.SetInt(doc, node, "posX", p.X);
            parser.SetInt(doc, node, "posY", p.Y);
            parser.SetInt(doc, node, "width", label.Width);
            parser.SetInt(doc, node, "height", label.Height);
            parser.SetValue(doc, node, "text", Text);
            if (textarea == null || !textarea.Font.Name.Equals(Font.Name))
            {
                parser.SetValue(doc, node, "font", Font.Name);
            }
            if (textarea == null || textarea.Color != Color)
            {
                parser.SetColor(doc, node, "textcolor", Color);
            }
            if (textarea == null || textarea.DisabledColor != DisabledColor)
            {
                parser.SetColor(doc, node, "disabledcolor", DisabledColor);
            }
            // SpinButton Properties
            p = spinButton.AbsoluteLocation;
            parser.SetInt(doc, node, "SpinPosX", p.X);
            parser.SetInt(doc, node, "SpinPosY", p.Y);
            if (textarea == null || textarea.SpinAlign != SpinAlign)
            {
                parser.SetValue(doc, node, "SpinAlign", SpinAlign.ToString().ToLower());
            }
            if (textarea == null || textarea.SpinSize != SpinSize)
            {
                parser.SetInt(doc, node, "SpinWidth", SpinSize.Width);
                parser.SetInt(doc, node, "SpinHeight", SpinSize.Height);
            }
            if (textarea == null || textarea.SpinColor != SpinColor)
            {
                parser.SetColor(doc, node, "SpinColor", SpinColor);
            }
            if (textarea == null || textarea.TextureUp == null || textarea.TextureUp.Equals(TextureUp) == false)
            {
                if (TextureUp == null)
                {
                    parser.SetValue(doc, node, "textureUp", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureUp", TextureUp.Name);
                }
            }
            if (textarea == null || textarea.TextureUpFocus == null || textarea.TextureUpFocus.Equals(TextureUpFocus) == false
                )
            {
                if (TextureUpFocus == null)
                {
                    parser.SetValue(doc, node, "textureUpFocus", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureUpFocus", TextureUpFocus.Name);
                }
            }
            if (textarea == null || textarea.TextureDown == null || textarea.TextureDown.Equals(TextureDown) == false)
            {
                if (TextureDown == null)
                {
                    parser.SetValue(doc, node, "textureDown", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureDown", TextureDown.Name);
                }
            }
            if (textarea == null || textarea.TextureDownFocus == null ||
                textarea.TextureDownFocus.Equals(TextureDownFocus) == false)
            {
                if (TextureDownFocus == null)
                {
                    parser.SetValue(doc, node, "textureDownFocus", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureDownFocus", TextureDownFocus.Name);
                }
            }
            // Mpe
            if (Spacing != 0 || Padding.None == false)
            {
                XmlElement mpenode = doc.CreateElement("mpe");
                node.AppendChild(mpenode);
                if (Spacing != 0)
                {
                    parser.SetInt(doc, mpenode, "spacing", Spacing);
                }
                if (Padding.None == false)
                {
                    parser.SetPadding(doc, mpenode, "padding", Padding);
                }
            }
        }