mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 04:07:51 +00:00
UI/AppKit: Implement an autocomplete view for the location bar
This commit is contained in:
parent
60dd5cc4ef
commit
c1fe912bf9
Notes:
github-actions[bot]
2025-04-02 12:53:38 +00:00
Author: https://github.com/trflynn89
Commit: c1fe912bf9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4156
4 changed files with 309 additions and 11 deletions
33
UI/AppKit/Interface/Autocomplete.h
Normal file
33
UI/AppKit/Interface/Autocomplete.h
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue