Skip to content

Commit

Permalink
Merge pull request #127 from orapps44/patch-1
Browse files Browse the repository at this point in the history
Expect a updated nuget soon :)
  • Loading branch information
leocb authored Jan 17, 2021
2 parents ba0316b + efa2770 commit 9d8355d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion MaterialSkin/Controls/MaterialForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ private enum ButtonState
XOver,
MaxOver,
MinOver,
DrawerOver,
XDown,
MaxDown,
MinDown,
DrawerDown,
None
}

Expand All @@ -158,6 +160,7 @@ private enum ButtonState
private Rectangle _maxButtonBounds;
private Rectangle _xButtonBounds;
private Rectangle _actionBarBounds;
private Rectangle _drawerButtonBounds;

public Rectangle UserArea
{
Expand Down Expand Up @@ -680,6 +683,8 @@ private void UpdateButtons(MouseEventArgs e, bool up = false)
_buttonState = ButtonState.MaxDown;
else if (ControlBox && _xButtonBounds.Contains(e.Location))
_buttonState = ButtonState.XDown;
else if (_drawerButtonBounds.Contains(e.Location))
_buttonState = ButtonState.DrawerDown;
else
_buttonState = ButtonState.None;
}
Expand Down Expand Up @@ -713,8 +718,16 @@ private void UpdateButtons(MouseEventArgs e, bool up = false)
if (oldState == ButtonState.XDown && up)
Close();
}
else if (_drawerButtonBounds.Contains(e.Location))
{
_buttonState = ButtonState.DrawerOver;
Cursor = Cursors.Hand;
}
else
{
Cursor = Cursors.Default;
_buttonState = ButtonState.None;
}
}

if (oldState != _buttonState)
Expand Down Expand Up @@ -799,6 +812,7 @@ protected override void OnResize(EventArgs e)
_xButtonBounds = new Rectangle((Width) - STATUS_BAR_BUTTON_WIDTH, 0, STATUS_BAR_BUTTON_WIDTH, STATUS_BAR_HEIGHT);
_statusBarBounds = new Rectangle(0, 0, Width, STATUS_BAR_HEIGHT);
_actionBarBounds = new Rectangle(0, STATUS_BAR_HEIGHT, Width, ACTION_BAR_HEIGHT);
_drawerButtonBounds = new Rectangle(SkinManager.FORM_PADDING / 2, STATUS_BAR_HEIGHT, 24 + SkinManager.FORM_PADDING + SkinManager.FORM_PADDING / 2, ACTION_BAR_HEIGHT);
}

protected override void OnPaint(PaintEventArgs e)
Expand Down Expand Up @@ -895,6 +909,12 @@ protected override void OnPaint(PaintEventArgs e)
// Drawer Icon
if (DrawerTabControl != null)
{
if (_buttonState == ButtonState.DrawerOver)
g.FillRectangle(hoverBrush, _drawerButtonBounds);

if (_buttonState == ButtonState.DrawerDown)
g.FillRectangle(downBrush, _drawerButtonBounds);

_drawerIconRect = new Rectangle(SkinManager.FORM_PADDING / 2, STATUS_BAR_HEIGHT, 24 + SkinManager.FORM_PADDING + SkinManager.FORM_PADDING / 2, ACTION_BAR_HEIGHT);
// Ripple
if (_clickAnimManager.IsAnimating())
Expand Down Expand Up @@ -995,4 +1015,4 @@ public bool PreFilterMessage(ref Message m)
return false;
}
}
}
}

0 comments on commit 9d8355d

Please sign in to comment.