mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
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.
42 lines
935 B
Objective-C
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
|