// EIKBUTB.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__EIKBUTB_H__)
#define __EIKBUTB_H__

#if !defined(__EIKBCTRL_H__)
#include <eikbctrl.h>
#endif

#include <eikbutb.hrh>

class TEikButtonCoordinator;

enum TButtonBehavior
	{
	EEikButtonStaysClear=EEikButStaysClear,
	EEikButtonStaysSet=EEikButStaysSet,
	EEikButtonLatches=EEikButLatches,
	EEikButtonReportsOnPointerDown=EEikButReportOnPointerDown
	};

class CEikButtonBase : public CEikBorderedControl
	{
public:
	IMPORT_C CEikButtonBase();
	IMPORT_C ~CEikButtonBase();
public: // new functions
	enum TState
		{
		EClear		  	=0,
		ESet			=1,
		EIndeterminate  =2
		};
	IMPORT_C TState State() const;
	IMPORT_C void SetState(TState aState);
	IMPORT_C virtual void Animate();
	IMPORT_C void SetCoordinator(TEikButtonCoordinator* aButCoord);
	IMPORT_C void SetBehavior(TButtonBehavior aBehavior);
	IMPORT_C void SetIgnoreNextPointerUp();
protected: // new functions
	enum TDrawState
		{
		EDrawClear					=0x00,
		EDrawSet					=0x01,
		EDrawIndeterminate			=0x02,
		EDrawClearPressed			=0x10,
		EDrawSetPressed				=0x11,
		EDrawIndeterminatePressed	=0x12
		};
	IMPORT_C void SetReportOnPointerDown();
	IMPORT_C TDrawState DrawState() const;
	IMPORT_C TBool IsPressed() const;
	IMPORT_C void SetAllowTristate();
	IMPORT_C void CopyDrawStateTo(CEikButtonBase* aTargetButton) const;
private: // from CCoeControl
	IMPORT_C void Reserved_1();
	IMPORT_C void Reserved_2();
private: // new function
	IMPORT_C virtual void StateChanged();
	IMPORT_C virtual void Reserved_3();
public: // framework
	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
private: // internal use only
	TBool ClickCompleted();
private:
	enum { EIgnoreNextPointerUp=0x800 };
protected:
	TInt iButFlags;
private:
	TEikButtonCoordinator* iButCoord;
	};

//
// Button coordinator class
//

class TEikButtonCoordinator
	{
public:
	IMPORT_C TEikButtonCoordinator();
	IMPORT_C void SetChosenButton(CEikButtonBase* aChosenButton);		
private:
	CEikButtonBase* iChosenButton;
	};		 

#endif

