// EIKTELED.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__EIKTELED_H__)
#define __EIKTELED_H__

#if !defined(__EIKEDWIN_H__)
#include <eikedwin.h>
#endif

#if !defined(__T32WLD_H__)
#include <t32wld.h>
#endif

#if !defined(__EIKTELED_HRH)
#include <eikteled.hrh>
#endif

// not available before Release 005
class CEikTelephoneNumberEditor :  public CEikEdwin
	{
public:
	enum TTelephoneEditorMode
		{
		ECoerceFormat=EEikTelephoneNumberEditorModeCoerceFormat,
		EFreeFormat=EEikTelephoneNumberEditorModeFreeFormat
		};
public:
	IMPORT_C CEikTelephoneNumberEditor();
	IMPORT_C ~CEikTelephoneNumberEditor();
	IMPORT_C void ConstructL(TTelephoneEditorMode aMode, TInt aFlags, TPtrC* aPromptArray, TInt aWidth);
	IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc);
	IMPORT_C void SetModeL(TTelephoneEditorMode aMode);
	IMPORT_C void SetNumberL(const TDesC& aNumber);
	IMPORT_C void SetNumberL(const TDesC& aCountry, const TDesC& aArea, const TDesC& aNumber);
	IMPORT_C void GetNumber(TDes& aNumber) const;
	IMPORT_C void BlankNumberL();
public: // from CCoeControl
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	IMPORT_C void FocusChanged(TDrawNow aDrawNow);
private:
	enum TPositionInPart
		{
		EStart=0,
		EMiddle=1,
		EEnd=2
		};
	enum TPart
		{
		ECountry=0,
		EArea=1,
		ENumber=2
		};
	TPtrC NumberOrBlank(TPart aPart, const TDesC& aNumber);
	TPart CheckPart(TPositionInPart& aPos, TInt& aBeg, TInt& aEnd, TInt& aLen) const;
	void SelectPartL(TPart aPart, TPositionInPart aPos);
	void SetCursorVisibilityL(TBool aEmphasis);
	void InsertTextL(TInt aPos, const TDesC& aText);
	void InsertCharL(TInt aPos, TChar aChar);
	void DeleteCharL(TInt aPos, TInt aCode);
	void ChangePartLenL(TPart aPart, TInt aDelta, TInt aOff);
	void ParseToParts(const TDesC& aNumber, TDes& aCountry, TDes& aArea, TDes& aLocal) const;
	void GetText(TDes& aDes) const; // overloaded version of edwin get text
private:
	TTelephoneEditorMode iMode;
	TUint32 iFlags;
	TInt iNumlen[3];
	TInt iBlnkResLen[3];
	TInt iNumPos[3];
	TBuf<20> iPrompts[3];
	RWorldServer iRws;
	};

#endif
