//	Zinc Application Framework - Z_KEYBRD.HPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#if !defined(Z_KEYBRD_HPP)
#define Z_KEYBRD_HPP
#include <z_device.hpp>

#if defined(USE_UGL_INPUT) || (defined(ZAF_INDEPENDENT) && !defined(ZAF_MSDOS))
#		include<uglInput.h>
#	endif

// --------------------------------------------------------------------------
// ----- ZafKeyboard --------------------------------------------------------
// --------------------------------------------------------------------------

class ZAF_EXPORT ZafKeyboard : public ZafDevice
{
public:
	// --- General members ---
	ZafKeyboard(ZafDeviceState state = D_ON);
	ZafKeyboard(const ZafKeyboard &copy);
	virtual ~ZafKeyboard(void);

	// --- Attributes & data access ---
	// get
	bool AltPressed(unsigned int shiftState) const { return ((shiftState & S_ALT) ? true : false); }
	bool CtrlPressed(unsigned int shiftState) const { return ((shiftState & S_CTRL) ? true : false); }
	bool ShiftPressed(unsigned int shiftState) const { return ((shiftState & S_SHIFT) ? true : false); }
	// set

#	if defined(ZAF_MSDOS) || defined(ZAF_CURSES)
	static ZafEventType BreakHandlerSet(void);
	static ZafEventType SetBreakHandlerSet(ZafEventType breakHandlerSet);
#	endif

	// --- Device members ---
	virtual ZafEventType Event(const ZafEventStruct &event);
	virtual void Poll(void);

	// --- Class identification ---
	static ZafClassID classID;
	static ZafClassNameChar ZAF_FARDATA className[];
	virtual ZafClassID ClassID(void) const { return (classID); }
	virtual ZafClassName ClassName(void) const { return (className); }
	virtual bool IsA(ZafClassID compareID) const;
	virtual bool IsA(ZafClassName compareName) const;

protected:
#	if defined(ZAF_MSDOS) || defined(ZAF_CURSES)
	static ZafEventType breakHandlerSet;
#	endif
#if defined(USE_UGL_INPUT) || (defined(ZAF_INDEPENDENT) && !defined(ZAF_MSDOS))
	UGL_INPUT_DRIVER *driver;
#	endif
};

#	if defined(ZAF_MSDOS) || defined(ZAF_CURSES)
// --- inline functions ---
inline ZafEventType ZafKeyboard::BreakHandlerSet(void) { return breakHandlerSet; }
#	endif

#endif // Z_KEYBRD_HPP

