/*
**	$Id: TextDisplay.hpp 1.5 1995/10/13 11:43:06 olsen Exp olsen $
**
**	:ts=4
*/

/*
 * Amiga changes copyright © 1995 by Olaf Barthel, All Rights Reserved
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software has not been validated by the ``Bundesamt fuer Zulassungen in
 * der Telekommunikation'' of the ``Deutsche Bundepost Telekom'' and thus
 * must not be used for accessing the BTX-Network of the Telekom in Germany.
 *
 * Diese Software hat keine Zulassung durch das Bundesamt fuer Zulassungen in
 * der Telekommunikation der Deutschen Bundespost Telekom und darf daher nicht
 * am Netz der Deutschen Bundespost Telekom in Deutschland betrieben werden.
 */

#ifndef _TEXTDISPLAY_HPP
#define _TEXTDISPLAY_HPP 1

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

#include <intuition/intuitionbase.h>
#include <graphics/gfxbase.h>
#include <exec/memory.h>

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

#ifndef _TYPES_HPP
#include "Types.hpp"
#endif

#ifndef _BTXDISPLAY_HPP
#include "BTXDisplay.hpp"
#endif

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

class TextDisplay : public BTXDisplay
{
	public:

		TextDisplay();
		~TextDisplay();

		LONG	Open(STRPTR PubScreenName,int XScale,int YScale,BOOL DirectRender);
		VOID	Close(VOID);
		VOID	MonitorData(int *btx_rows,int *btx_fontheight) { rows = btx_rows; };
		ULONG	WaitMask(VOID);
		LONG	GetChar(VOID);
		LONG	Waiting(VOID);
		VOID	PutLine(STRPTR Line);

		void	xputc(int c,int set,int x,int y,int xdouble,int ydouble,int underline,int diacrit,int fg,int bg);
		void	xclearscreen(void);
		void	xcursor(int x,int y);
		void	define_raw_DRC(int c,unsigned char *data,int bits) {};
		void	define_color(int index,int r,int g,int b) {};
		void	define_DCLUT(int entry,int index) {};
		void	define_fullrow_bg(int row,int index) {};
		void	free_DRCS(void) {};
		void	default_colors(void) {};

	private:

		struct Window		*Window;

		struct InputEvent	 Event;

		struct MsgPort		*WindowPort;
		ULONG				 WindowMask;

		WORD				 WaitingChar;

		struct RastPort 	*RPort;

		UWORD				 FontWidth,
							 FontHeight;
		struct TextFont		*Font;

		int					*rows;

		UWORD				 FgPen;
		UWORD				 BgPen;
		UWORD				 MaxPen;

		WORD				 PutIndex;

		VOID				 PutChar(UBYTE c,int x,int y);
		LONG				 MapKey(struct IntuiMessage *Message);
		ULONG				 FindBestModeID(Tag FirstTag,...);
};

#endif	// _TEXTDISPLAY_HPP
