// COEALIGN.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__COEALIGN_H__)
#define __COEALIGN_H__

#if !defined(__E32STD_H__)
#include <e32std.h>
#endif

#if !defined(__E32BASE_H__)
#include <e32base.h>
#endif

#if !defined(__GDI_H__)
#include <gdi.h>
#endif

enum TCoeHAlignment
	{
	EHLeft=CGraphicsContext::ELeft,
	EHCenter=CGraphicsContext::ECenter,
	EHRight=CGraphicsContext::ERight
	};

enum TCoeVAlignment
	{
	EVTop=0x00,
	EVCenter=0x10,
	EVBottom=0x20
	};

enum TCoeAlignmentValue
	{
	EHLeftVTop=EHLeft|EVTop,	EHLeftVCenter=EHLeft|EVCenter,		EHLeftVBottom=EHLeft|EVBottom,
	EHCenterVTop=EHCenter|EVTop,EHCenterVCenter=EHCenter|EVCenter,	EHCenterVBottom=EHCenter|EVBottom,
	EHRightVTop=EHRight|EVTop,	EHRightVCenter=EHRight|EVCenter,	EHRightVBottom=EHRight|EVBottom
	};

class TCoeAlignment
	{
private:
	enum {EHMask=0x03, EVMask=0x30};
public:
	inline TCoeAlignment();
	inline TCoeAlignment(TCoeAlignmentValue aValue);
	inline operator TCoeAlignmentValue() const;
	inline TCoeVAlignment VAlignment() const;
	inline TCoeHAlignment HAlignment() const;
	inline CGraphicsContext::TTextAlign TextAlign() const;
	IMPORT_C void SetVAlignment(TCoeVAlignment aVAlign);
	IMPORT_C void SetHAlignment(TCoeHAlignment aHAlign);
	IMPORT_C TPoint InnerTopLeft(const TRect& aOuter,const TSize& aInnerSize) const;
	IMPORT_C TRect InnerRect(const TRect& aOuter,const TSize& aInnerSize) const;
private:
	TCoeAlignmentValue iValue;
	};

inline TCoeAlignment::TCoeAlignment()
	{};
inline TCoeAlignment::TCoeAlignment(TCoeAlignmentValue aValue)
	{iValue=aValue;}
inline TCoeAlignment::operator TCoeAlignmentValue() const
	{return(iValue);}
inline TCoeVAlignment TCoeAlignment::VAlignment() const
	{return((TCoeVAlignment)(iValue&EVMask));}
inline TCoeHAlignment TCoeAlignment::HAlignment() const
	{return((TCoeHAlignment)(iValue&EHMask));}
inline CGraphicsContext::TTextAlign TCoeAlignment::TextAlign() const
	{return((CGraphicsContext::TTextAlign)(HAlignment()));}
#endif
