/*********************************************************/
/* This source code copyright (c) 1991-2001, Aaron Giles */
/* See the Read Me file for licensing information.       */
/* Contact email: mac@aarongiles.com                     */
/*********************************************************/

#ifndef __FLOATINGWINDOWS__
#define __FLOATINGWINDOWS__

#include <Windows.h>
#include <Dialogs.h>

// Activate/deactivate floating windows & frontmost window
extern void FWActivate(void);
extern void FWDeactivate(void);

// Show/hide all the floating windows
extern void FWHideFloatingWindows(void);
extern void FWShowFloatingWindows(void);

// Create new floating windows
extern WindowPtr FWGetNewFloatingWindow(short resID, Ptr wStorage, WindowPtr behind);
extern WindowPtr FWNewFloatingWindow(Ptr wStorage, Rect *rBounds, Str255 title, 
	Boolean visFlag, short wDefProcID, WindowPtr behind, Boolean goAwayFlag, long refCon);

// Determine if a window is floating
extern Boolean FWIsFloating(WindowPtr theWindow);

// Window locating routines
extern WindowPtr FWBottomDialog(void);
extern WindowPtr FWBottomFloatingWindow(void);
extern WindowPtr FWBottomWindow(void);
extern WindowPtr FWTopDialog(void);
extern WindowPtr FWTopFloatingWindow(void);
extern WindowPtr FWTopWindow(void);

// Alert function substitutes
extern short FWAlert(short alertID, ModalFilterUPP filterProc);
extern short FWCautionAlert(short alertID, ModalFilterUPP filterProc);
extern short FWNoteAlert(short alertID, ModalFilterUPP filterProc);
extern short FWStopAlert(short alertID, ModalFilterUPP filterProc);

// Dialog Manager substitutes
extern void FWCloseDialog(DialogPtr theDialog);
extern void FWDisposeDialog(DialogPtr theDialog);
extern Boolean FWDialogSelect(EventRecord *theEvent, DialogPtr *whichDlog, short *itemHit);
extern Boolean FWIsDialogEvent(EventRecord *theEvent);
extern DialogPtr FWGetNewDialog(short dlgRsrcID, Ptr dStorage, WindowPtr behind);
extern DialogPtr FWNewCDialog(Ptr dStorage, Rect *wRect, Str255 title, Boolean visFlag,
	short wDefProcID, WindowPtr behind, Boolean goAwayFlag, long refCon, 
	Handle itemList);
extern DialogPtr FWNewDialog(Ptr dStorage, Rect *wRect, Str255 title, Boolean visFlag,
	short wDefProcID, WindowPtr behind, Boolean goAwayFlag, long refCon, 
	Handle itemList);

// Window manager substitutes
extern void FWCloseWindow(WindowPtr theWindow);
extern void FWDisposeWindow(WindowPtr theWindow);
extern void FWDragWindow(WindowPtr theWindow, Point startPoint, Rect *limitRect);
extern WindowPtr FWFrontWindow(void);
extern WindowPtr FWGetNewCWindow(short resID, Ptr wStorage, WindowPtr behind);
extern WindowPtr FWGetNewWindow(short resID, Ptr wStorage, WindowPtr behind);
extern void FWHideWindow(WindowPtr theWindow);
extern void FWMoveWindow(WindowPtr theWindow, short hGlobal, short vGlobal, Boolean front);
extern WindowPtr FWNewCWindow(Ptr wStorage, Rect *rBounds, Str255 title, Boolean visFlag,
	short wDefProcID, WindowPtr behind, Boolean goAwayFlag, long refCon);
extern WindowPtr FWNewWindow(Ptr wStorage, Rect *rBounds, Str255 title, Boolean visFlag,
	short wDefProcID, WindowPtr behind, Boolean goAwayFlag, long refCon);
extern void FWSelectWindow(WindowPtr theWindow);
extern void FWShowWindow(WindowPtr theWindow);

// Window manager interfaces
extern WindowPtr GetFirstWindow(void);
extern WindowPtr NextWindow(WindowPtr theWindow);
extern short WindowKind(WindowPtr theWindow);
extern Boolean WindowVisible(WindowPtr theWindow);
extern Boolean WindowHilited(WindowPtr theWindow);
extern RgnHandle GetStrucRgn(WindowPtr theWindow);
extern RgnHandle GetContRgn(WindowPtr theWindow);
extern Boolean HasGoAway(WindowPtr theWindow);
extern void SetWindowKind(WindowPtr theWindow, short theKind);
extern void SetNextWindow(WindowPtr theWindow, WindowPtr nextWindow);
extern void SetFirstWindow(WindowPtr theWindow);

// Floating window constants
enum {
	floatingWindowKind = 'fl'
};

#endif
