-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added classes to represent a toggle button.
- Loading branch information
1 parent
7ed67c2
commit f9dd014
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/BetterControls/BetterToolbar/Items/BetterToolbarToggleButton.NativeStructures.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/BetterControls/BetterToolbar/Items/BetterToolbarToggleButton.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
{ } | ||
} | ||
} |