Skip to content

Commit

Permalink
Added classes to represent a toggle button.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiehighfield committed May 19, 2022
1 parent 7ed67c2 commit f9dd014
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace BetterControls
{
/// <summary>
/// Represents a toolbar item that is a toggle button.
/// </summary>
partial class BetterToolbarToggleButton
{
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <returns><inheritdoc/></returns>
internal override NativeMethods.TBBUTTON ComputeTbButton()
{
NativeMethods.TBBUTTON button = base.ComputeTbButton();

button.fsStyle = NativeMethods.TBSTYLE_CHECK | 0x0010;

return button;
}

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <returns><inheritdoc/></returns>
internal override NativeMethods.TBBUTTONINFO ComputeTbButtonInfo()
{
NativeMethods.TBBUTTONINFO button = base.ComputeTbButtonInfo();

button.fsStyle = NativeMethods.TBSTYLE_CHECK | 0x0010;

return button;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace BetterControls
{
/// <summary>
/// Represents a toolbar item that is a toggle button.
/// </summary>
public partial class BetterToolbarToggleButton : BetterToolbarClickableButton
{
/// <summary>
/// Initialize a new instance of <see cref="BetterToolbarToggleButton"/>.
/// </summary>
public BetterToolbarToggleButton() { }

/// <summary>
/// Initialize a new instance of <see cref="BetterToolbarToggleButton"/>.
/// </summary>
/// <param name="text">The text of the button.</param>
public BetterToolbarToggleButton(string text)
: base(text)
{ }

/// <summary>
/// Initialize a new instance of <see cref="BetterToolbarToggleButton"/>.
/// </summary>
/// <param name="text">The text of the button.</param>
/// <param name="description">The description of the button.</param>
public BetterToolbarToggleButton(string text, string description)
: base(text, description)
{ }

/// <summary>
/// Initialize a new instance of <see cref="BetterToolbarToggleButton"/>.
/// </summary>
/// <param name="text">The text of the button.</param>
/// <param name="imageIndex">The index of the image from the toolbar image list to be shown in the button.</param>
public BetterToolbarToggleButton(string text, int imageIndex)
: base(text, imageIndex)
{ }

/// <summary>
/// Initialize a new instance of <see cref="BetterToolbarToggleButton"/>.
/// </summary>
/// <param name="text">The text of the button.</param>
/// <param name="description">The description of the button.</param>
/// <param name="imageIndex">The index of the image from the toolbar image list to be shown in the button.</param>
public BetterToolbarToggleButton(string text, string description, int imageIndex)
: base(text, description, imageIndex)
{ }

/// <summary>
/// Initialize a new instance of <see cref="BetterToolbarToggleButton"/>.
/// </summary>
/// <param name="ownerToolbar">The owner toolbar as an instance of <see cref="BetterToolbar"/>.</param>
private protected BetterToolbarToggleButton(BetterToolbar ownerToolbar)
: base(ownerToolbar)
{ }
}
}

0 comments on commit f9dd014

Please sign in to comment.