/// </summary> /// Initializes the skin for the button control. /// </summary> protected internal override void InitSkin() { base.InitSkin(); Skin = new SkinControl(Manager.Skin.Controls[skButton]); }
/// </summary> /// </summary> private void LoadControls() { if (doc["Skin"]["Controls"] == null) { return; } var l = doc["Skin"]["Controls"].GetElementsByTagName("Control"); if (l != null && l.Count > 0) { foreach (XmlElement e in l) { SkinControl sc = null; var parent = ReadAttribute(e, "Inherits", null, false); var inh = false; if (parent != null) { sc = new SkinControl(controls[parent]); sc.Inherits = parent; inh = true; } else { sc = new SkinControl(); } ReadAttribute(ref sc.Name, inh, e, "Name", null, true); ReadAttributeInt(ref sc.DefaultSize.Width, inh, e["DefaultSize"], "Width", 0, false); ReadAttributeInt(ref sc.DefaultSize.Height, inh, e["DefaultSize"], "Height", 0, false); ReadAttributeInt(ref sc.MinimumSize.Width, inh, e["MinimumSize"], "Width", 0, false); ReadAttributeInt(ref sc.MinimumSize.Height, inh, e["MinimumSize"], "Height", 0, false); ReadAttributeInt(ref sc.OriginMargins.Left, inh, e["OriginMargins"], "Left", 0, false); ReadAttributeInt(ref sc.OriginMargins.Top, inh, e["OriginMargins"], "Top", 0, false); ReadAttributeInt(ref sc.OriginMargins.Right, inh, e["OriginMargins"], "Right", 0, false); ReadAttributeInt(ref sc.OriginMargins.Bottom, inh, e["OriginMargins"], "Bottom", 0, false); ReadAttributeInt(ref sc.ClientMargins.Left, inh, e["ClientMargins"], "Left", 0, false); ReadAttributeInt(ref sc.ClientMargins.Top, inh, e["ClientMargins"], "Top", 0, false); ReadAttributeInt(ref sc.ClientMargins.Right, inh, e["ClientMargins"], "Right", 0, false); ReadAttributeInt(ref sc.ClientMargins.Bottom, inh, e["ClientMargins"], "Bottom", 0, false); ReadAttributeInt(ref sc.ResizerSize, inh, e["ResizerSize"], "Value", 0, false); if (e["Layers"] != null) { var l2 = e["Layers"].GetElementsByTagName("Layer"); if (l2 != null && l2.Count > 0) { LoadLayers(sc, l2); } } if (e["Attributes"] != null) { var l3 = e["Attributes"].GetElementsByTagName("Attribute"); if (l3 != null && l3.Count > 0) { LoadControlAttributes(sc, l3); } } controls.Add(sc); } } }
/// <summary> /// Initializes the skin of the tool bar control. /// </summary> protected internal override void InitSkin() { base.InitSkin(); Skin = new SkinControl(Manager.Skin.Controls["ToolBar"]); }
/// <param name="l"></param> /// <param name="sc"></param> /// </summary> /// </summary> private void LoadLayers(SkinControl sc, XmlNodeList l) { foreach (XmlElement e in l) { var name = ReadAttribute(e, "Name", null, true); var over = ReadAttributeBool(e, "Override", false, false); var sl = sc.Layers[name]; var inh = true; if (sl == null) { sl = new SkinLayer(); inh = false; } if (inh && over) { sl = new SkinLayer(); sc.Layers[name] = sl; } ReadAttribute(ref sl.Name, inh, e, "Name", null, true); ReadAttribute(ref sl.Image.Name, inh, e, "Image", "Control", false); ReadAttributeInt(ref sl.Width, inh, e, "Width", 0, false); ReadAttributeInt(ref sl.Height, inh, e, "Height", 0, false); var tmp = sl.Alignment.ToString(); ReadAttribute(ref tmp, inh, e, "Alignment", "MiddleCenter", false); sl.Alignment = (Alignment)Enum.Parse(typeof(Alignment), tmp, true); ReadAttributeInt(ref sl.OffsetX, inh, e, "OffsetX", 0, false); ReadAttributeInt(ref sl.OffsetY, inh, e, "OffsetY", 0, false); ReadAttributeInt(ref sl.SizingMargins.Left, inh, e["SizingMargins"], "Left", 0, false); ReadAttributeInt(ref sl.SizingMargins.Top, inh, e["SizingMargins"], "Top", 0, false); ReadAttributeInt(ref sl.SizingMargins.Right, inh, e["SizingMargins"], "Right", 0, false); ReadAttributeInt(ref sl.SizingMargins.Bottom, inh, e["SizingMargins"], "Bottom", 0, false); ReadAttributeInt(ref sl.ContentMargins.Left, inh, e["ContentMargins"], "Left", 0, false); ReadAttributeInt(ref sl.ContentMargins.Top, inh, e["ContentMargins"], "Top", 0, false); ReadAttributeInt(ref sl.ContentMargins.Right, inh, e["ContentMargins"], "Right", 0, false); ReadAttributeInt(ref sl.ContentMargins.Bottom, inh, e["ContentMargins"], "Bottom", 0, false); if (e["States"] != null) { ReadAttributeInt(ref sl.States.Enabled.Index, inh, e["States"]["Enabled"], "Index", 0, false); var di = sl.States.Enabled.Index; ReadAttributeInt(ref sl.States.Hovered.Index, inh, e["States"]["Hovered"], "Index", di, false); ReadAttributeInt(ref sl.States.Pressed.Index, inh, e["States"]["Pressed"], "Index", di, false); ReadAttributeInt(ref sl.States.Focused.Index, inh, e["States"]["Focused"], "Index", di, false); ReadAttributeInt(ref sl.States.Disabled.Index, inh, e["States"]["Disabled"], "Index", di, false); ReadAttributeColor(ref sl.States.Enabled.Color, inh, e["States"]["Enabled"], "Color", Color.White, false); var dc = sl.States.Enabled.Color; ReadAttributeColor(ref sl.States.Hovered.Color, inh, e["States"]["Hovered"], "Color", dc, false); ReadAttributeColor(ref sl.States.Pressed.Color, inh, e["States"]["Pressed"], "Color", dc, false); ReadAttributeColor(ref sl.States.Focused.Color, inh, e["States"]["Focused"], "Color", dc, false); ReadAttributeColor(ref sl.States.Disabled.Color, inh, e["States"]["Disabled"], "Color", dc, false); ReadAttributeBool(ref sl.States.Enabled.Overlay, inh, e["States"]["Enabled"], "Overlay", false, false); var dv = sl.States.Enabled.Overlay; ReadAttributeBool(ref sl.States.Hovered.Overlay, inh, e["States"]["Hovered"], "Overlay", dv, false); ReadAttributeBool(ref sl.States.Pressed.Overlay, inh, e["States"]["Pressed"], "Overlay", dv, false); ReadAttributeBool(ref sl.States.Focused.Overlay, inh, e["States"]["Focused"], "Overlay", dv, false); ReadAttributeBool(ref sl.States.Disabled.Overlay, inh, e["States"]["Disabled"], "Overlay", dv, false); } if (e["Overlays"] != null) { ReadAttributeInt(ref sl.Overlays.Enabled.Index, inh, e["Overlays"]["Enabled"], "Index", 0, false); var di = sl.Overlays.Enabled.Index; ReadAttributeInt(ref sl.Overlays.Hovered.Index, inh, e["Overlays"]["Hovered"], "Index", di, false); ReadAttributeInt(ref sl.Overlays.Pressed.Index, inh, e["Overlays"]["Pressed"], "Index", di, false); ReadAttributeInt(ref sl.Overlays.Focused.Index, inh, e["Overlays"]["Focused"], "Index", di, false); ReadAttributeInt(ref sl.Overlays.Disabled.Index, inh, e["Overlays"]["Disabled"], "Index", di, false); ReadAttributeColor(ref sl.Overlays.Enabled.Color, inh, e["Overlays"]["Enabled"], "Color", Color.White, false); var dc = sl.Overlays.Enabled.Color; ReadAttributeColor(ref sl.Overlays.Hovered.Color, inh, e["Overlays"]["Hovered"], "Color", dc, false); ReadAttributeColor(ref sl.Overlays.Pressed.Color, inh, e["Overlays"]["Pressed"], "Color", dc, false); ReadAttributeColor(ref sl.Overlays.Focused.Color, inh, e["Overlays"]["Focused"], "Color", dc, false); ReadAttributeColor(ref sl.Overlays.Disabled.Color, inh, e["Overlays"]["Disabled"], "Color", dc, false); } if (e["Text"] != null) { ReadAttribute(ref sl.Text.Name, inh, e["Text"], "Font", null, true); ReadAttributeInt(ref sl.Text.OffsetX, inh, e["Text"], "OffsetX", 0, false); ReadAttributeInt(ref sl.Text.OffsetY, inh, e["Text"], "OffsetY", 0, false); tmp = sl.Text.Alignment.ToString(); ReadAttribute(ref tmp, inh, e["Text"], "Alignment", "MiddleCenter", false); sl.Text.Alignment = (Alignment)Enum.Parse(typeof(Alignment), tmp, true); LoadColors(inh, e["Text"], ref sl.Text.Colors); } if (e["Attributes"] != null) { var l2 = e["Attributes"].GetElementsByTagName("Attribute"); if (l2 != null && l2.Count > 0) { LoadLayerAttributes(sl, l2); } } if (!inh) { sc.Layers.Add(sl); } } }