
/* Generated by Interface Builder */

#import "TextView.h"
#import <appkit/appkit.h>

@implementation TextView

- setup:(id)thewindow
{
    NXRect              rect = {0.0, 0.0, 0.0, 0.0};

    ourwindow = thewindow;
    [ourwindow getFrame:&rect];
    [self initFrame:&rect];
    return self;
}

- initFrame:(const NXRect *)rect

{

    NXRect              rect2 = {0.0, 0.0, 0.0, 0.0};

    rect2 =*rect;
 /* initialize view */
    [super initFrame:&rect2];


 /* specify scrollbars */
    [[self setVertScrollerRequired:YES] setHorizScrollerRequired:NO];
    theText = [self newText:&rect2];
    [self setDocView:theText];
    [theText setSel:0 :0];

    //The following two lines allow the resizing of the scrollview
      // to be passed down to the docView(in this case, the text view
					  // itself).

      [contentView setAutoresizeSubviews:YES];
    [contentView setAutosizing:NX_HEIGHTSIZABLE | NX_WIDTHSIZABLE];

    [ourwindow setContentView:self];

    return self;
}


- newText:(const NXRect *)frameRect
{
    NXSize              aSize = {1.0E38, 1.0E38};

    text = [[Text alloc] initFrame:frameRect
	    text:NULL
	    alignment:NX_LEFTALIGNED];
    [text setOpaque:YES];
    [[[[[text notifyAncestorWhenFrameChanged:YES]
	setVertResizable:YES]
       setHorizResizable:NO]
      setMonoFont:NO]
     setDelegate:self];

    [text setMinSize:&(frameRect->size)];
    [text setMaxSize:&aSize];
    [text setAutosizing:NX_HEIGHTSIZABLE | NX_WIDTHSIZABLE];

    [text setCharFilter:NXEditorFilter];
    return text;
}

- getText:sender
{
    return text;
}

@end
