using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Rune = System.Rune; namespace Terminal.Gui { /// /// Renders an overlay on another view at a given point that allows selecting /// from a range of 'autocomplete' options. /// public interface IAutocomplete { /// /// The host control that will use autocomplete. /// View HostControl { get; set; } /// /// Gets or sets where the popup will be displayed. /// bool PopupInsideContainer { get; set; } /// /// The maximum width of the autocomplete dropdown /// int MaxWidth { get; set; } /// /// The maximum number of visible rows in the autocomplete dropdown to render /// int MaxHeight { get; set; } /// /// True if the autocomplete should be considered open and visible /// bool Visible { get; set; } /// /// The strings that form the current list of suggestions to render /// based on what the user has typed so far. /// ReadOnlyCollection Suggestions { get; set; } /// /// The currently selected index into that the user has highlighted /// int SelectedIdx { get; set; } /// /// The colors to use to render the overlay. Accessing this property before /// the Application has been initialized will cause an error /// ColorScheme ColorScheme { get; set; } /// /// The key that the user must press to accept the currently selected autocomplete suggestion /// Key SelectionKey { get; set; } /// /// The key that the user can press to close the currently popped autocomplete menu /// Key CloseKey { get; set; } /// /// The key that the user can press to reopen the currently popped autocomplete menu /// Key Reopen { get; set; } /// /// Renders the autocomplete dialog inside the given at the /// given point. /// /// void RenderOverlay (Point renderAt); /// /// Handle key events before e.g. to make key events like /// up/down apply to the autocomplete control instead of changing the cursor position in /// the underlying text view. /// /// The key event. /// trueif the key can be handled falseotherwise. bool ProcessKey (KeyEvent kb); /// /// Handle mouse events before e.g. to make mouse events like /// report/click apply to the autocomplete control instead of changing the cursor position in /// the underlying text view. /// /// The mouse event. /// If was called from the popup or from the host. /// trueif the mouse can be handled falseotherwise. bool MouseEvent (MouseEvent me, bool fromHost = false); /// /// Clears /// void ClearSuggestions (); /// /// Gets or Sets the class responsible for generating /// based on a given of the . /// ISuggestionGenerator SuggestionGenerator { get; set; } /// /// Populates with all /// proposed by at the given /// (cursor position) /// void GenerateSuggestions (AutocompleteContext context); } }