ftp.nice.ch/pub/next/games/fun/cookie.s.tar.gz#/Cookie/CookieFileListView.m

This is CookieFileListView.m in view mode; [Download] [Up]

/* Generated by Interface Builder */

#import "CookieFileListView.h"
#import "ExportCell.h"
#import <appkit/appkit.h>
#import "CookieFile.h"
#import <string.h>
#undef ABS
#import <c.h>

@implementation CookieFileListView

- (Matrix *)matrix
{
	return DocMatrix;
}

- initFrame :(NXRect *)theFrame
{
	NXRect	scrollRect,matrixRect;
	NXSize cellSize;

	[super initFrame:theFrame];

	// Set the scrollView's attributes
	[self setBorderType:NX_BEZEL];
	[self setVertScrollerRequired:YES];
	[self setHorizScrollerRequired:NO];

	// get the scrollView's dimensions
	[self getFrame:&scrollRect];

	// Determine the matrix bounds
    [ScrollView getContentSize:&(matrixRect.size)
    		forFrameSize:&(scrollRect.size)
		horizScroller:NO
		vertScroller:YES
		borderType:NX_BEZEL];

	// Prepare a Matrix to go inside our scrollView
	DocMatrix = [[Matrix alloc] initFrame:&matrixRect
		mode:NX_HIGHLIGHTMODE
		cellClass:[ExportCell class]
		numRows:0
		numCols:1];
	
	// resize the matrix's cells and size the matrix to contain them
	[DocMatrix getCellSize:&cellSize];
	cellSize.width = NX_WIDTH(&matrixRect);
	[DocMatrix setCellSize:&cellSize];
	[DocMatrix sizeToCells];
	[DocMatrix setAutosizeCells:YES];

	/*
	 * when the user clicks in the matrix and then drags the mouse out of
	 * scrollView's contentView, we want the matrix to scroll
	 */
	[DocMatrix setAutoscroll:YES];

	// stick the matrix in our scrollview
	[self setDocView:DocMatrix];

	// set things up so that the matrix will resize properly
	[[DocMatrix superview] setAutoresizeSubviews:YES];
	[DocMatrix setAutosizing:NX_WIDTHSIZABLE];

	return self;
}

- syncView :(List *)mylist
{
	int count,maxcount = [mylist count];

	while([DocMatrix cellCount] < maxcount)
		[DocMatrix addRow];

	while([DocMatrix cellCount] > maxcount)
		[DocMatrix removeRowAt:0 andFree:TRUE];

	[DocMatrix sizeToCells];

	for(count = 0; count < maxcount; count++)
	{
		CookieFile *cookieFile = [mylist objectAt:count];
		ExportCell *myCell;

		myCell = [DocMatrix cellAt:count:0];

		[myCell setTitle:[cookieFile filename]];
		if([cookieFile selected])
			[myCell setState:TRUE];
		else
			[myCell setState:FALSE];

		[DocMatrix drawCellAt :count :0];
	}

	return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.