-
Notifications
You must be signed in to change notification settings - Fork 31
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 #1163 from TestCentric/Issue-1148-2
Add UI elements for test outcome filtering
- Loading branch information
Showing
25 changed files
with
539 additions
and
93 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/TestCentric/testcentric.gui/Elements/IMultiSelection.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,26 @@ | ||
// *********************************************************************** | ||
// Copyright (c) Charlie Poole and TestCentric contributors. | ||
// Licensed under the MIT License. See LICENSE file in root directory. | ||
// *********************************************************************** | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace TestCentric.Gui.Elements | ||
{ | ||
/// <summary> | ||
/// The IMultiSelection interface represents a group of UI elements | ||
/// that allow the user to select a set of items. | ||
/// </summary> | ||
public interface IMultiSelection : IViewElement | ||
{ | ||
/// <summary> | ||
/// Gets or sets the string values of the currently selected items | ||
/// </summary> | ||
IEnumerable<string> SelectedItems { get; set; } | ||
|
||
/// <summary> | ||
/// Event raised when the selection is changed by the user | ||
/// </summary> | ||
event CommandHandler SelectionChanged; | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
src/TestCentric/testcentric.gui/Elements/MultiCheckedToolStripButtonGroup.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,95 @@ | ||
// *********************************************************************** | ||
// Copyright (c) Charlie Poole and TestCentric contributors. | ||
// Licensed under the MIT License. See LICENSE file in root directory. | ||
// *********************************************************************** | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Windows.Forms; | ||
|
||
namespace TestCentric.Gui.Elements | ||
{ | ||
/// <summary> | ||
/// MultiCheckedToolStripButtonGroup wraps a set of ToolStrip button items as an IMultiSelection. | ||
/// </summary> | ||
internal class MultiCheckedToolStripButtonGroup : IMultiSelection | ||
{ | ||
public event CommandHandler SelectionChanged; | ||
|
||
public MultiCheckedToolStripButtonGroup(params ToolStripButton[] buttons) | ||
{ | ||
ToolStripButtons = new List<ToolStripButton>(); | ||
|
||
foreach (var button in buttons) | ||
{ | ||
ToolStripButtons.Add(button); | ||
button.Click += OnButtonClicked; | ||
} | ||
} | ||
|
||
protected IList<ToolStripButton> ToolStripButtons { get; } | ||
|
||
public IEnumerable<string> SelectedItems | ||
{ | ||
get | ||
{ | ||
IList<string> result = new List<string>(); | ||
foreach (ToolStripButton button in ToolStripButtons) | ||
if (button.Checked) | ||
result.Add(button.Tag as string); | ||
|
||
return result; | ||
} | ||
|
||
set | ||
{ | ||
foreach (ToolStripButton button in ToolStripButtons) | ||
{ | ||
bool checkStatus = value.Contains(button.Tag as string); | ||
button.Checked = checkStatus; | ||
} | ||
} | ||
} | ||
|
||
private bool _enabled; | ||
public bool Enabled | ||
{ | ||
get { return _enabled; } | ||
set | ||
{ | ||
_enabled = value; | ||
|
||
foreach (ToolStripButton button in ToolStripButtons) | ||
button.Enabled = value; | ||
} | ||
} | ||
|
||
private bool _visible; | ||
public bool Visible | ||
{ | ||
get { return _visible; } | ||
set | ||
{ | ||
_visible = value; | ||
|
||
foreach (ToolStripButton button in ToolStripButtons) | ||
button.Visible = value; | ||
} | ||
} | ||
|
||
public string Text { get; set; } | ||
|
||
|
||
public void InvokeIfRequired(MethodInvoker _delegate) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
protected virtual void OnButtonClicked(object sender, EventArgs e) | ||
{ | ||
if (SelectionChanged != null) | ||
SelectionChanged(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.