Skip to content

Commit

Permalink
Show toolbar grips (#9586)
Browse files Browse the repository at this point in the history
  • Loading branch information
RussKie committed Sep 23, 2021
1 parent 18c9f86 commit 6f9bf27
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 2 additions & 2 deletions GitUI/CommandsDialogs/FormBrowse.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions GitUI/CommandsDialogs/FormBrowse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,9 +1163,11 @@ void LoadUserMenu()

if (scripts.Count == 0)
{
ToolStripScripts.GripStyle = ToolStripGripStyle.Hidden;
return;
}

ToolStripScripts.GripStyle = ToolStripGripStyle.Visible;
foreach (var script in scripts)
{
ToolStripButton button = new()
Expand Down
2 changes: 1 addition & 1 deletion GitUI/UserControls/FilterToolBar.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions GitUI/UserControls/ToolStripEx.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms;

namespace GitUI
Expand All @@ -9,6 +10,16 @@ namespace GitUI
/// </summary>
public class ToolStripEx : ToolStrip, IToolStripEx
{
private readonly ToolStripButton _gripButton;

public ToolStripEx()
{
this.UseCustomRenderer();

PropertyInfo propGrip = GetType().GetProperty("Grip", BindingFlags.Instance | BindingFlags.NonPublic);
_gripButton = propGrip.GetValue(this) as ToolStripButton;
}

/// <summary>
/// Gets or sets whether the ToolStripEx honors item clicks when its containing form does
/// not have input focus.
Expand All @@ -25,9 +36,15 @@ public class ToolStripEx : ToolStrip, IToolStripEx
[DefaultValue(true)]
public bool DrawBorder { get; set; } = true;

public ToolStripEx()
/// <summary>
/// Gets or sets whether the ToolStrip grip button is enabled.
/// </summary>
[Category("Appearance")]
[DefaultValue(true)]
public bool GripEnabled
{
this.UseCustomRenderer();
get => _gripButton.Enabled;
set => _gripButton.Enabled = value;
}

protected override void WndProc(ref Message m)
Expand Down

0 comments on commit 6f9bf27

Please sign in to comment.