#import "embeddedCocoa.h" @implementation embeddedCocoa -(id) initWithWebView:(WebView*)wview { /* Top TextView */ textView = [[NSTextView alloc] initWithFrame:NSMakeRect(0,105,300,100)]; NSClipView *clipView = [[NSClipView alloc] init]; //Initialize ClipView [clipView setDocumentView:textView]; //Add TextView as subview [clipView setFrame:NSMakeRect(0,105,300,100)]; //Set frame NSScrollView *scrollView = [[NSScrollView alloc] init];//Initialize ScrollView [scrollView setDocumentView:clipView]; //Add ClipView as subview [scrollView setFrame:NSMakeRect(0,105,300,100)]; //Set frame /* Mirror TextView */ textViewMirror = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,300,100)]; NSClipView *clipViewMirror = [[NSClipView alloc] init]; [clipViewMirror setDocumentView:textViewMirror]; [clipViewMirror setFrame:NSMakeRect(0,0,300,100)]; NSScrollView *scrollViewMirror = [[NSScrollView alloc] init]; [scrollViewMirror setDocumentView:clipViewMirror]; [scrollViewMirror setFrame:NSMakeRect(0,0,300,100)]; [wview addSubview:scrollView]; //Adds the subview to the main WebView [wview addSubview:scrollViewMirror]; //Adds the subview to the main Webview [textView setString:@"Type here, and it will be mirrored..."]; [textViewMirror setString:@"...down here."]; [textView setDelegate:self]; |