// FRMTLAY.INL
//
// Copyright (c) 1997-1999 Symbian Ltd. All rights reserved.
//

inline TCursorSelection::TCursorSelection()
	//
	:iCursorPos(0), iAnchorPos(0)
	{}

inline TCursorSelection::TCursorSelection(TInt aCursorPos,TInt aAnchorPos)
	//
	:iCursorPos(aCursorPos), iAnchorPos(aAnchorPos)
	{}

inline void TCursorSelection::SetSelection(TInt aCursorPos,TInt aAnchorPos)
	//
	{
	
	iCursorPos=aCursorPos;
	iAnchorPos=aAnchorPos;
	}

inline TInt TCursorSelection::LowerPos() const 
	//
	{
	return Min(iCursorPos,iAnchorPos);
	}

inline TInt TCursorSelection::HigherPos() const
	//
	{
	return Max(iCursorPos,iAnchorPos);
	}

inline TInt TCursorSelection::Length() const
	//
	{
	return Abs(iCursorPos-iAnchorPos);
	}

inline TCursorPosition::TCursorPosition()
	//
	//Construct a Caret
	//
	:iDocPos(0),iAnchor(0),iOldDocPos(0),iMode(EFReturnCurrentHighlight)
	{}

inline void TCursorPosition::SetLayout(CTextLayout *aLayout)
	//
	{
	
	iLayout=aLayout;
	}

inline TBool TCursorPosition::IsSelection() const
	//
	{
	
	//__ASSERT_DEBUG(iDocPos!=iAnchor || !iSelected,FormPanic(EFZeroSelectedRegion));
	return iSelected;
	}

inline TBool TCursorPosition::IsSelectionToDraw() const
	//
	{
	
	return iDrawSelectionFlags;
	}

inline void TCursorPosition::SetToPreviousHighlight()
	//
	//GetHighlightedRange will now return the previous highlighted range
	//
	{

	iMode=EFReturnPreviousHighlight;
	}

inline void TCursorPosition::SetToCurrentHighlight()
	//
	//GetHighlightedRange will now return the current highlighted range
	//
	{

	iMode=EFReturnCurrentHighlight;
	}

inline void TCursorPosition::UpdateLatentX(TInt aX)
	//
	//Update the remembered horzontal postion
	//
	{
	
	iLatentX=aX;
	}

inline TInt TCursorPosition::LatentX()
	//
	//Return the remembered horzontal postion
	//
	{
	
	return iLatentX;
	}

inline void TCursorPosition::UpdateLatentY(TInt aY)
	//
	//Update the remembered vertical postion
	//
	{
	
	iLatentY=aY;
	}

inline TBool TCursorPosition::CalculateCursorPosL(TPoint& aCurPos)
	//
	//Find out the screen position of the cursor
	//Return EFalse if not in the foramtted region
	//
	{

	return iLayout->DocPosToXyPosL(iDocPos,aCurPos);
	}


