EIKDPAGE.H

Go to the documentation of this file.
00001 // EIKDPAGE.H
00002 //
00003 // Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
00004 //
00005 
00006 #if !defined(__EIKDPAGE_H__)
00007 #define __EIKDPAGE_H__
00008 
00009 #include <coeccntx.h>
00010 #include <eiksbfrm.h>
00011 #include <coecobs.h>
00012 #include <eikedwob.h>
00013 #include <aknpopupfieldtext.h>
00014 #include <AknControl.h>
00015 
00016 //
00017 // Forward declarations.
00018 //
00019 
00020 class CEikCapCArray;
00021 class CEikCaptionedControl;
00022 class CEikDialogPageContainer;
00023 class CEikEdwin;
00024 class CEikLabel;
00025 class MEikDialogPageObserver;
00026 struct SEikControlInfo;
00027 class CAknLayoutData;
00028 class CDialogPageExtension;
00029 
00030 class CEikFormAnim;
00031 class MEikFormAnimObserver;
00032 class CAknPaneScroll;
00033 
00040 NONSHARABLE_CLASS(CEikDialogPage) :
00041     public CAknControl,
00042     public MCoeControlObserver, 
00043     public MEikScrollBarObserver, 
00044     public MEikEdwinSizeObserver,
00045     public MAknPopupFieldObserver,
00046     public MEikEdwinObserver
00047     {
00048 public:
00049     enum TFocusNavigationMode
00050         {
00051         ECyclic,
00052         ENonCyclic
00053         };
00054     enum TAScrollBarBreadthAllocationMode
00055         {
00056         ENone                                   =0x0000,
00057         EScrollBarBreadthPreAllocated           =0x1000
00058         };
00064     enum TFormLayoutSelection
00065         {
00066         ESingle,
00067         EDouble
00068         };
00069 
00074     enum TDynamicFormFlags
00075         {
00076         EFormResizeOptimisationFlag = 0x100 ,
00077         EFormForceEdwinResizeFlag = 0x200
00078         } ;
00079 
00080 public:
00081     ~CEikDialogPage();
00082     static CEikDialogPage* NewL(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver);
00083     static CEikDialogPage* NewLC(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver);
00084     static CEikDialogPage* NewL(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader);
00085     static CEikDialogPage* NewLC(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader);
00086     void SetDataPosition( TInt aTopY, TInt aBottomY, TBool aForceResize );
00087     TSize PreferredSize() const;
00088     void SetActiveL();
00089     void SetActiveAndFocusL();
00090     void SetInactiveL();
00091     TInt PageId() const;
00092     TInt LineId(const CCoeControl& aControl) const;
00093     TBool SetInitialFocus();
00094     CCoeControl* CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue);
00095     CCoeControl* Control(TInt aLineId) const;
00096     CCoeControl* ControlOrNull(TInt aLineId) const;
00097     TInt ControlHeight(TInt aLineIndex) const;
00098     CEikCaptionedControl* Line(TInt aLineId) const;
00099     CEikCaptionedControl* LineOrNull(TInt aLineId) const;
00100     CEikCaptionedControl* CurrentLine() const;
00101     void SetDensePacking(TBool aDensePacking);
00102     void InsertLineL(TInt aPosition,TInt aResourceId);
00103     void DeleteLine(TInt aLineId,TBool aRedrawNow);
00104     void AdjustAllIds(TInt aControlIdDelta);
00105     TInt FocusLineL(TInt aLineId);
00106     TInt FocusedLineId() const;
00107     void GetAutoValues();
00108     TKeyResponse OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode);
00109     TBool OwnsLine(TInt aLineId) const;
00110     void ResetLineMinimumSizes();
00111     TInt FindLineIndex(const CCoeControl* aControl) const;
00112     TBool RotateFocusByL(TInt aDelta);
00113     TKeyResponse OfferHotKeysKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00114     TBool TakesEnterKey();
00115     TInt LineIndex(TInt aLineId);
00116     void ReportPageChangedL();
00117     TInt GetFormFlags() const;
00118     void SetFormFlag( TInt16 aFlag, TBool aEnable ) ;  // used with TDynamicFormFlags
00119     void ConstructFormFromResourceL( TResourceReader& aReader ) ;
00120     void SetEditableL( TBool aEditable, TBool aActivePage ) ;
00121     TBool IsEditable() const;
00122     TBool IsForm() const;
00123 
00124         void SetDoubleQuery(TBool aIsDoubleQuery);
00125 
00126     CEikFormAnim* AcquireAnim( TBool aAcquire, MEikFormAnimObserver* aObserver ) const;
00127 
00128 public:
00129     void UpdateScrollBarL();
00130     TBool LineHandlerCalled() const;
00131 
00132 public: // from CCoeControl
00133     TSize MinimumSize();
00134     virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00135     virtual void HandleResourceChange(TInt aType);
00136     virtual void PrepareForFocusLossL();
00137     virtual void SetDimmed(TBool aDimmed);
00138     virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00139 public: // from MCoeControlObserver
00140     virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00141 public: // from MEikEdwinSizeObserver
00142     virtual TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);
00143 public: // from MEikEdwinObserver
00144     virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
00145 
00146 public: // from MAknPopupFieldObserver
00147     virtual void HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt aHint);
00148 public: 
00149     void SetPageContainer(const CEikDialogPageContainer* aPageContainer);
00150     const CEikDialogPageContainer* PageContainer() const;
00151 protected: // from CCoeControl
00152     void WriteInternalStateL(RWriteStream& aWriteStream) const;
00153     void SizeChanged();
00154     TInt CountComponentControls() const;
00155     CCoeControl* ComponentControl(TInt aIndex) const;
00156     void FocusChanged(TDrawNow aDrawNow);
00157     void Draw(const TRect& aRect) const;
00158 public:
00159     // added to allow Form format to be set by API
00160     IMPORT_C void SetFormLayout(TFormLayoutSelection aLayout);
00161     IMPORT_C TFormLayoutSelection FormLayout() const;
00162 public:
00163 public:
00164     TBool IsAtOrOffTopOfPage(const CCoeControl* aControl) const;
00165     TBool IsAtOrOffBottomOfPage(const CCoeControl* aControl) const ;
00166 public:
00167     TBool VisibleSizeOnPage(TInt& aHeightOfControlVisibleOnPage, const CCoeControl* aControl) const;
00168 
00169 protected: // from MEikScrollBarObserver
00170     virtual void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
00171 
00172 private: // new functions
00173     void AfterAddingNewLinesL(TInt aNewLineAdded);
00174 
00175     CEikDialogPage(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,MEikDialogPageObserver* aPageObserver);
00176     void ConstructL();
00177     void ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl = EFalse );
00178     void ConstructByTypeL(TInt aControlType,CEikCaptionedControl* aLine,CCoeControl* aContainer);
00179     void ShowFocus(TBool aFocus, TBool aRedraw=ETrue);
00180     SEikControlInfo CreateCustomControlL(TInt aControlType);
00181     void ChangeFocusTo(TInt aLineIndex);
00182     void PrepareForFocusTransitionL();
00183     void ChangeFocusToAndExposeL(TInt aLine,TBool aShowWholeControl=EFalse);
00184     TInt TopFocusableLine() const;
00185     TInt BottomFocusableLine() const;
00186     TBool LineIsFocusable(TInt aLine) const;
00187     TBool ResizeEdwinToFitTextL(CEikEdwin* aEdwin, TDrawNow aDrawNow, TSize aDesirableEdwinSize);
00188     TInt YPosToLine2(TInt aYPos) const;
00189     TInt LineToYPos(TInt& aLine) const;
00190     void ExposeLine(TInt aLine, TBool aForceResize, TBool aShowWholeLine = EFalse );
00191     void PassOnEventL(CCoeControl* aControl,MCoeControlObserver::TCoeEvent aEvent);
00192     CEikCaptionedControl* ConstructLineL(TInt aResourceId);
00193     CEikCaptionedControl* ConstructLineL(TResourceReader& aReader);
00194     TKeyResponse HandleCyclicFocusNavigationKeyL(const TKeyEvent& aKeyEvent);
00195     TKeyResponse HandleNonCyclicFocusNavigationKeyL(const TKeyEvent& aKeyEvent);
00196     void MakeEdwinScrollbarsVisibleL(TBool aVisible);
00197     void LineChangedL(TInt aControlId);
00198     void UpdateScrollBarThumb();
00199     void ReconsiderPageSize();
00200         void PrepareToDrawVerticalLine() const;
00201 
00202     enum TScrollDirection
00203         {
00204         ESingleLineScrollUp ,
00205         ESingleLineScrollDown
00206         } ;
00207     void RegisterComponentL(TInt aControlType, CCoeControl* aControl, CEikCaptionedControl* aLine);
00208     static void CommonConstructCodeBetweenNewL(CEikDialogPage& aDialogPage, const CEikDialogPageContainer& aParent);
00209 
00210 public: 
00211     TBool AnythingToDisplay() const;
00212     void DrawVerticalLine() const;
00213     CEikCaptionedControl* LineOnPageOrNull(TInt aLine) const;
00214     TSize RealDataSize() const;
00215     TInt NumberOfLines() const;
00216     CEikCaptionedControl* LineByIndex(TInt aIndex) const;
00217 private:
00218     CEikCapCArray* iLines;
00219     MEikDialogPageObserver* iPageObserver;
00220     TInt iPageId;
00221     TInt iCurrentLine;
00222     TInt16 iFormFlags ;
00223     TBool iIsEditable;
00224     TBool iFormControl ;
00225     TInt iLastExposedLine;
00226     TInt iLastExposedLineViewWinYPosition;
00227     const CEikDialogPageContainer* iPageContainer;
00228     TFormLayoutSelection iFormLayout;
00229         CAknPaneScroll *iScroll;
00230 public:
00231 mutable CEikEdwin* iIgnoreFurtherEdwinResizeEvents;
00232 private:
00233     CDialogPageExtension* iExtension;
00234     void DrawEmptyListL( CWindowGc& aGc );
00235 
00236 public:
00242         virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00243         
00244         void SetScbState(TBool aExternal);
00245     TBool ScbState() const;
00246 
00247 private:
00251     IMPORT_C void* ExtensionInterface( TUid aInterface );
00252         };
00253 
00254 
00262 NONSHARABLE_CLASS(CEikDialogPageContainer) : public CAknControl, public MCoeControlContext, public MCoeControlHitTest
00263     {
00264 public:
00265     ~CEikDialogPageContainer();
00266     static CEikDialogPageContainer* NewL(const CCoeControl& aParent,MEikDialogPageObserver* aPageObserver);
00267     static CEikDialogPageContainer* NewLC(const CCoeControl& aParent,MEikDialogPageObserver* aPageObserver);
00268     TSize PreferredSize(const TSize& aMaxSize) const;
00269     void SetActivePageByIdL(TInt aPageId);
00270     void SetActivePageByIndexL(TInt aPageIndex);
00271     TInt ActivateFirstPageL();
00272     void AddPageL(TInt aPageId);
00273     void AddPageL(TInt aPageId,TResourceReader& aReader);
00274     TBool SetInitialFocus();
00275     CEikCaptionedControl* Line(TInt aLineId) const;
00276     CEikCaptionedControl* LineOrNull(TInt aLineId) const;
00277     CEikCaptionedControl* CurrentLine() const;
00278     void SetPageDensePacked(TInt aPageId,TBool aDensePacked);
00279     void SetAllPagesDensePacked(TBool aDensePacked);
00280     void SetPageDimmed(TInt aPageId,TBool aDimmed,TDrawNow aDrawNow);
00281     TBool IsActivePageDimmed() const;
00282     TInt LineId(const CCoeControl& aControl) const;
00283     void InsertLineL(TInt aPosition,TInt aPageId,TInt aResourceId);
00284     void DeleteLine(TInt aLineId, TBool aRedrawNow);
00285     void AdjustAllIds(TInt aPageId,TInt aControlIdDelta);
00286     CCoeControl* CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue);
00287     CCoeControl* CreateLineByTypeL(const TDesC& aCaption,TInt aPageId,TInt aLineId,TInt aControlType,TAny* aReturnValue);
00288     TInt FocusLineL(TInt aLineId);
00289     TInt FocusedLineId() const;
00290     void GetAutoValues();
00291     TKeyResponse OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,CEikDialogPage::TFocusNavigationMode aFocusNavigationMode);
00292     TInt ActivePageId() const;
00293     TInt ActivePageIndex() const;
00294     void ResetLineMinimumSizes();
00295     TInt FindLineIndex(const CCoeControl& aControl) const;
00296     TBool RotateFocusByL(TInt aDelta);
00297     TInt NumPages() const;
00298     TKeyResponse OfferHotKeysKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00299     TBool TakesEnterKey();
00300     TInt FindPageIndexForLineId(TInt aLineId);
00301     CEikDialogPage* Page( TInt aPageID ) ;
00302     void SetEditableL( TBool aEditable ) ;
00303 
00304     CEikFormAnim* AcquireAnim( TBool aAcquire, MEikFormAnimObserver* aObserver ) const;
00305 
00306 public: // from CCoeControl
00307     virtual void Draw(const TRect& aRect) const;
00308     virtual TSize MinimumSize();
00309     virtual void PrepareForFocusLossL();
00310     virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00311     virtual void HandleResourceChange(TInt aType);
00312 public: // from MCoeControlContext
00313     virtual void PrepareContext(CWindowGc& aGc) const;
00314 public:
00315     TBool HitRegionContains( const TPoint& aPoint, const CCoeControl& aControl ) const;
00316 public:
00317     void SetPageFormSized();
00318 protected:  // from CCoeControl
00319     virtual void SizeChanged();
00320     virtual TInt CountComponentControls() const;
00321     virtual CCoeControl* ComponentControl(TInt aIndex) const;
00322     virtual void ActivateL();
00323     virtual void FocusChanged(TDrawNow aDrawNow);
00324     virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
00325 public: 
00326     void SetPageSelector(const CEikDialogPageSelector* aPageSelector);
00327     const CEikDialogPageSelector* PageSelector() const; 
00328 private:
00329     CEikDialogPageContainer(MEikDialogPageObserver* aPageObserver);
00330     void ConstructL(const CCoeControl& aParent);
00331     void ConstructFromResourceL(TResourceReader& aReader,const CCoeControl& aParent);
00332     void CommonConstructL(const CCoeControl& aParent);
00333     void CreatePageArrayL();
00334     TInt PageIndex(TInt aPageId) const;
00335     TInt PageId(TInt aIndex) const;
00336     TInt PageIdFromLineId(TInt aLineId) const;
00337 public:
00338     void CreateScrollBarL(const CCoeControl& aParent);
00339     CEikScrollBarFrame* ScrollBar() const;
00340     
00341 private:
00342     CEikScrollBarFrame* iSBFrame;
00343     CArrayPtr<CEikDialogPage>* iPageArray;
00344     MEikDialogPageObserver* iPageObserver;
00345     TInt iActivePage;
00346     const CEikDialogPageSelector* iPageSelector;
00347     TBool iForm;
00348     TBool iIsEditable;
00349 
00356     CEikFormAnim* iAnimation;
00357     };
00358 
00359 #endif

Copyright © Nokia Corporation 2001-2007
Back to top