Path: utzoo!attcan!uunet!mcvax!enea!tut!santra!jmunkki
From: jmunkki@santra.HUT.FI (Juri Munkki)
Newsgroups: comp.sys.mac.programmer
Subject: Re: list manager definition procedure
Message-ID: <14292@santra.UUCP>
Date: 7 Jul 88 07:44:25 GMT
References: <399@metasoft.UUCP>
Sender: jmunkki@santra.UUCP
Reply-To: jmunkki@santra.UUCP (Juri Munkki)
Organization: Helsinki University of Technology, Finland
Lines: 47

In article <399@metasoft.UUCP> spud@metasoft.UUCP (David Hayes) writes:
>i am trying to display a list of ICONs in a dialog using the list manager,
>it seems that i need to write a list definition procedure (LDEF). if 

I wrote one for a maze editor based on the list manager. The application
can use 256 icons that are stored as ICON 2001, 2002, ...

The LDEF is short, so I'll post it right here. (It's LSC)

Disclaimer:	This code does not represent in any way the kind of code I
		normally write, when I'm paid to do it. Please remember that
		this program was written just to learn the list manager.

#include 
#include 

pascal void	main(message,select,rect,tcell,offset,len,listh)
int		message,select;
Rect		*rect;
Point		tcell;
int		offset,len;
ListHandle	listh;
{
	int		theData;
	Handle		iconHandle;

	if(message==1)
	{	Rect	foo;
	
		foo=*rect;
		rect->top+=(rect->bottom-rect->top-32)>>1;
		rect->left+=(rect->right-rect->left-32)>>1;
		rect->bottom=rect->top+32;
		rect->right=rect->left+32;
		if(len==1)
		{	iconHandle=(Handle)(*listh)->cells;
			theData=(unsigned char)((*iconHandle)[offset]);
			iconHandle=(Handle)GetIcon(theData+2001);
			if(iconHandle)
				PlotIcon(rect,iconHandle);
		}
		if(select & 0xff00)
			InvertRect(&foo);
	}
	if(message==2)
		InvertRect(rect);
}