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:)
|
selector: @selector(onPreferencesUpdated:)
|
||||||
name: PreferencesUpdatedNotificationName
|
name: PreferencesUpdatedNotificationName
|
||||||
object: nil];
|
object: nil];
|
||||||
urlSuggestionView = [[UrlSuggestionView alloc] initForUrlBar: urlBar];
|
urlSuggestionView = [[UrlSuggestionView alloc] initForUrlBar: urlBar
|
||||||
|
inBrowserWindowController: self];
|
||||||
NSLog(@"Browser window loaded");
|
NSLog(@"Browser window loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ S_FRONTEND := \
|
||||||
PreferencesWindowController.m \
|
PreferencesWindowController.m \
|
||||||
VerticalTabsView.m \
|
VerticalTabsView.m \
|
||||||
UrlSuggestionView.m \
|
UrlSuggestionView.m \
|
||||||
|
NotifyingTextField.m \
|
||||||
Website.m \
|
Website.m \
|
||||||
BookmarkFolder.m \
|
BookmarkFolder.m \
|
||||||
SearchProvider.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>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@class BrowserWindowController;
|
||||||
@class UrlSuggestionView;
|
@class UrlSuggestionView;
|
||||||
|
|
||||||
@protocol UrlSuggestionViewDelegate
|
@protocol UrlSuggestionViewDelegate
|
||||||
|
@ -7,7 +8,10 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface UrlSuggestionView: NSScrollView<NSTableViewDataSource, NSTableViewDelegate> {
|
@interface UrlSuggestionView: NSScrollView<NSTableViewDataSource, NSTableViewDelegate> {
|
||||||
|
// Not Retained
|
||||||
id urlBar;
|
id urlBar;
|
||||||
|
id browserWindowController;
|
||||||
|
|
||||||
BOOL isActive;
|
BOOL isActive;
|
||||||
NSTableView *tableView;
|
NSTableView *tableView;
|
||||||
NSArray *recentWebsites;
|
NSArray *recentWebsites;
|
||||||
|
@ -15,7 +19,7 @@
|
||||||
NSString *previousQuery;
|
NSString *previousQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id)initForUrlBar: (NSTextField*)aUrlBar;
|
-(id)initForUrlBar: (NSTextField*)aUrlBar inBrowserWindowController: (BrowserWindowController*)aBrowserWindowController;
|
||||||
-(void)dismiss;
|
-(void)dismiss;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "UrlSuggestionView.h"
|
#import "UrlSuggestionView.h"
|
||||||
|
#import "BrowserWindowController.h"
|
||||||
#import "Preferences.h"
|
#import "Preferences.h"
|
||||||
|
|
||||||
#define ENTRY_HEIGHT 25
|
#define ENTRY_HEIGHT 25
|
||||||
|
@ -14,9 +15,10 @@
|
||||||
|
|
||||||
@implementation UrlSuggestionView
|
@implementation UrlSuggestionView
|
||||||
|
|
||||||
-(id)initForUrlBar: (NSTextField*)aUrlBar {
|
-(id)initForUrlBar: (NSTextField*)aUrlBar inBrowserWindowController: (BrowserWindowController*)aBrowserWindowController {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
urlBar = aUrlBar;
|
urlBar = aUrlBar;
|
||||||
|
browserWindowController = aBrowserWindowController;
|
||||||
NSRect frame = [aUrlBar frame];
|
NSRect frame = [aUrlBar frame];
|
||||||
frame.size.height = 0;
|
frame.size.height = 0;
|
||||||
[self setFrame: frame];
|
[self setFrame: frame];
|
||||||
|
@ -160,6 +162,7 @@
|
||||||
Website *selectedWebsite = [filteredWebsites objectAtIndex: row];
|
Website *selectedWebsite = [filteredWebsites objectAtIndex: row];
|
||||||
[urlBar setStringValue: [selectedWebsite url]];
|
[urlBar setStringValue: [selectedWebsite url]];
|
||||||
[self updateQuery: @""];
|
[self updateQuery: @""];
|
||||||
|
[browserWindowController openWebsite: selectedWebsite];
|
||||||
NSLog(@"Selection changed");
|
NSLog(@"Selection changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
);
|
);
|
||||||
Super = NSObject;
|
Super = NSObject;
|
||||||
};
|
};
|
||||||
|
NotifyingTextField = {
|
||||||
|
Actions = (
|
||||||
|
);
|
||||||
|
Outlets = (
|
||||||
|
);
|
||||||
|
Super = NSTextField;
|
||||||
|
};
|
||||||
PlotView = {
|
PlotView = {
|
||||||
Actions = (
|
Actions = (
|
||||||
);
|
);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue