private bool IsVisible(IOurFormButtonBase buttonBase) { switch (buttonBase.State) { case OurFormButtonStates.Disabled: case OurFormButtonStates.Shown: return true; case OurFormButtonStates.Hidden: return false; default: throw new ArgumentOutOfRangeException(nameof(buttonBase.State), buttonBase.State, "Something F****d Up.."); } }
private void PaintButton(IOurFormButtonBase buttonBase, Graphics g, ref Pen p, ref SolidBrush sB, Rectangle r) { if (buttonBase.State == OurFormButtonStates.Hidden) { return; } this.PaintButton( buttonBase.State != OurFormButtonStates.Disabled ? buttonBase.Normal : buttonBase.Disabled, g, ref p, ref sB, r); }
private bool ControlBoxContains(IOurFormButtonBase buttonBase, Point p, Rectangle r) { // Might have an issue with this... if (!this.IsVisible(buttonBase) || !r.Contains(p)) { return false; } this._mouseIsOver = buttonBase.ButtonBounds; this._mouseAction = buttonBase.State != OurFormButtonStates.Disabled /* * The extra Trenary is required otherwise when the mouse is clicked * is the _mouseAction would always of been set to MouseAction.Hover */ ? this._mouseAction == MouseAction.Click ? this._mouseAction : MouseAction.Hover : MouseAction.None; return true; }