[comp.sys.mac.programmer] list manager definition procedure

spud@metasoft.UUCP (David Hayes) (07/01/88)

we've had some problems with our news feed in the past couple days, so i am
reposting this on the assumption that the original posting was unsuccessful
if this is a repeat, i apologize.

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 
anyone out there has written one i would appreciate some assistance
( C sources if you've got 'em, Pascal's ok too, words of encouragement
accepted also).  i'm using LSC, and sys 6.0, if that matters. i've used
the list manager several times but only for text lists.

as always i will be happy to forward any information or post summary 


thanks,  ...!bbn!metasoft!spud

tedj@hpcilzb.HP.COM (Ted Johnson) (07/01/88)

I'd be interested in the LSC source that does this, also.

-Ted

jmunkki@santra.HUT.FI (Juri Munkki) (07/07/88)

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 <MacTypes.h>
#include <ListMgr.h>

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);
}