/* * Copyright (c) 2025, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #import static constexpr auto MAXIMUM_VISIBLE_AUTOCOMPLETE_SUGGESTIONS = 8uz; @protocol AutocompleteObserver - (void)onSelectedSuggestion:(String)suggestion; - (void)onHighlightedSuggestion:(String)suggestion; - (void)onAutocompleteDidClose; @end @interface Autocomplete : NSObject - (instancetype)init:(id)observer withToolbarItem:(NSToolbarItem*)toolbar_item; - (void)showWithSuggestions:(Vector)suggestions selectedRow:(NSInteger)selected_row; - (void)clearSelection; - (BOOL)close; - (BOOL)isVisible; - (Optional)selectedSuggestion; - (BOOL)selectNextSuggestion; - (BOOL)selectPreviousSuggestion; @end