//
//  MyApplication.m
//
//  Created by Dr. H. Nikolaus Schaller on Sun Aug 17 2003.
//  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
//

#import "MyApplication.h"

@implementation MyApplication

- (void) awakeFromNib
{
	NSLog(@"AppController awakeFromNib");
	[NSApp setDelegate:self];	// make me the delegate!
	[webView takeStringURLFrom:currentURL];
}

// delegate methods

- (WebView *) webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request
{
	NSLog(@"create web view");
	return sender;
}

- (void) webViewShow:(WebView *)sender
{
	NSLog(@"show web view");
}

- (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
    // Only report feedback for the main frame.
    if(frame == [sender mainFrame])
		{
		NSLog(@"Loading...");
		}
}

- (void) webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame
{
    if(frame == [sender mainFrame])
        [[sender window] setTitle:title];
}

- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
    // Only report feedback for the main frame.
	NSLog(@"frame=%@", frame);
	NSLog(@"webview=%@", sender);
	// test: print subviews hierarchy
    if(frame == [sender mainFrame])
		{
		NSLog(@"Done.");
		}
}

@end
