public MpeSelectButton(MpeSelectButton sb) : base(sb) { MpeLog.Debug("MpeSelectButton(sb)"); Type = MpeControlType.SelectButton; offset = sb.offset; leftImage = new MpeImage(sb.leftImage); rightImage = new MpeImage(sb.rightImage); label = new MpeLabel(sb.label); items = new MpeItemManager(sb.items); items.TypeChanging += new MpeItemManager.TypeChangingHandler(OnItemTypeChanging); textureSize = sb.textureSize; buttonTextureFile = sb.buttonTextureFile; buttonFocusTextureFile = sb.buttonFocusTextureFile; backTextureFile = sb.backTextureFile; leftTextureFile = sb.leftTextureFile; leftFocusTextureFile = sb.leftFocusTextureFile; rightTextureFile = sb.rightTextureFile; rightFocusTextureFile = sb.rightFocusTextureFile; Prepare(); }
public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference) { base.Save(doc, node, parser, reference); MpeSelectButton button = null; if (reference != null && reference is MpeSelectButton) { button = (MpeSelectButton)reference; } // Regular Button Properties parser.SetValue(doc, node, "label", label.Text); if (button == null || button.label.Font.Name.Equals(label.Font.Name) == false) { parser.SetValue(doc, node, "font", label.Font.Name); } if (button == null || button.label.Alignment != label.Alignment) { parser.SetValue(doc, node, "align", label.Alignment.ToString().ToLower()); } if (button == null || button.label.TextColor != label.TextColor) { parser.SetColor(doc, node, "textcolor", label.TextColor); } if (button == null || button.label.DisabledColor != label.DisabledColor) { parser.SetColor(doc, node, "disabledcolor", label.DisabledColor); } if (button == null || button.TextureButton == null || button.TextureButton.Equals(TextureButton) == false) { if (TextureButton == null) { parser.SetValue(doc, node, "textureNoFocus", "-"); } else { parser.SetValue(doc, node, "textureNoFocus", TextureButton.Name); } } if (button == null || button.TextureButtonFocus == null || button.TextureButtonFocus.Equals(TextureButtonFocus) == false) { if (TextureButtonFocus == null) { parser.SetValue(doc, node, "textureFocus", "-"); } else { parser.SetValue(doc, node, "textureFocus", TextureButtonFocus.Name); } } if (button == null || button.LabelPadding.Left != LabelPadding.Left) { parser.SetInt(doc, node, "textXOff2", LabelPadding.Left); } if (button == null || button.LabelPadding.Top != LabelPadding.Top) { parser.SetInt(doc, node, "textYOff2", LabelPadding.Top); } // Select Button Specific Properties if (button == null || button.TexturePadding.Width != TexturePadding.Width) { parser.SetInt(doc, node, "textXOff", TexturePadding.Width); } if (button == null || button.LabelPadding.Top != LabelPadding.Top) { parser.SetInt(doc, node, "textYOff", LabelPadding.Top); } if (button == null || button.textureSize != textureSize) { parser.SetInt(doc, node, "textureWidth", textureSize.Width); parser.SetInt(doc, node, "textureHeight", textureSize.Height); } if (button == null || button.TextureBackground == null || button.TextureBackground.Equals(TextureBackground) == false) { if (TextureBackground == null) { parser.SetValue(doc, node, "texturebg", "-"); } else { parser.SetValue(doc, node, "texturebg", TextureBackground.Name); } } if (button == null || button.TextureLeft == null || button.TextureLeft.Equals(TextureLeft) == false) { if (TextureLeft == null) { parser.SetValue(doc, node, "textureLeft", "-"); } else { parser.SetValue(doc, node, "textureLeft", TextureLeft.Name); } } if (button == null || button.TextureLeftFocus == null || button.TextureLeftFocus.Equals(TextureLeftFocus) == false ) { if (TextureLeftFocus == null) { parser.SetValue(doc, node, "textureLeftFocus", "-"); } else { parser.SetValue(doc, node, "textureLeftFocus", TextureLeftFocus.Name); } } if (button == null || button.TextureRight == null || button.TextureRight.Equals(TextureRight) == false) { if (TextureRight == null) { parser.SetValue(doc, node, "textureRight", "-"); } else { parser.SetValue(doc, node, "textureRight", TextureRight.Name); } } if (button == null || button.TextureRightFocus == null || button.TextureRightFocus.Equals(TextureRightFocus) == false) { if (TextureRightFocus == null) { parser.SetValue(doc, node, "textureRightFocus", "-"); } else { parser.SetValue(doc, node, "textureRightFocus", TextureRightFocus.Name); } } XmlElement subitems = doc.CreateElement("subitems"); for (int i = 0; items != null && items.Values != null && i < items.Values.Count; i++) { XmlElement subitem = doc.CreateElement("subitem"); subitem.AppendChild(doc.CreateTextNode(items.Values[i].Value)); subitems.AppendChild(subitem); } node.AppendChild(subitems); //parser.SetValue(doc, node, "type", parser.ControlTypeToXmlString(Type)); }