#import "SimpleBrowserController.h"

@implementation SimpleBrowserController

- (void) resetButtons {	
	[backButton setEnabled:[myWebView canGoBack]];
	[forwardButton setEnabled:[myWebView canGoForward]];
}
//START:code.delegates.buttons
-(IBAction) loadPreviousPage:(id) sender {
	[myWebView goBack];
	[self resetButtons];
}

-(IBAction) loadNextPage:(id) sender {
	[myWebView goForward];
	[self resetButtons];
}

-(IBAction) loadURLFrom: (id) sender {
	[myWebView takeStringURLFrom:sender];
	[self resetButtons];
}
//END:code.delegates.buttons
- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title 
	   forFrame:(WebFrame *)frame {	
	[[sender window] setTitle:title];
}
//START:code.delegates.endload
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
	[inputField setStringValue:[sender mainFrameURL]];
	[self resetButtons:sender];
}
//END:code.delegates.endload
@end
