/*	XMisc.h
 *
 *		Miscellaneous wrapper routines for common operations.
 */

/**********************************************************************

  YAAF is Copyright 1997-1999 by William Woody.

  Redistribution and use in source and binary forms, with or without 
  modification, are permitted provided that the following conditions 
  are met:

  Redistributions of source code must retain the above copyright notice, 
  this list of conditions and the following disclaimer.

  Neither the name of the copyright holder or other contributors may
  be used to promote products derived from this software without
  specific written prior permission.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
  SOFTWARE.
  
  Contact:   woody@alumni.caltech.edu
  Web page:  http://www.pandawave.com/yaaf/

**********************************************************************/

#ifndef PandaWave_XMISC
#define PandaWave_XMISC

#include <XConfig.h>

/************************************************************************/
/*																		*/
/*	Timer Routines														*/
/*																		*/
/************************************************************************/

extern unsigned long		XGGetTime(void);
extern unsigned long		XGGetDoubleClick(void);
extern unsigned long		XGGetCursorBlink(void);
extern unsigned long		XGGetSecond(void);

/************************************************************************/
/*																		*/
/*	Character Translation												*/
/*																		*/
/************************************************************************/

/*$	XGOSType
 *
 *		This enumeration specifies the operating system platform that
 *	the text is in. This is used in conjunction with the XGTransChar
 *	routine.
 */

enum XGOSType {
	/// Indicates this is the native environment to XGTransChar
	KXGNative = 0,
	/// Indicates this is the Macintosh to XGTransChar
	KXGMacintosh = 1,
	/// Indicates this is Windows to XGTransChar
	KXGWindows = 2,
	/// Indicates this is X Windows to XGTransChar
	KXGUnix = 3
};

extern char					*XGTransChar(XGOSType, XGOSType, char *ptr, long len = -1);

/************************************************************************/
/*																		*/
/*	Alert beeps															*/
/*																		*/
/************************************************************************/

/*$	XGBeep
 *
 *		This is a portable routine which beeps the speaker.
 */

inline void XGBeep()
{
#if OPT_MACOS
	SysBeep(5);
#endif

#if OPT_WINOS
	MessageBeep(MB_OK);
#endif
}

#endif // PandaWave_XMISC
