void HandleButtonStyle(XmlNode xnode) { string name = GetStrParam(xnode, "name", "DefaultButton"); ButtonStyle bt = GetButtonStyle(name); if (bt == null) { bt = new ButtonStyle(); bt.Name = name; ControlStyles[name] = bt; bt.SetDefault(); } UpdateStyle(xnode, bt); bt.CheckedColor = GetColorParam(xnode, "checkcolor", bt.CheckedColor); bt.HoverColor = GetColorParam(xnode, "hovercolor", bt.HoverColor); bt.PressedColor = GetColorParam(xnode, "presscolor", bt.PressedColor); bt.SubImgCount = GetIntParam(xnode, "nimages", bt.SubImgCount); bt.BackImage = GetStrParam(xnode, "backimage", bt.BackImage); bt.CheckedImage = GetStrParam(xnode, "checkimage", bt.CheckedImage); bt.DisabledColor = GetColorParam(xnode, "disablecolor", bt.DisabledColor); if (name == "DefaultButton") { foreach (KeyValuePair<String, ctlImageButton> pair in Buttons) { ctlImageButton butt = pair.Value; butt.ApplyStyle(DefaultButtonStyle); } } }
public GuiConfig() { BgndDecorList = new List<DecorItem>(); FgndDecorList = new List<DecorItem>(); Controls = new Dictionary<string, ctlUserPanel>(); Buttons = new Dictionary<string, ctlImageButton>(); ControlStyles = new Dictionary<string, ControlStyle>(); Res = global::UV_DLP_3D_Printer.Properties.Resources.ResourceManager; Plugin = null; DefaultButtonStyle = new ButtonStyle(); DefaultButtonStyle.Name = "DefaultButton"; DefaultButtonStyle.SetDefault(); DefaultControlStyle = new ControlStyle(); DefaultControlStyle.Name = "DefaultControl"; DefaultControlStyle.SetDefault(); ControlStyles[DefaultButtonStyle.Name] = DefaultButtonStyle; ControlStyles[DefaultControlStyle.Name] = DefaultControlStyle; }