Files
ladybird/UI/AppKit/Interface/Autocomplete.h
Andreas Kling 1802a05bc2 UI/AppKit: Show rich autocomplete suggestion rows
Render AutocompleteSuggestion rows with section headers, favicons,
titles, and secondary text in the child-window popup instead of just
plain strings.

Move the AppKit popup and inline completion onto the shared suggestion
model, and share the base64 PNG decoding helper with the application
menu icon loading path.
2026-04-16 21:01:28 +02:00

42 lines
935 B
Objective-C

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