summaryrefslogtreecommitdiff
path: root/cocoa/BrowserView.m
diff options
context:
space:
mode:
authorSven Weidauer <sven.weidauer@gmail.com>2011-01-24 15:01:34 +0000
committerSven Weidauer <sven.weidauer@gmail.com>2011-01-24 15:01:34 +0000
commite21cab6a7fc68b311a79a067b408da23173fb255 (patch)
treeea7fbdbb891ad19248d8106b3d0edc3dddcc0cf1 /cocoa/BrowserView.m
parent840fb0b9aab4b3d3bd4603a945f0d8ca02f5e473 (diff)
downloadnetsurf-e21cab6a7fc68b311a79a067b408da23173fb255.tar.gz
netsurf-e21cab6a7fc68b311a79a067b408da23173fb255.tar.bz2
Added local history overlay
svn path=/trunk/netsurf/; revision=11479
Diffstat (limited to 'cocoa/BrowserView.m')
-rw-r--r--cocoa/BrowserView.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index e20c053a6..ba0874c3a 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -17,6 +17,7 @@
*/
#import "BrowserView.h"
+#import "HistoryView.h"
#import "desktop/browser.h"
#import "desktop/history_core.h"
@@ -27,6 +28,11 @@
#import "cocoa/font.h"
+@interface BrowserView () <HistoryViewDelegate>
+
+@end
+
+
@implementation BrowserView
@synthesize browser;
@@ -39,6 +45,8 @@ static const NSTimeInterval CaretBlinkTime = 0.8;
- (void) dealloc;
{
[self setCaretTimer: nil];
+ [history release];
+
[super dealloc];
}
@@ -173,6 +181,11 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
- (void) mouseUp: (NSEvent *)theEvent;
{
+ if (historyVisible) {
+ [self toggleHistory];
+ return;
+ }
+
NSPoint location = [self convertMousePoint: theEvent];
browser_mouse_state modifierFlags = cocoa_mouse_flags_for_event( theEvent );
@@ -326,6 +339,28 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
browser_window_key_press( browser, KEY_PASTE );
}
+- (void) toggleHistory;
+{
+ if (!historyVisible) {
+ if (nil == history) {
+ history = [[HistoryView alloc] initWithBrowser: browser];
+ [history setDelegate: self];
+ }
+ [self addSubview: history];
+
+ historyVisible = YES;
+ } else {
+ [history removeFromSuperview];
+ historyVisible = NO;
+ }
+}
+
+
+- (void) historyViewDidSelectItem: (HistoryView *) history;
+{
+ [history removeFromSuperview];
+ historyVisible = NO;
+}
- (BOOL) acceptsFirstResponder;
{