Open the website when it's suggested entry is clicked, begin hooking the suggestion control up to keyboard events@
This commit is contained in:
parent
d431988481
commit
4a534759b6
|
@ -94,7 +94,8 @@ static id newTabTarget;
|
|||
selector: @selector(onPreferencesUpdated:)
|
||||
name: PreferencesUpdatedNotificationName
|
||||
object: nil];
|
||||
urlSuggestionView = [[UrlSuggestionView alloc] initForUrlBar: urlBar];
|
||||
urlSuggestionView = [[UrlSuggestionView alloc] initForUrlBar: urlBar
|
||||
inBrowserWindowController: self];
|
||||
NSLog(@"Browser window loaded");
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ S_FRONTEND := \
|
|||
PreferencesWindowController.m \
|
||||
VerticalTabsView.m \
|
||||
UrlSuggestionView.m \
|
||||
NotifyingTextField.m \
|
||||
Website.m \
|
||||
BookmarkFolder.m \
|
||||
SearchProvider.m \
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// TODO: Are these defined anywhere in GNUStep?
|
||||
#define KEY_UP 98
|
||||
#define KEY_DOWN 104
|
||||
#define SpecialKeyPressedNotification @"SpecialKeyPressed"
|
||||
|
||||
@interface NotifyingTextField: NSTextField {
|
||||
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,21 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "NotifyingTextField.h"
|
||||
|
||||
|
||||
|
||||
@implementation NotifyingTextField
|
||||
|
||||
-(void)keyUp: (NSEvent*)theEvent {
|
||||
[super keyUp: theEvent];
|
||||
NSLog(@"code: %d", [theEvent keyCode]);
|
||||
switch ([theEvent keyCode]) {
|
||||
case KEY_UP:
|
||||
|
||||
case KEY_DOWN:
|
||||
|
||||
defualt:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,5 +1,6 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class BrowserWindowController;
|
||||
@class UrlSuggestionView;
|
||||
|
||||
@protocol UrlSuggestionViewDelegate
|
||||
|
@ -7,7 +8,10 @@
|
|||
@end
|
||||
|
||||
@interface UrlSuggestionView: NSScrollView<NSTableViewDataSource, NSTableViewDelegate> {
|
||||
// Not Retained
|
||||
id urlBar;
|
||||
id browserWindowController;
|
||||
|
||||
BOOL isActive;
|
||||
NSTableView *tableView;
|
||||
NSArray *recentWebsites;
|
||||
|
@ -15,7 +19,7 @@
|
|||
NSString *previousQuery;
|
||||
}
|
||||
|
||||
-(id)initForUrlBar: (NSTextField*)aUrlBar;
|
||||
-(id)initForUrlBar: (NSTextField*)aUrlBar inBrowserWindowController: (BrowserWindowController*)aBrowserWindowController;
|
||||
-(void)dismiss;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "UrlSuggestionView.h"
|
||||
#import "BrowserWindowController.h"
|
||||
#import "Preferences.h"
|
||||
|
||||
#define ENTRY_HEIGHT 25
|
||||
|
@ -14,9 +15,10 @@
|
|||
|
||||
@implementation UrlSuggestionView
|
||||
|
||||
-(id)initForUrlBar: (NSTextField*)aUrlBar {
|
||||
-(id)initForUrlBar: (NSTextField*)aUrlBar inBrowserWindowController: (BrowserWindowController*)aBrowserWindowController {
|
||||
if ((self = [super init])) {
|
||||
urlBar = aUrlBar;
|
||||
browserWindowController = aBrowserWindowController;
|
||||
NSRect frame = [aUrlBar frame];
|
||||
frame.size.height = 0;
|
||||
[self setFrame: frame];
|
||||
|
@ -160,6 +162,7 @@
|
|||
Website *selectedWebsite = [filteredWebsites objectAtIndex: row];
|
||||
[urlBar setStringValue: [selectedWebsite url]];
|
||||
[self updateQuery: @""];
|
||||
[browserWindowController openWebsite: selectedWebsite];
|
||||
NSLog(@"Selection changed");
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,13 @@
|
|||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
NotifyingTextField = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSTextField;
|
||||
};
|
||||
PlotView = {
|
||||
Actions = (
|
||||
);
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue