UI/AppKit: Implement an autocomplete view for the location bar

This commit is contained in:
Timothy Flynn 2025-03-30 21:01:53 -04:00 committed by Tim Flynn
commit c1fe912bf9
Notes: github-actions[bot] 2025-04-02 12:53:38 +00:00
4 changed files with 309 additions and 11 deletions

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/Vector.h>
#import <Cocoa/Cocoa.h>
@protocol AutocompleteObserver <NSObject>
- (void)onSelectedSuggestion:(String)suggestion;
@end
@interface Autocomplete : NSPopover
- (instancetype)init:(id<AutocompleteObserver>)observer
withToolbarItem:(NSToolbarItem*)toolbar_item;
- (void)showWithSuggestions:(Vector<String>)suggestions;
- (BOOL)close;
- (Optional<String>)selectedSuggestion;
- (BOOL)selectNextSuggestion;
- (BOOL)selectPreviousSuggestion;
@end