-
Notifications
You must be signed in to change notification settings - Fork 689
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into v1_showcase
- Loading branch information
Showing
4 changed files
with
40 additions
and
14 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
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 |
---|---|---|
|
@@ -5,10 +5,10 @@ | |
// Ross Ferguson ([email protected]) | ||
// | ||
|
||
using NStack; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NStack; | ||
|
||
namespace Terminal.Gui { | ||
/// <summary> | ||
|
@@ -39,10 +39,7 @@ public ComboListView (ComboBox container, IList source, bool hideDropdownListOnC | |
|
||
private void Initialize (ComboBox container, bool hideDropdownListOnClick) | ||
{ | ||
if (container == null) | ||
throw new ArgumentNullException ("ComboBox container cannot be null.", nameof (container)); | ||
|
||
this.container = container; | ||
this.container = container ?? throw new ArgumentNullException (nameof(container), "ComboBox container cannot be null."); | ||
HideDropdownListOnClick = hideDropdownListOnClick; | ||
} | ||
|
||
|
@@ -236,7 +233,7 @@ public void SetSource (IList source) | |
readonly TextField search; | ||
readonly ComboListView listview; | ||
bool autoHide = true; | ||
int minimumHeight = 2; | ||
readonly int minimumHeight = 2; | ||
|
||
/// <summary> | ||
/// Public constructor | ||
|
@@ -721,7 +718,19 @@ public virtual bool Expand () | |
return text; | ||
} | ||
set { | ||
search.Text = text = value; | ||
SetSearchText (value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Current search text | ||
/// </summary> | ||
public ustring SearchText { | ||
get { | ||
return search.Text; | ||
} | ||
set { | ||
SetSearchText (value); | ||
} | ||
} | ||
|
||
|
@@ -775,7 +784,7 @@ private int GetSelectedItemFromSource (ustring value) | |
private void Reset (bool keepSearchText = false) | ||
{ | ||
if (!keepSearchText) { | ||
search.Text = text = ""; | ||
SetSearchText (string.Empty); | ||
} | ||
|
||
ResetSearchSet (); | ||
|
@@ -788,6 +797,11 @@ private void Reset (bool keepSearchText = false) | |
} | ||
} | ||
|
||
private void SetSearchText (ustring value) | ||
{ | ||
search.Text = text = value; | ||
} | ||
|
||
private void ResetSearchSet (bool noCopy = false) | ||
{ | ||
searchset.Clear (); | ||
|
@@ -843,7 +857,7 @@ private void ShowList () | |
listview.SetSource (searchset); | ||
listview.Clear (); // Ensure list shrinks in Dialog as you type | ||
listview.Height = CalculatetHeight (); | ||
this.SuperView?.BringSubviewToFront (this); | ||
SuperView?.BringSubviewToFront (this); | ||
} | ||
|
||
/// <summary> | ||
|
@@ -857,7 +871,7 @@ private void HideList () | |
OnOpenSelectedItem (); | ||
} | ||
var rect = listview.ViewToScreen (listview.Bounds); | ||
Reset (SelectedItem > -1); | ||
Reset (keepSearchText: true); | ||
listview.Clear (rect); | ||
listview.TabStop = false; | ||
SuperView?.SendSubviewToBack (this); | ||
|
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