-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bonsai-rx/feature-dev
Add two way binding for check button state
- Loading branch information
Showing
12 changed files
with
78 additions
and
75 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,26 +1,9 @@ | ||
using System.ComponentModel; | ||
using System.Reactive.Subjects; | ||
|
||
namespace Bonsai.Gui | ||
namespace Bonsai.Gui | ||
{ | ||
/// <summary> | ||
/// Provides an abstract base class with common button control functionality. | ||
/// </summary> | ||
/// <inheritdoc/> | ||
[DefaultProperty(nameof(Text))] | ||
public abstract class ButtonBuilderBase<TEvent> : ControlBuilderBase<TEvent> | ||
public abstract class ButtonBuilderBase<TEvent> : TextControlBuilderBase<TEvent> | ||
{ | ||
internal readonly BehaviorSubject<string> _Text = new(string.Empty); | ||
|
||
/// <summary> | ||
/// Gets or sets the text associated with this control. | ||
/// </summary> | ||
[Category(nameof(CategoryAttribute.Appearance))] | ||
[Description("The text associated with this control.")] | ||
public string Text | ||
{ | ||
get => _Text.Value; | ||
set => _Text.OnNext(value); | ||
} | ||
} | ||
} |
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
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
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
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,31 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Reactive.Subjects; | ||
|
||
namespace Bonsai.Gui | ||
{ | ||
/// <summary> | ||
/// Provides an abstract base class with common check button control functionality. | ||
/// </summary> | ||
public class CheckButtonBuilderBase : ButtonBuilderBase<bool> | ||
{ | ||
internal readonly BehaviorSubject<bool> _Checked = new(false); | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the button is checked. | ||
/// </summary> | ||
[Category(nameof(CategoryAttribute.Appearance))] | ||
[Description("Indicates whether the button is checked.")] | ||
public bool Checked | ||
{ | ||
get => _Checked.Value; | ||
set => _Checked.OnNext(value); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override IObservable<bool> Generate() | ||
{ | ||
return _Checked; | ||
} | ||
} | ||
} |
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
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
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
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
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
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
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