// EIKGYSEL.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__EIKGYSEL_H__)
#define __EIKGYSEL_H__


#if !defined(__EIKBCTRL_H__)
#include <eikbctrl.h>
#endif

#if !defined(__EIKCHLST_H__)
#include <eikchlst.h>
#endif


#if !defined(__EIKBORDR_H__)
#include <eikbordr.h>
#endif

//
// Class CEikGrayPalette
//

class CEikGrayPalette : public CEikBorderedControl
	{
public:
	enum TGrayPaletteDisplayMode
		{
		EDisplayMode4Gray,
		EDisplayMode16Gray,
		EDisplayMode16Color,
		EDisplayMode256Color
		};
public:
    IMPORT_C CEikGrayPalette();
    IMPORT_C ~CEikGrayPalette();
	IMPORT_C void ConstructL(TGrayPaletteDisplayMode aMode);
    IMPORT_C TRgb SelectedGray() const;
    IMPORT_C void SetSelectedGray(const TRgb& aColor);
public: // from CCoeControl
	IMPORT_C void SizeChangedL();
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	IMPORT_C void Draw(const TRect& aRect) const;
private:
	inline TInt MaxLevel() const;
	void DrawGraySelections() const;
	void DrawHighlightToGray(TInt aGrayLevel, TBool aHighLighted) const;
	void DrawHighlightToGrayNow(TInt aGrayLevel, TBool aHighLighted) const;
private:
	TInt iMaxGrayLevel; 
	TInt iSelectedGray;
	TPoint iTopLeft;
	TSize iSingleGrayDisplaySize;
	};


class TResourceReader;

class CEikGraySelector : public CEikChoiceListBase
    {
public:
	IMPORT_C CEikGraySelector();
    IMPORT_C ~CEikGraySelector();
	IMPORT_C void ConstructL(CCoeControl* aParent, TInt aFlags);
    IMPORT_C virtual TSize MinimumSize();
    IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
	IMPORT_C TRgb SelectedColor() const;
	IMPORT_C void SetSelectedColor(TRgb& aColor);
protected:
	IMPORT_C virtual void CreatePopoutL();
    IMPORT_C virtual void DestroyPopout();
	IMPORT_C virtual TInt PopoutCurrentItem() const;
private:
    IMPORT_C virtual void DrawContent() const;
    IMPORT_C void DoCreatePopoutL();
	void CreateGrayLevelArrayL();
	void BaseConstructL(TInt aFlags);
private:
	CEikGrayPalette* iGrayPalette;
	TInt iGraySelectorFlags;
    };								

#endif
