/*
	
	Color Menu Definition code.
	Adapted from Color MDEF by Jordan Zimmerman.
*/

#ifndef COLOR_MENU_H
#define COLOR_MENU_H

#define _NumToHex(n)			(((n<10) ? (n + '0') : (n - 10 + 'A')))
#define _HexToNum(hexChar)		((hexChar < 'A') ? (hexChar - '0') : (hexChar - 'A' + 10))



typedef struct
{
	UInt8	squareSize;
	UInt8	spaceBetween;
	UInt8	selectionSize;
	UInt8	popupInset;
} ColorMenuGlobals;

extern ColorMenuGlobals	gColorMenuGlobals;


pascal void ColorMenu( SInt16 message, MenuRef menu, Rect* menuRect, Point hitPt,
						SInt16* whichItem );
// convert the given formatted 12 byte pstring into an RGBColor
// the pstring should be in the form RRRRGGGGBBBB where
// RRRR, GGGG, and BBBB are each ASCII four byte hex numbers
void CMPstrToColor( Str31 str, RGBColor* color );

// convert the given RGBColor into a 12 byte formatted pstring
void CMColorToPstr( RGBColor color, Str31 str );

// set the given menu item to the given color
void CMSetMenuItemColor( MenuRef menu, SInt16 itemNumber, RGBColor color );

// return the color for the given menu item
void CMGetMenuItemColor( MenuRef menu, SInt16 itemNumber, RGBColor* color);

#endif	// COLOR_MENU_H
