// EIKDIALG.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#if !defined(__EIKDIALG_H__)
#define __EIKDIALG_H__

#if !defined(__EIKFORM_H__)
#include <eikform.h>
#endif

#if !defined(__COECCNTX_H__)
#include <coeccntx.h>
#endif

#if !defined(__EIKBUTB_H__)
#include <eikbutb.h>
#endif

class CEikMover;
class CEikCaptionedControl;
class CEikCapCArray;
class CEikButtonPanel;
class CEikPageSelector;
struct SEikRange;
struct SEikDegreesMinutesDirection;
struct SEikControlInfo;

class CEikDialog : public CEikForm, public MCoeControlBrushContext
	{ 
public:
	IMPORT_C CEikDialog(); 
	IMPORT_C ~CEikDialog(); 
	IMPORT_C TInt ExecuteLD(TInt aResourceId);
	IMPORT_C void PrepareLC(TInt aResourceId);
	IMPORT_C TInt RunLD();
	IMPORT_C void SetTitleL(const TDesC& aText);
	IMPORT_C void SetTitleL(TInt aResourceId);
	IMPORT_C CEikMover* Title() const;
	IMPORT_C void SetPageDimmedNow(TInt aPageId,TBool aDimmed);
	IMPORT_C void SetLineNonFocusing(TInt aControlId);
	IMPORT_C void SetLineDimmedNow(TInt aControlId,TBool aDimmed);
	IMPORT_C void MakeLineVisible(TInt aControlId,TBool aVisible);
	IMPORT_C void MakeWholeLineVisible(TInt aControlId,TBool aVisible);
	IMPORT_C void DeleteLine(TInt aControlId);
	IMPORT_C void InsertLineL(TInt aIndex,TInt aResourceId,TInt aPageId=0);
	IMPORT_C void MakePanelButtonVisible(TInt aButtonId,TBool aVisible);
	IMPORT_C void TryChangeFocusToL(TInt aControlId);
	IMPORT_C void SwitchLineLatency(TInt aBecomesLatent,TInt aNoLongerLatent);
	IMPORT_C void SetPageDensePacking(TInt aPageId,TBool aDensePacking);
	IMPORT_C void DeclareItemAuto(TInt aControlId,TInt aControlType,TAny* aReturnValue);
public: // from CCoeControl
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
public: // auto dialog API
	IMPORT_C void ConstructAutoDialogLC(TInt aFlags,TInt aButtonsId);
	IMPORT_C void SetButtonPanel(CEikButtonPanel* aButtonPanel);
	IMPORT_C CEikButtonPanel* ButtonPanel();
	IMPORT_C CEikPageSelector* PageSelector();
protected: // new functions
	IMPORT_C void TryExitL(TInt aButtonId);
	IMPORT_C void AdjustAllIdsOnPage(TInt aPageId,TInt aControlIdDelta);
// The following functions defined in EIKDLGUT.CPP
public: // For auto dialogs - Declare functions
	IMPORT_C void DeclareAutoTextEditorL(TInt aId,TDes* aText);
	IMPORT_C void DeclareAutoChoiceList(TInt aId,TInt* aCurrentItem);
	IMPORT_C void DeclareAutoNumberEditor(TInt aId,TInt* aNumber);
	IMPORT_C void DeclareAutoRangeEditor(TInt aId,SEikRange* aRange);
	IMPORT_C void DeclareAutoTimeEditor(TInt aId,TTime* aTime);
	IMPORT_C void DeclareAutoDateEditor(TInt aId,TTime* aDate);
	IMPORT_C void DeclareAutoTimeAndDateEditor(TInt aId,TTime* aTimeAndDate);
	IMPORT_C void DeclareAutoDurationEditor(TInt aId,TTimeIntervalSeconds* aDuration);
	IMPORT_C void DeclareAutoTimeOffsetEditor(TInt aId,TTimeIntervalSeconds* aTimeOffset);
	IMPORT_C void DeclareAutoLatitudeEditor(TInt aId,SEikDegreesMinutesDirection* aLatitude);
	IMPORT_C void DeclareAutoLongitudeEditor(TInt aId,SEikDegreesMinutesDirection* aLongitude);
	IMPORT_C void DeclareAutoTwipsEditorL(TInt aId,TInt* aValue);
	IMPORT_C void DeclareAutoFixedPointEditor(TInt aId,TInt* aValue);
	IMPORT_C void DeclareAutoCheckBox(TInt aId,CEikButtonBase::TState* aState);
	IMPORT_C void DeclareAutoSecretEditor(TInt aId,TDes* aText);
	IMPORT_C void DeclareAutoHorOptionButList(TInt aId,TInt* aSet);
protected:	// Set state functions  
	IMPORT_C void SetSoundSelectorSound(TInt aControlId, const TDesC& aSound);
	IMPORT_C void SetListBoxCurrentItem(TInt aControlId, TInt aItem);
	IMPORT_C void SetCharEditor(TInt aControlId, TChar aChar);
	IMPORT_C void SetFileNameL(TInt aControlId, const TDesC* aFileName);
	IMPORT_C void SetCharMap(TInt aControlId, TInt aChar);
	IMPORT_C void SetGraySelectorColor(TInt aControlId, TRgb aColor);
protected:	// Get state functions
	IMPORT_C void GetSoundSelectorSound(TDes& aSound, TInt aControlId) const;
	IMPORT_C TInt ListBoxCurrentItem(TInt aControlId) const;
	IMPORT_C TChar CharEditor(TInt aControlId) const;
    IMPORT_C void GetFileName(TFileName* aFileName,TInt aControlId) const;
	IMPORT_C TInt CharMap(TInt aControlId) const;
	IMPORT_C TRgb GraySelectorColor(TInt aControlId) const;
// End of functions defined in EIKDLGUT.CPP
protected: // sleeping dialog API
	IMPORT_C void ConstructSleepingDialogL(TInt aResourceId);
	IMPORT_C void ConstructSleepingAlertDialogL(TInt aResourceId);
	IMPORT_C TInt RouseSleepingDialog();
	IMPORT_C void ExitSleepingDialog();
protected:  // from CEikForm
	IMPORT_C virtual void PrepareForFocusTransitionL();
	IMPORT_C virtual void ShowFocus(TBool aFocus);
private: // from CCoeControl
	IMPORT_C void Draw(const TRect& aRect) const;
	IMPORT_C TInt CountComponentControls() const;
	IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
	IMPORT_C void SizeChangedL();
	IMPORT_C TSize MinimumSize();
	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
	IMPORT_C void Reserved_1();
	IMPORT_C void Reserved_2();
private: // from MCoeControlObserver
	IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
private: // from CEikForm
	IMPORT_C virtual TInt LineIndexFromId(TInt aControlId,CEikCapCArray*& aArray) const;
	IMPORT_C virtual void Reserved_3();
private: // new functions
	IMPORT_C virtual TBool OkToExitL(TInt aButtonId);
	IMPORT_C virtual void PreLayoutDynInitL();
	IMPORT_C virtual void PostLayoutDynInitL();
	IMPORT_C virtual void SetInitialCurrentLine();
	IMPORT_C virtual void HandleControlStateChangeL(TInt aControlId);
	IMPORT_C virtual void HandleInteractionRefused(TInt aControlId);
	IMPORT_C virtual void SetSizeAndPositionL(const TSize& aSize);
	IMPORT_C virtual void PageChangedL(TInt aControlId);
	IMPORT_C virtual void Reserved_4();
private: // internal functions
	TInt TopmostFocusableLineIndex() const;
	TInt BottommostFocusableLineIndex() const;
	void BaseConstructL();
	void StaticConstructL(TInt aResourceId);
	void DynamicConstructL();
	void CreateTitleBarL();
	void CreateButtonsL(TInt aResourceId);
	void CreatePageSelectorL(TInt aResourceId);
	TInt WaitAsRequired();
	TInt IdFromLineNumber(TInt aLineNumber) const;
	TInt FindButtonId(CCoeControl* aControl) const;
	TKeyResponse TryAnimateButtonAndExitL(TInt aKeycode);
	void ConstructPageFromResourceL(CEikCapCArray* aLines,TResourceReader& aReader,CCoeControl* aContainer);
	void ConstructRemainingPagesL();
	void SetLinesRectL(const TRect& aRect);
	void HandlePageChangeL();
	void GetAutoValues();
	static void CheckNonFocusingState(CCoeControl* aControl);
	void ResetLineMinimumSizes();
	TBool ButtonsConsumedKeyL(TInt aCode);
	void CommonConstructSleepingDialog(TInt aResourceId);
private:
	CEikMover* iTitleBar;
	CEikButtonPanel* iButtonPanel;
	CEikPageSelector* iPageSelector;
	TInt iDialogFlags;
	TInt* iExitConfirmed;
	};
 
#endif
