// EIKLBI.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//


#if !defined(__EIKLBI_H__)
#define __EIKLBI_H__  

#if !defined(__E32BASE_H__)
#include <e32base.h>
#endif

#if !defined(__GDI_H__)
#include <gdi.h>
#endif

class CWindowGc;

#define KDefaultLbxTextColor				TRgb(0, 0, 0)
#define KDefaultLbxHighlightedTextColor		TRgb(255, 255, 255)
#define KDefaultLbxBackColor				TRgb(255, 255, 255)
#define KDefaultLbxHighlightedBackColor		TRgb(0, 0, 0)
#define KDefaultLbxBorderColor				TRgb(0, 0, 0)
#define KDefaultLbxMarkColor				TRgb(0, 0, 0)
#define KDefaultLbxHighlightRectColor		TRgb(0, 0, 0)
#define KDefaultLbxMatcherCursorColor		TRgb(170, 170, 170)

class CListItemDrawer : public CBase
	{
public:
	IMPORT_C ~CListItemDrawer();
	IMPORT_C virtual void DrawItem(TInt aItemIndex, TPoint aItemRectPos, TBool aSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed) const;
	IMPORT_C virtual void ClearRect(const TRect& aRect) const;
	IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
	IMPORT_C virtual TSize MinimumCellSize() const;
	IMPORT_C virtual void SetGc(CWindowGc* aGc);
	IMPORT_C CWindowGc* Gc() const;
	IMPORT_C virtual void SetMarkColumnWidth(TInt aWidthInPixels);
	IMPORT_C virtual void SetMarkGutter(TInt aGapInPixels);
	IMPORT_C TInt MarkColumn() const;
	IMPORT_C TInt MarkGutter() const;
	IMPORT_C void SetItemCellSize(const TSize& aSizeInPixels);
	IMPORT_C virtual void SetViewRect(const TRect& aRect);
	IMPORT_C void SetDrawMark(TBool aDrawMark);
	IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, TInt aCharPos, TInt aItemCellYPos) const;
	IMPORT_C virtual TInt MatcherCursorAscent() const;
	IMPORT_C virtual void DrawItemMark(TBool aSelected, TBool aViewIsDimmed, const TPoint& aMarkPos) const;
	IMPORT_C void SetSymbolFont(const CFont* aFont);
	IMPORT_C void SetVerticalInterItemGap(TInt aGapInPixels);
protected:
	IMPORT_C CListItemDrawer();
	virtual void DrawActualItem(TInt aItemIndex, const TRect& aActualItemRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed) const = 0;
	IMPORT_C virtual void ResetGc() const;
	IMPORT_C TRgb MarkColor() const;
	IMPORT_C TInt VerticalInterItemGap() const;
protected:
	TSize iItemCellSize;
	TInt iMarkGutter;
	TInt iMarkColumnWidth;
	TRect iViewRect;
	TBool iDrawMark;
	TRgb iBackColor;
	TRgb iHighlightedBackColor;
	CWindowGc* iGc;
private:
	const CFont* iSymbolFont;
	TRgb iMarkColor;
	TInt iVerticalInterItemGap;
	};


class MTextListBoxModel;


class CTextListItemDrawer : public CListItemDrawer
	{
public:
	IMPORT_C CTextListItemDrawer();
	IMPORT_C ~CTextListItemDrawer();
	IMPORT_C CTextListItemDrawer(MTextListBoxModel* aTextListBoxModel, const CFont* aFont);
	IMPORT_C virtual void DrawActualItem(TInt aItemIndex, const TRect& aActualItemRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed) const;
	IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
	IMPORT_C virtual TSize MinimumCellSize() const;
	IMPORT_C virtual void SetGc(CWindowGc* aGc);
	IMPORT_C void SetCellWidthInChars(TInt aNumOfCharsToDisplayInCell);
	IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, TInt aCharPos, TInt aItemCellYPos) const;
	IMPORT_C virtual TInt MatcherCursorAscent() const;
protected:
	IMPORT_C virtual void DoDrawItemText(const TDesC& aDes, const TRect& aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized) const;
	IMPORT_C virtual void DrawItemText(TInt aItemIndex, const TRect& aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized) const;  
	IMPORT_C virtual void ResetGc() const;
protected:
	MTextListBoxModel* iModel;
	const CFont* iFont;
	TRgb iTextColor;
	TRgb iHighlightedTextColor;
private:
	TInt iNumOfCharsInCell;
	};


#endif
