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; }
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); } } }
void GLPaint1(C2DGraphics gr, ButtonStyle stl) { if (Enabled == false) { gr.SetColor(stl.DisabledColor); } else { switch (mCtlState) { case CtlState.Hover: if (Checked) gr.SetColor(stl.CheckedColor); else gr.SetColor(stl.HoverColor); break; case CtlState.Normal: if (Checked) gr.SetColor(stl.CheckedColor); else gr.SetColor(stl.ForeColor); break; case CtlState.Pressed: gr.SetColor(stl.PressedColor); break; } } if (mCtlState == CtlState.Hover) { float scx = (float)Width / 16f; float scy = (float)Height / 16f; gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, -scx, -scy, Width + 2f * scx, Height + 2f * scy); } else { gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height); } }