// E32TWIN.H
//
// Copyright (c) 1995-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__E32TWIN_H__)
#define __E32TWIN_H__
#if !defined(__E32CONS_H__)
#include <e32cons.h>
#endif
//

enum TEventType
    {
    EKeyPress,
    EMouseClick
    };

enum TVideoMode
	{
	EMono=1,
	EGray4=2,
	EGray16=4,
	EColor256=8
	};

struct SConsoleKey
	{
 	TKeyCode iCode;
	TUint iModifiers;
    TPoint iMousePos;
    TInt iType;
	};
//
class TConsoleKey : public TPckgBuf<SConsoleKey>
	{
public:
	IMPORT_C TKeyCode Code() const;
	IMPORT_C TInt Modifiers() const;
    IMPORT_C TInt Type() const;
    IMPORT_C TPoint MousePos() const;
	};
//
class RConsole : public RSessionBase
	{
public:
	IMPORT_C TVersion Version();
	IMPORT_C TInt Create();
	IMPORT_C TInt Init(const TDesC &aName,const TSize &aSize);
	IMPORT_C TInt Write(const TDesC &aDes);
	IMPORT_C TInt ClearScreen();
	IMPORT_C TInt ClearToEndOfLine();
	IMPORT_C TInt Destroy();
	IMPORT_C TInt SetTitle(const TDesC &aName);
	IMPORT_C TInt SetSize(const TSize &aSize);
	IMPORT_C TInt SetWindowPosAbs(const TPoint &aPosition);
	IMPORT_C TInt SetCursorHeight(TInt aPercentage);
	IMPORT_C TInt SetCursorPosAbs(const TPoint &aPosition);
	IMPORT_C TInt SetCursorPosRel(const TPoint &aVector);
	IMPORT_C TInt Size(TSize &aSize) const;
	IMPORT_C TInt ScreenSize(TSize &aSize) const;
	IMPORT_C TInt CursorPos(TPoint &aPosition) const;
	IMPORT_C TInt Control(const TDesC &aDes);
	IMPORT_C TInt Read(TConsoleKey &aKeystroke);
	IMPORT_C void Read(TConsoleKey &aKeystroke,TRequestStatus &aStatus);
	IMPORT_C TInt ReadCancel();
	IMPORT_C TInt SetMode(TVideoMode aMode);
	IMPORT_C void SetPaletteEntry(TUint anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue);
	IMPORT_C void GetPaletteEntry(TUint anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue);
	IMPORT_C void SetTextColors(TUint anFgColor,TUint aBgColor);
	IMPORT_C void SetUIColors(TUint aWindowBgColor,TUint aBorderColor,TUint aScreenColor);
	IMPORT_C void SetTextAttribute(TTextAttribute anAttribute);
	};
//
class CConsoleTextWin : public CConsoleBase
	{
public:
	IMPORT_C static CConsoleTextWin *NewL(const TDesC &aTitle,TSize aSize);
	IMPORT_C CConsoleTextWin();
	IMPORT_C virtual ~CConsoleTextWin();
	IMPORT_C virtual TInt Create(const TDesC &aTitle,TSize aSize);
	IMPORT_C virtual void Read(TRequestStatus &aStatus);
	IMPORT_C virtual void ReadCancel();
	IMPORT_C virtual void Write(const TDesC &aDes);
	IMPORT_C virtual TPoint CursorPos() const;
	IMPORT_C virtual void SetCursorPosAbs(const TPoint &aPoint);
	IMPORT_C virtual void SetCursorPosRel(const TPoint &aPoint);
	IMPORT_C virtual void SetCursorHeight(TInt aPercentage);
	IMPORT_C virtual void SetTitle(const TDesC &aTitle);
	IMPORT_C virtual void ClearScreen();
	IMPORT_C virtual void ClearToEndOfLine();
	IMPORT_C virtual TSize ScreenSize() const;
	IMPORT_C virtual TKeyCode KeyCode() const;
	IMPORT_C virtual TUint KeyModifiers() const;
	IMPORT_C virtual void SetTextAttribute(TTextAttribute anAttribute);
	IMPORT_C RConsole &Console();
private:
	TConsoleKey iKey;
	RConsole iConsole;
	};
#endif

