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 
00034 class CEikDlgToolTipMgr ;
00041 NONSHARABLE_CLASS(CEikDialogPage) :
00042     public CAknControl,
00043     public MCoeControlObserver, 
00044     public MEikScrollBarObserver, 
00045     public MEikEdwinSizeObserver,
00046     public MAknPopupFieldObserver,
00047     public MEikEdwinObserver
00048     {
00049 public:
00050     enum TFocusNavigationMode
00051         {
00052         ECyclic,
00053         ENonCyclic
00054         };
00055     enum TAScrollBarBreadthAllocationMode
00056         {
00057         ENone                                   =0x0000,
00058         EScrollBarBreadthPreAllocated           =0x1000
00059         };
00065     enum TFormLayoutSelection
00066         {
00067         ESingle,
00068         EDouble
00069         };
00070 
00075     enum TDynamicFormFlags
00076         {
00077         EFormResizeOptimisationFlag = 0x100 ,
00078         EFormForceEdwinResizeFlag = 0x200
00079         } ;
00080 
00081 
00082 public:
00083     ~CEikDialogPage();
00084     static CEikDialogPage* NewL(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver);
00085     static CEikDialogPage* NewLC(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver);
00086     static CEikDialogPage* NewL(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader);
00087     static CEikDialogPage* NewLC(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,const CEikDialogPageContainer& aParent,MEikDialogPageObserver* aPageObserver,TResourceReader& aReader);
00088     void SetDataPosition(TInt aPosition);
00089     TSize PreferredSize() const;
00090     void SetActiveL();
00091     void SetActiveAndFocusL();
00092     void SetInactiveL();
00093     TInt PageId() const;
00094     TInt LineId(const CCoeControl& aControl) const;
00095     TBool SetInitialFocus();
00096     CCoeControl* CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue);
00097     void SetControlCaptionL(TInt aLineId,const TDesC& aText);
00098     void SetControlCaptionL(TInt aLineId,TInt aResourceId);
00099     CCoeControl* Control(TInt aLineId) const;
00100     CCoeControl* ControlOrNull(TInt aLineId) const;
00101     TInt ControlHeight(TInt aLineIndex) const;
00102     CEikCaptionedControl* Line(TInt aLineId) const;
00103     CEikCaptionedControl* LineOrNull(TInt aLineId) const;
00104     CEikCaptionedControl* CurrentLine() const;
00105     void SetDensePacking(TBool aDensePacking);
00106     void InsertLineL(TInt aPosition,TInt aResourceId);
00107     void DeleteLine(TInt aLineId,TBool aRedrawNow);
00108     void AdjustAllIds(TInt aControlIdDelta);
00109     TInt FocusLineL(TInt aLineId);
00110     TInt FocusedLineId() const;
00111     void GetAutoValues();
00112     TKeyResponse OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,TFocusNavigationMode aFocusNavigationMode);
00113     TBool OwnsLine(TInt aLineId) const;
00114     void ResetLineMinimumSizes();
00115     TInt FindLineIndex(const CCoeControl* aControl) const;
00116     TBool RotateFocusByL(TInt aDelta);
00117     TKeyResponse OfferHotKeysKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00118     TBool TakesEnterKey();
00119     TInt LineIndex(TInt aLineId);
00120     void ReportPageChangedL();
00121     void SetFlag(TInt aFlag);
00122     TInt GetFormFlags() const;
00123     void SetFormFlag( TInt16 aFlag, TBool aEnable ) ;  // used with TDynamicFormFlags
00124     void ConstructFormFromResourceL( TResourceReader& aReader ) ;
00125     void SetEditableL( TBool aEditable, TBool aActivePage ) ;
00126     void SetTipManager( CEikDlgToolTipMgr* aTipManager ) ;
00127     TBool IsEditable() const;
00128     TBool IsForm() const;
00129 
00130         void SetDoubleQuery(TBool aIsDoubleQuery);
00131 
00132     CEikFormAnim* AcquireAnim( TBool aAcquire, MEikFormAnimObserver* aObserver ) const;
00133 
00134 public:
00135     void UpdateScrollBarL();
00136 
00137 
00138 public: // from CCoeControl
00139     TSize MinimumSize();
00140     virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00141     virtual void HandleResourceChange(TInt aType);
00142     virtual void PrepareForFocusLossL();
00143     virtual void SetDimmed(TBool aDimmed);
00144     virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00145         //virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00146 public: // from MCoeControlObserver
00147     virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00148 public: // from MEikEdwinSizeObserver
00149     virtual TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);
00150 public: // from MEikEdwinObserver
00151     virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
00152 
00153 public: // from MAknPopupFieldObserver
00154     virtual void HandlePopupFieldEventL(CAknPopupField* aPopupField, TAknPopupFieldEvent aEventType, TInt aHint);
00155 public: 
00156     void SetPageContainer(const CEikDialogPageContainer* aPageContainer);
00157     const CEikDialogPageContainer* PageContainer() const;
00158     void RedrawNecessaryDataNow(const TRect& aRect) const;
00159 protected: // from CCoeControl
00160     void WriteInternalStateL(RWriteStream& aWriteStream) const;
00161     void SizeChanged();
00162     TInt CountComponentControls() const;
00163     CCoeControl* ComponentControl(TInt aIndex) const;
00164     void FocusChanged(TDrawNow aDrawNow);
00165     void Draw(const TRect& aRect) const;
00166 public:
00167     // added to allow Form format to be set by API
00168     IMPORT_C void SetFormLayout(TFormLayoutSelection aLayout);
00169     IMPORT_C TFormLayoutSelection FormLayout() const;
00170 public:
00171     CEikCaptionedControl* FindNextControlOnPageWithHeight(TBool aUpwards,const CEikCaptionedControl* aLineYouAreOn) const;
00172 public:
00173     TBool IsAtOrOffTopOfPage(const CCoeControl* aControl) const;
00174     TBool IsAtOrOffBottomOfPage(const CCoeControl* aControl) const ;
00175 public:
00176     TBool VisibleSizeOnPage(TInt& aHeightOfControlVisibleOnPage, const CCoeControl* aControl) const;
00177 
00178 protected: // from MEikScrollBarObserver
00179     virtual void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
00180 
00181 private: // from CCoeControl
00182     void Reserved_2();
00183 private:
00184     enum TFlag
00185         {
00186         EWindowsSizedForScrollBar=0x0001
00187         };
00188 private: // new functions
00189     void AfterAddingNewLinesL(TInt aNewLineAdded);
00190 
00191     CEikDialogPage(TInt aId,RWindow& aViewWin,CEikScrollBarFrame& aSBFrame,MEikDialogPageObserver* aPageObserver);
00192     void ConstructL();
00193     void ConstructFromResourceL(TResourceReader& aReader, TBool aFormControl = EFalse );
00194     void ConstructByTypeL(TInt aControlType,CEikCaptionedControl* aLine,CCoeControl* aContainer);
00195     void ShowFocus(TBool aFocus, TBool aRedraw=ETrue);
00196     SEikControlInfo CreateCustomControlL(TInt aControlType);
00197     void ChangeFocusTo(TInt aLineIndex);
00198     void PrepareForFocusTransitionL();
00199     TInt IdOfFocusControl() const;
00200     void UpdateScrollBar();
00201     void ChangeFocusToAndExposeL(TInt aLine,TBool aShowWholeControl=EFalse);
00202     TInt TopFocusableLine() const;
00203     TInt BottomFocusableLine() const;
00204     TBool LineIsFocusable(TInt aLine) const;
00205     TBool ResizeEdwinToFitTextL(CEikEdwin* aEdwin, TDrawNow aDrawNow, TSize aDesirableEdwinSize);
00206     TSize SizeDeltaOfEdwinBorderPlusMargins(CEikEdwin* aEdwin) const;
00207     TInt YPosToLine(TInt& aYPos) const;
00208     TInt YPosToLine2(TInt aYPos) const;
00209     TInt LineToYPos(TInt& aLine) const;
00210     void ExposeLine(TInt aLine, TBool aShowWholeLine=EFalse);
00211     void SetDataWinSize();
00212     void PassOnEventL(CCoeControl* aControl,MCoeControlObserver::TCoeEvent aEvent);
00213     CEikCaptionedControl* ConstructLineL(TInt aResourceId);
00214     CEikCaptionedControl* ConstructLineL(TResourceReader& aReader);
00215     void ConstructLineL(TResourceReader& aReader,CEikCaptionedControl* aLine);
00216     TKeyResponse HandleCyclicFocusNavigationKeyL(const TKeyEvent& aKeyEvent);
00217     TKeyResponse HandleNonCyclicFocusNavigationKeyL(const TKeyEvent& aKeyEvent);
00218     void MakeEdwinScrollbarsVisibleL(TBool aVisible);
00219     TBool Flag(TFlag aFlag) const;
00220     void SetFlag(TFlag aFlag);
00221     void ClearFlag(TFlag aFlag);
00222     void LineChangedL(TInt aControlId);
00223 
00224     void UpdateToolTipL() ;
00225     void UpdateScrollBarThumb();
00226 
00227     TInt CalculateEdwinCursorPosition( CEikEdwin* aEdwin , TInt& aLineNumber ) const ;
00228     TInt GetPositionOfEdwinCursorInDataWin(CEikEdwin* aEdwin) const;
00229     void ReconsiderPageSize();
00230         void PrepareToDrawVerticalLine() const;
00231 
00232     enum TScrollDirection
00233         {
00234         ESingleLineScrollUp ,
00235         ESingleLineScrollDown
00236         } ;
00237     void RegisterComponentL(TInt aControlType, CCoeControl* aControl, CEikCaptionedControl* aLine);
00238     static void CommonConstructCodeBetweenNewL(CEikDialogPage& aDialogPage, const CEikDialogPageContainer& aParent);
00239 
00240         // some private layout methods
00241         TInt NumberOfLinesOfContent(TInt aLineIndex);
00242         TInt MaxNumberOfLinesOnPage();
00243         TInt PositionOneDataPane(TInt aLineIndex, TInt aFirstLineOffsetOnScreen, TInt aLinesHidden);
00244         void PositionFormFields(TInt aFirstLineIndex, TInt aLastLineIndex, TInt aFirstTextLineIndex);
00245 
00246         TBool IsDataPane(TInt aLineIndex);
00247         TBool IsDataWidePane(TInt aLineIndex);
00248         TBool IsPopupPane(TInt aLineIndex);
00249         TBool IsPopupWidePane(TInt aLineIndex);
00250         TBool IsSliderPane(TInt aLineIndex);
00251         TBool IsSliderWidePane(TInt aLineIndex);
00252 public:
00253         TInt TopLineIndex() const;
00254         TInt BottomLineIndex() const;
00255         TInt HiddenLines() const;
00256 
00257 public: 
00258     TBool AnythingToDisplay() const;
00259     void DrawVerticalLine() const;
00260     CEikCaptionedControl* LineOnPageOrNull(TInt aLine) const;
00261     TSize RealDataSize() const;
00262     TInt NumberOfLines() const;
00263     CEikCaptionedControl* LineByIndex(TInt aIndex) const;
00264 private:
00265     RWindow& iViewWin;
00266     CEikScrollBarFrame& iSBFrame;    //no longer in use. SB is used via iPageContainer->ScrollBar()
00267     CEikCapCArray* iLines;
00268     MEikDialogPageObserver* iPageObserver;
00269     TInt iPageId;
00270     TInt iCurrentLine;
00271     TPoint iViewWinPos;
00272     TSize iViewWinSize;
00273     TPoint iDataWinPos;
00274     TSize iDataWinSize;
00275     TInt iFlags;
00276     TInt16 iFormFlags ;
00277     TBool iIsEditable;
00278 
00279     TBool iFormControl ;
00280     CEikDlgToolTipMgr* iTipManager ;
00281 
00282     TInt iLastExposedLine;
00283     TInt iLastExposedLineViewWinYPosition;
00284     const CEikDialogPageContainer* iPageContainer;
00285     TFormLayoutSelection iFormLayout;
00286 
00287     // Offset necessary because LAF instructs use of List Layout for Forms but the parent panes have different origins.
00288     TInt iXOffsetForDataPaneInEditMode ;
00289     TInt iYOffsetForDataPaneInEditMode ;
00290 
00291     // Variables set from LAF to replace hard coded constants.
00292     TInt iDialogPageScreenWidth ;
00293     TInt iDialogPageScreenHeight ;
00294     TInt iDialogPageDataHeight ;
00295         CAknPaneScroll *iScroll;
00296         // this iBgContext is different from dialog's context that its used only inside dialogpage's window.
00297         //CAknsListBoxBackgroundControlContext *iBgContext;
00298 public:
00299 mutable CEikEdwin* iIgnoreFurtherEdwinResizeEvents;
00300 private:
00301     CDialogPageExtension* iExtension;
00302     void DrawEmptyListL( CWindowGc& aGc );
00303 
00304 public:
00310         virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00311         
00312         void SetScbState(TBool aExternal);
00313     TBool ScbState() const;
00314 
00315 private:
00319     IMPORT_C void* ExtensionInterface( TUid aInterface );
00320         };
00321 
00322 
00330 NONSHARABLE_CLASS(CEikDialogPageContainer) : public CAknControl, public MCoeControlContext
00331     {
00332 public:
00333     ~CEikDialogPageContainer();
00334     static CEikDialogPageContainer* NewL(const CCoeControl& aParent,MEikDialogPageObserver* aPageObserver);
00335     static CEikDialogPageContainer* NewLC(const CCoeControl& aParent,MEikDialogPageObserver* aPageObserver);
00336     TSize PreferredSize(const TSize& aMaxSize) const;
00337     void SetActivePageByIdL(TInt aPageId);
00338     void SetActivePageByIndexL(TInt aPageIndex);
00339     TInt ActivateFirstPageL();
00340     void AddPageL(TInt aPageId);
00341     void AddPageL(TInt aPageId,TResourceReader& aReader);
00342     TBool SetInitialFocus();
00343     CEikCaptionedControl* Line(TInt aLineId) const;
00344     CEikCaptionedControl* LineOrNull(TInt aLineId) const;
00345     CEikCaptionedControl* CurrentLine() const;
00346     void SetPageDensePacked(TInt aPageId,TBool aDensePacked);
00347     void SetAllPagesDensePacked(TBool aDensePacked);
00348     void SetPageDimmed(TInt aPageId,TBool aDimmed,TDrawNow aDrawNow);
00349     TBool IsActivePageDimmed() const;
00350     TInt LineId(const CCoeControl& aControl) const;
00351     void InsertLineL(TInt aPosition,TInt aPageId,TInt aResourceId);
00352     void DeleteLine(TInt aLineId, TBool aRedrawNow);
00353     void AdjustAllIds(TInt aPageId,TInt aControlIdDelta);
00354     CCoeControl* CreateLineByTypeL(const TDesC& aCaption,TInt aLineId,TInt aControlType,TAny* aReturnValue);
00355     CCoeControl* CreateLineByTypeL(const TDesC& aCaption,TInt aPageId,TInt aLineId,TInt aControlType,TAny* aReturnValue);
00356     TInt FocusLineL(TInt aLineId);
00357     TInt FocusedLineId() const;
00358     void GetAutoValues();
00359     TKeyResponse OfferUpDownKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType,CEikDialogPage::TFocusNavigationMode aFocusNavigationMode);
00360     TInt ActivePageId() const;
00361     TInt ActivePageIndex() const;
00362     void ResetLineMinimumSizes();
00363     TInt FindLineIndex(const CCoeControl& aControl) const;
00364     TBool RotateFocusByL(TInt aDelta);
00365     TInt NumPages() const;
00366     TKeyResponse OfferHotKeysKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00367     TBool TakesEnterKey();
00368     TInt FindPageIndexForLineId(TInt aLineId);
00369     void SetPageFlag(TInt aPageId, TInt aFlag);
00370 
00371     CEikDialogPage* Page( TInt aPageID ) ;
00372     void SetEditableL( TBool aEditable ) ;
00373     void SetTipManager( CEikDlgToolTipMgr* aTipManager ) ;
00374 
00375     CEikFormAnim* AcquireAnim( TBool aAcquire, MEikFormAnimObserver* aObserver ) const;
00376 
00377 public: // from CCoeControl
00378     virtual void Draw(const TRect& aRect) const;
00379     virtual TSize MinimumSize();
00380     virtual void PrepareForFocusLossL();
00381     virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00382     virtual void HandleResourceChange(TInt aType);
00383 public: // from MCoeControlContext
00384     virtual void PrepareContext(CWindowGc& aGc) const;
00385 public:
00386     void SetPageFormSized();
00387 protected:  // from CCoeControl
00388     virtual void SizeChanged();
00389     virtual TInt CountComponentControls() const;
00390     virtual CCoeControl* ComponentControl(TInt aIndex) const;
00391     virtual void ActivateL();
00392     virtual void FocusChanged(TDrawNow aDrawNow);
00393     virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
00394     virtual void Reserved_2();
00395 public: 
00396     void SetPageSelector(const CEikDialogPageSelector* aPageSelector);
00397     const CEikDialogPageSelector* PageSelector() const; 
00398     void DrawBackgroundNow(const TRect& aRect) const;
00399 private:
00400     void DrawBackground(const TRect& aRect) const;
00401 private:
00402     CEikDialogPageContainer(MEikDialogPageObserver* aPageObserver);
00403     void ConstructL(const CCoeControl& aParent);
00404     void ConstructFromResourceL(TResourceReader& aReader,const CCoeControl& aParent);
00405     void CommonConstructL(const CCoeControl& aParent);
00406     void CreatePageArrayL();
00407     //void CreateScrollBarL(const CCoeControl& aParent); ->public
00408     void CreateViewWinL(const CCoeControl& aParent);
00409     TInt PageIndex(TInt aPageId) const;
00410     TInt PageId(TInt aIndex) const;
00411     TInt PageIdFromLineId(TInt aLineId) const;
00412     void SetToolTips() ;
00413 public:
00414     void CreateScrollBarL(const CCoeControl& aParent);
00415     CEikScrollBarFrame* ScrollBar() const;
00416     
00417 private:
00418     CEikScrollBarFrame* iSBFrame;
00419     CArrayPtr<CEikDialogPage>* iPageArray;
00420     MEikDialogPageObserver* iPageObserver;
00421     TInt iActivePage;
00422     CEikDlgToolTipMgr* iTipManager ;
00423     const CEikDialogPageSelector* iPageSelector;
00424     TBool iForm;
00425     TBool iIsEditable;
00426 
00427     // Variables set from LAF to replace hard coded constants.
00428     TInt iDialogPageScreenWidth ;
00429     TInt iDialogPageScreenHeight ;
00430     TInt iDialogPageDataHeight ;
00431 
00432         CAknLayoutData *iLayoutData; // deprecated
00439     CEikFormAnim* iAnimation;
00440     };
00441 
00442 #endif

Copyright © Nokia Corporation 2001-2008
Back to top