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 MpeTextArea() : base() { MpeLog.Debug("MpeTextArea()"); Type = MpeControlType.TextArea; layoutStyle = MpeLayoutStyle.Grid; label = new MpeLabel(); label.Embedded = true; label.AutoSize = false; label.Text = "MpeTextArea"; label.Lookup = true; spinButton = new MpeSpinButton(); spinButton.Embedded = true; spinButton.ShowRange = true; spinButton.Orientation = MpeControlOrientation.Vertical; Controls.Add(label); Controls.Add(spinButton); }
public MpeSpinButton(MpeSpinButton spinner) : base(spinner) { MpeLog.Debug("MpeSpinButton(spinner)"); orientation = spinner.orientation; reverse = spinner.reverse; showRange = spinner.showRange; textureUp = spinner.textureUp; textureUpFocus = spinner.textureUpFocus; textureDown = spinner.textureDown; textureDownFocus = spinner.textureDownFocus; label = new MpeLabel(spinner.label); imageUp = new MpeImage(spinner.imageUp); imageDown = new MpeImage(spinner.imageDown); imageGroup = new MpeGroup(spinner.imageGroup); items = new MpeItemManager(spinner.items); items.TypeChanging += new MpeItemManager.TypeChangingHandler(OnItemTypeChanging); items.Values.ItemInserted += new MpeItemCollection.ItemInsertedHandler(OnItemInserted); items.Values.ItemRemoved += new MpeItemCollection.ItemRemovedHandler(OnItemRemoved); items.Values.ItemSet += new MpeItemCollection.ItemSetHandler(OnItemSet); items.Values.ItemsCleared += new MpeItemCollection.ItemsClearedHandler(OnItemsCleared); SetLabel(); Prepare(); }
public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference) { base.Save(doc, node, parser, reference); MpeSpinButton spin = null; if (reference != null && reference is MpeSpinButton) { spin = (MpeSpinButton)reference; } // Fix the Width and Height to be the texture size parser.SetInt(doc, node, "width", TextureSize.Width); parser.SetInt(doc, node, "height", TextureSize.Height); // Font if (spin == null || !spin.Font.Name.Equals(Font.Name)) { parser.SetValue(doc, node, "font", Font.Name); } // Alignment if (spin == null || spin.Alignment != Alignment) { parser.SetValue(doc, node, "align", Alignment.ToString().ToLower()); } // Color if (spin == null || spin.Color != Color) { parser.SetColor(doc, node, "textcolor", Color); } // DisabledColor if (spin == null || spin.DisabledColor != DisabledColor) { parser.SetColor(doc, node, "disabledcolor", DisabledColor); } // Orientation if (spin == null || spin.Orientation != Orientation) { parser.SetValue(doc, node, "orientation", Orientation.ToString().ToLower()); } // Reverse if (spin == null || spin.Reverse != Reverse) { parser.SetValue(doc, node, "reverse", Reverse ? "yes" : "no"); } // ShowRange if (spin == null || spin.ShowRange != ShowRange) { parser.SetValue(doc, node, "showrange", ShowRange ? "yes" : "no"); } // Textures if (spin == null || spin.TextureUp == null || spin.TextureUp.Equals(TextureUp) == false) { if (TextureUp == null) { parser.SetValue(doc, node, "textureUp", "-"); } else { parser.SetValue(doc, node, "textureUp", TextureUp.Name); } } if (spin == null || spin.TextureUpFocus == null || spin.TextureUpFocus.Equals(TextureUpFocus) == false) { if (TextureUpFocus == null) { parser.SetValue(doc, node, "textureUpFocus", "-"); } else { parser.SetValue(doc, node, "textureUpFocus", TextureUpFocus.Name); } } if (spin == null || spin.TextureDown == null || spin.TextureDown.Equals(TextureDown) == false) { if (TextureDown == null) { parser.SetValue(doc, node, "textureDown", "-"); } else { parser.SetValue(doc, node, "textureDown", TextureDown.Name); } } if (spin == null || spin.TextureDownFocus == null || spin.TextureDownFocus.Equals(TextureDownFocus) == false) { if (TextureDownFocus == null) { parser.SetValue(doc, node, "textureDownFocus", "-"); } else { parser.SetValue(doc, node, "textureDownFocus", TextureDownFocus.Name); } } // Items parser.SetValue(doc, node, "subtype", items.Type.ToString().ToLower()); XmlElement subitems = doc.CreateElement("subitems"); parser.SetValue(doc, subitems, "type", items.Type.ToString().ToLower()); parser.SetValue(doc, subitems, "first", items.First); parser.SetValue(doc, subitems, "last", items.Last); parser.SetValue(doc, subitems, "interval", items.Interval); parser.SetValue(doc, subitems, "digits", items.Digits); node.AppendChild(subitems); }
public override void Load(XPathNodeIterator iterator, MpeParser parser) { MpeLog.Debug("MpeTextArea.Load()"); base.Load(iterator, parser); this.parser = parser; Controls.Clear(); Padding = parser.GetPadding(iterator, "mpe/padding", Padding); Spacing = parser.GetInt(iterator, "mpe/spacing", Spacing); Left -= Padding.Left; Top -= Padding.Top; label = (MpeLabel) parser.CreateControl(MpeControlType.Label); if (label != null) { label.Lookup = false; label.Embedded = true; label.AutoSize = false; label.Font = parser.GetFont(iterator, "font", label.Font); label.DisabledColor = parser.GetColor(iterator, "disabledcolor", label.DisabledColor); label.TextColor = parser.GetColor(iterator, "textcolor", label.TextColor); label.Text = parser.GetString(iterator, "text", label.Text); Controls.Add(label); } spinButton = (MpeSpinButton) parser.CreateControl(MpeControlType.SpinButton); if (spinButton != null) { spinButton.Embedded = true; spinButton.Color = parser.GetColor(iterator, "SpinColor", spinButton.Color); int w = parser.GetInt(iterator, "SpinWidth", spinButton.TextureSize.Width); int h = parser.GetInt(iterator, "SpinHeight", spinButton.TextureSize.Height); spinButton.TextureSize = new Size(w, h); spinButton.TextureUp = parser.GetImageFile(iterator, "textureUp", spinButton.TextureUp); spinButton.TextureUpFocus = parser.GetImageFile(iterator, "textureUpFocus", spinButton.TextureUpFocus); spinButton.TextureDown = parser.GetImageFile(iterator, "textureDown", spinButton.TextureDown); spinButton.TextureDownFocus = parser.GetImageFile(iterator, "textureDownFocus", spinButton.TextureDownFocus); SpinAlign = parser.GetAlignment(iterator, "SpinAlign", SpinAlign); Controls.Add(spinButton); } Width += Padding.Width; Height += Padding.Height + Spacing + spinButton.Height; // Remove known tags tags.Remove("align"); tags.Remove("font"); tags.Remove("textcolor"); tags.Remove("disabledcolor"); tags.Remove("text"); tags.Remove("textureDown"); tags.Remove("textureDownFocus"); tags.Remove("textureUp"); tags.Remove("textureUpFocus"); tags.Remove("spinAlign"); tags.Remove("spinColor"); tags.Remove("spinWidth"); tags.Remove("spinHeight"); tags.Remove("spinPosX"); tags.Remove("spinPosY"); tags.Remove("SpinAlign"); tags.Remove("SpinColor"); tags.Remove("SpinWidth"); tags.Remove("SpinHeight"); tags.Remove("SpinPosX"); tags.Remove("SpinPosY"); Modified = false; }
public override void Load(XPathNodeIterator iterator, MpeParser parser) { MpeLog.Debug("MpeTextArea.Load()"); base.Load(iterator, parser); this.parser = parser; Controls.Clear(); Padding = parser.GetPadding(iterator, "mpe/padding", Padding); Spacing = parser.GetInt(iterator, "mpe/spacing", Spacing); Left -= Padding.Left; Top -= Padding.Top; label = (MpeLabel)parser.CreateControl(MpeControlType.Label); if (label != null) { label.Lookup = false; label.Embedded = true; label.AutoSize = false; label.Font = parser.GetFont(iterator, "font", label.Font); label.DisabledColor = parser.GetColor(iterator, "disabledcolor", label.DisabledColor); label.TextColor = parser.GetColor(iterator, "textcolor", label.TextColor); label.Text = parser.GetString(iterator, "text", label.Text); Controls.Add(label); } spinButton = (MpeSpinButton)parser.CreateControl(MpeControlType.SpinButton); if (spinButton != null) { spinButton.Embedded = true; spinButton.Color = parser.GetColor(iterator, "SpinColor", spinButton.Color); int w = parser.GetInt(iterator, "SpinWidth", spinButton.TextureSize.Width); int h = parser.GetInt(iterator, "SpinHeight", spinButton.TextureSize.Height); spinButton.TextureSize = new Size(w, h); spinButton.TextureUp = parser.GetImageFile(iterator, "textureUp", spinButton.TextureUp); spinButton.TextureUpFocus = parser.GetImageFile(iterator, "textureUpFocus", spinButton.TextureUpFocus); spinButton.TextureDown = parser.GetImageFile(iterator, "textureDown", spinButton.TextureDown); spinButton.TextureDownFocus = parser.GetImageFile(iterator, "textureDownFocus", spinButton.TextureDownFocus); SpinAlign = parser.GetAlignment(iterator, "SpinAlign", SpinAlign); Controls.Add(spinButton); } Width += Padding.Width; Height += Padding.Height + Spacing + spinButton.Height; // Remove known tags tags.Remove("align"); tags.Remove("font"); tags.Remove("textcolor"); tags.Remove("disabledcolor"); tags.Remove("text"); tags.Remove("textureDown"); tags.Remove("textureDownFocus"); tags.Remove("textureUp"); tags.Remove("textureUpFocus"); tags.Remove("spinAlign"); tags.Remove("spinColor"); tags.Remove("spinWidth"); tags.Remove("spinHeight"); tags.Remove("spinPosX"); tags.Remove("spinPosY"); tags.Remove("SpinAlign"); tags.Remove("SpinColor"); tags.Remove("SpinWidth"); tags.Remove("SpinHeight"); tags.Remove("SpinPosX"); tags.Remove("SpinPosY"); Modified = false; }