Interface ISearchView
Search view interface used by the search context to execute a few UI operations.
Namespace: Unity.QuickSearch
Syntax
public interface ISearchView
Properties
context
Returns the current view search context
Declaration
SearchContext context { get; }
Property Value
Type | Description |
---|---|
SearchContext |
displayMode
Indicates how the data is displayed in the UI.
Declaration
DisplayMode displayMode { get; }
Property Value
Type | Description |
---|---|
DisplayMode |
filterCallback
Callback used to filter items shown in the list.
Declaration
Func<SearchItem, bool> filterCallback { get; }
Property Value
Type | Description |
---|---|
Func<SearchItem, Boolean> |
itemIconSize
Defines the size of items in the search view.
Declaration
float itemIconSize { get; set; }
Property Value
Type | Description |
---|---|
Single |
multiselect
Allow multi-selection or not.
Declaration
bool multiselect { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
results
Return the list of all search results.
Declaration
ISearchList results { get; }
Property Value
Type | Description |
---|---|
ISearchList |
selectCallback
Callback used to override the select behavior.
Declaration
Action<SearchItem, bool> selectCallback { get; }
Property Value
Type | Description |
---|---|
Action<SearchItem, Boolean> |
selection
Returns the selected item in the view
Declaration
SearchSelection selection { get; }
Property Value
Type | Description |
---|---|
SearchSelection |
trackingCallback
Callback used to override the tracking behavior.
Declaration
Action<SearchItem> trackingCallback { get; }
Property Value
Type | Description |
---|---|
Action<SearchItem> |
Methods
AddSelection(Int32[])
Add new items to the current selection
Declaration
void AddSelection(params int[] selection)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | selection | Array of item indices to add to selection |
Close()
Close the search view
Declaration
void Close()
ExecuteAction(SearchAction, SearchItem[], Boolean)
Execute a Search Action on a given list of items.
Declaration
void ExecuteAction(SearchAction action, SearchItem[] items, bool endSearch = true)
Parameters
Type | Name | Description |
---|---|---|
SearchAction | action | Action to execute. |
SearchItem[] | items | Items to apply the action on. |
Boolean | endSearch | If true, executing this action will close the Quicksearch window. |
Focus()
Make sure the search is now focused.
Declaration
void Focus()
PopFilterWindow()
Open the associated filter window.
Declaration
void PopFilterWindow()
Refresh()
Triggers a refresh of the search view, re-fetching all the search items from enabled search providers.
Declaration
void Refresh()
Repaint()
Request the search view to repaint itself
Declaration
void Repaint()
SelectSearch()
Request to focus and select the search field.
Declaration
void SelectSearch()
SetSearchText(String, TextCursorPlacement)
Sets the search query text.
Declaration
void SetSearchText(string searchText, TextCursorPlacement moveCursor = TextCursorPlacement.MoveLineEnd)
Parameters
Type | Name | Description |
---|---|---|
String | searchText | Text to be displayed in the search view. |
TextCursorPlacement | moveCursor | Where to place the cursor after having set the search text |
SetSelection(Int32[])
Update the search view with a new selection.
Declaration
void SetSelection(params int[] selection)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | selection | Array of item indices to select |
ShowItemContextualMenu(SearchItem, Rect)
Show a contextual menu for the specified item.
Declaration
void ShowItemContextualMenu(SearchItem item, Rect contextualActionPosition)
Parameters
Type | Name | Description |
---|---|---|
SearchItem | item | Item affected by the contextual menu. |
Rect | contextualActionPosition | Where the menu should be drawn on screen (generally item position) |