// EIKCHMAP.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__EIKCHMAP_H__)
#define __EIKCHMAP_H__

#if !defined(__COECNTRL_H__)
#include <coecntrl.h>
#endif

#if !defined(__EIKDIALG_H__)
#include <eikdialg.h>
#endif

class CEikCharMap : public CCoeControl
	{
public: // class specific
	IMPORT_C CEikCharMap();
	IMPORT_C ~CEikCharMap();
	IMPORT_C void ConstructL();
	IMPORT_C void SetChar(TInt aChar);
	IMPORT_C TInt GetChar() const;
public: // from CCoeContrl
	IMPORT_C TSize MinimumSize();
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode);
protected: // from CCoeControl
	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	IMPORT_C void Draw(const TRect& aRect) const;
	IMPORT_C void FocusChanged(TDrawNow aDrawNow);
	IMPORT_C void SizeChangedL();
private: //from CCoeContrl
	IMPORT_C void Reserved_1();
	IMPORT_C void Reserved_2();	
private:
	void CommonConstructL();
private:
	void GetRowColFromPointerPos(const TPoint& aPosition);
	TPoint GetCursorPosFromRowCol() const;
	void DrawCursor();
	void MoveCursor(TInt aX, TInt aY);
	void CheckStateChangedL(TInt aOldPos);
	TInt DisplayCharacter(TInt aRet) const;
	void SetMapPos(TInt aChar);
private:
	CFont* iFont;
	TInt iCharWidth;
	TInt iCharHeight;
	TInt iRows;
	TPoint iOffset;
	TPoint iCursorRowCol;
	TBuf<9> iExtraChars;
	};

class CEikCharMapDialog : public CEikDialog
	{
public:
   	IMPORT_C CEikCharMapDialog(CCoeControl* aControl);
private: // framework
	void HandleControlStateChangeL(TInt aResourceId);// from MCoeControlObserver
	TBool OkToExitL(TInt);
	void PreLayoutDynInitL();
	void PostLayoutDynInitL();
private:
	CCoeControl* iControl;
	TInt iLastChar;
	};

#endif
