protected override void UpdateLayout() { skin = Enabled ? (down ? skinPressed : (over ? skinHover : skinEnabled)) : skinDisabled; outer.Width = Math.Min(Math.Max(outer.Width, sizeMin.Width), sizeMax.Width); int innerWidth = outer.Width - skin.Border.Horizontal; textSize = skin.Font.ProcessText(textProcessed, text, skin.TextAlign); int minHeight = Math.Max(sizeMin.Height, (int)textSize.Height + skin.Border.Vertical); if (AutoSize) { innerWidth = (int)textSize.Width; outer.Width = innerWidth + skin.Border.Horizontal; outer.Height = minHeight; outer.Width = Math.Min(Math.Max(outer.Width, sizeMin.Width), sizeMax.Width); } outer.Height = Math.Min(Math.Max(outer.Height, minHeight), sizeMax.Height); Inner = new Rectangle( skin.Border.Left, skin.Border.Top, innerWidth, outer.Height - skin.Border.Vertical); }
public GLButton(GLGui gui) : base(gui) { Render += OnRender; MouseDown += OnMouseDown; MouseUp += OnMouseUp; MouseEnter += OnMouseEnter; MouseLeave += OnMouseLeave; skinEnabled = Gui.Skin.ButtonEnabled; skinPressed = Gui.Skin.ButtonPressed; skinHover = Gui.Skin.ButtonHover; skinDisabled = Gui.Skin.ButtonDisabled; outer = new Rectangle(0, 0, 75, 0); sizeMin = new Size(8, 8); sizeMax = new Size(int.MaxValue, int.MaxValue); }