// layer.h
//
// CommandTab makes extensive use of the UNDOCUMENTED* Layer Manager.
// The Layer Manager appears in System 7, 8, and (I think) 9.
// The rumor mill claims the Layer Manager will be gone in MacOS X.
//
// Use the Layer Manager at your OWN RISK.  It is an "unsupported"
// feature of the MacOS, which means Apple denies all knowledge of
// it's existance.  When asked about the Layer Manager, Apple employees
// are advised to use "any force necessary" to get the person questioning
// to stay away from the Layer Manager. :-)
//
// You can try emailing me about the Layer Manager, but I'm not sure how
// much help I'll be, cause I haven't coded with it in ages.
//
// -robert rose (rose@engr.orst.edu)  12/1999
//
//
// * until now.. :-)

typedef struct {
	long					unknown1;
	OSType					signature;
	OSType					creator;
	char					unknown2[24];
	ProcessSerialNumber 	layerPSN;
	char 					unknown3;
	Handle					moreLayerInfo;
} LayerInfo, *LayerInfoPtr;

pascal LayerPtr GetFirstLayer(void)
	= {0x7003, 0xA829};

pascal WindowPtr GetFirstLayerWindow(LayerPtr aLayer)
	= {0x7006, 0xA829};

#define GetNextLayer(aLayer)	(aLayer->nextWindow)
#define GetLayerInfo(aLayer)	((LayerInfoPtr)aLayer->refCon)
#define ShowLayer(aLayer)		ShowWindow((WindowPtr)aLayer)

#define GetLayerName(aLayer)	(unsigned char*) ((*GetLayerInfo(aLayer)->moreLayerInfo) + 0x38)


#define GetWindowName(win) 	*((WindowRecord *)win)->titleHandle
#define NextWindow(current) (WindowPtr)((WindowRecord *)current)->nextWindow
