unit About;			{ version 2.1			last update:  1/1/92 }
{}
{}
{   AboutÉ is copyrighted, and I reserve all rights to it; both source and}
{   compiled versions.  Please do not distribute this source without my}
{   permission, or remove this notice.  Thanks.}
{}
{   Jon Wind (AboutÉ)}
{   2374 Hillwood Drive}
{   Maplewood, MN  55119}
{}
{ 2.1 Changes }
{	Updated demo to work properly with System 7.0 and added popup menu for window types }
{	Improved overall stability of AboutÉ unit, especially in tight memory situations }
{	Added support for movableDBoxProc window type }
{	Added support for plainDBox window type to be drawn with only scrollable text }
{}
{ 2.0 Changes }
{	Created Modal and Modeless versions }
{	Added optional support for display of styled text }
{	Added support for copying styled text }
{	Added ability to specify how window will be centered instead of just center or not center }
{	Improved error checking in low memory conditions }
{	Shift-command-c will now also copy text }
{	Method of obtaining main window rect should now work for DAs, cdevs, etc }
{	Window dragging now gets bounds from GrayRgn }
{	Window centering routines now shift the window as neccessary to keep it entirely onscreen }
{	Option clicking in the window displays the version instead of option clicking anywhere }
{	OK button is now horizontally centered if MainIcon = NoIcon & Length(WinMsg) = 0; set WinMsg to an invisible character to not center it }
{	OK button is disabled and default roundrect is drawn in gray if the (modeless) About window is not in front }
{	Added support for close box instead of OK button for noGrowDocProc or rDocProc windows }
{	Scrolling text area is extended downward if MainIcon = NoIcon & Length(WinMsg) = 0 }
{	Control and window auxRecs are now used for frame and background colors }
{}
{$R-}
interface


	const
		AboutVersion = 'AboutÉ 2.1';
		AboutNoIcon = -1;
		AboutNoCenter = -1;
		AboutTopCenter = 0;
		AboutMainCenter = 1;
		AboutMsg = 0;
		AboutTEXT = 1;

		movableDBoxProc = 5;

	type
		AboutFontRec = record
				Font, Size: Integer;
				Face: Style;
				Color: Integer;
			end;
		AboutRec = record
				FontInfo: array[AboutMsg..AboutTEXT] of AboutFontRec;
				TEXTCopy, KeyEquivs, CloseBox, Styled: Boolean;
				CenterMode, MainIcon, ClickIcon: Integer;
				ClickMsg: Str255;
			end;
{ Note: font color(s) must be blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor, or yellowColor }
{ Note: if MainIcon = AboutNoIcon then no icon will be drawn }
{ Note: if ClickIcon = AboutNoIcon then no icon will be drawn when original icon is clicked on }
{ Note: if CenterMode = AboutNoCenter the window will use the supplied coordinates and will not be centered }
{ Note: if CenterMode = AboutTopCenter the window will be centered on the front window or the main monitor if there is no front window }
{ Note: if CenterMode = AboutMainCenter the window will be centered on the main monitor }
{ Note: if Length(ClickMsg) = 0 then no message will be drawn when original icon is clicked on }
{ Note: CloseBox will be ignored for dBoxProc, altDBoxProc, and movableDBoxProc windows }



{ Modal procedure: }
{ this routine does everything, returning to calling proc only after the window is dismissed... }
	procedure BuildAbout (WinRect: Rect;
									WinProc, TEXTid: Integer;
									WinTitle, WinMsg: Str255;
									WinMisc: AboutRec);


{ Modeless procedures: }
{ returns true if the specified window is an About window; otherwise returns false }
	function IsAboutWindow (theWindow: WindowPtr): Boolean;

{ open About window and return pointer to it - returns NIL if window is not created }
{ Note: you should keep track of this pointer only if you wish to keep specific track of it }
	function OpenAbout (WinRect: Rect;
									WinProc, TEXTid: Integer;
									WinTitle, WinMsg: Str255;
									WinMisc: AboutRec): WindowPtr;

{ handle event relating to About window, ie updateEvt, activateEvt, mouseDown, keyDown, etcÉ }
{ Note: this proc should be called after every event for each About window for everything to work correctly }
{ Note: this proc calls the CloseAbout proc if the OK button or close box is selected }
{ Note: you can filter events passed to it to simulate a modal dialog }
	procedure HandleAbout (var theWindow: WindowPtr;
									var theEvent: EventRecord);

{ close the specified About window, kill data structures associated with it, and set theWindow to NILÉ }
{ Note: this proc is called by the HandleAbout proc when an About window is dismissed by selecting its OK button }
{ Note: this proc should be called when the program needs to remove an About window }
	procedure CloseAbout (var theWindow: WindowPtr);



implementation



	procedure BuildAbout;
	external;

	function IsAboutWindow;
	external;

	function OpenAbout;
	external;

	procedure HandleAbout;
	external;

	procedure CloseAbout;
	external;

end.