AknSettingPage.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name     : AknSettingPage.h
00004 *  Part of      : Avkon
00005 *
00006 *  Description:
00007 *  Base class for setting page (setting item editing) UI
00008 *  Version:
00009 *
00010 *  Copyright ?2002 Nokia Corporation.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia Corporation. All rights are reserved. Copying, 
00014 *  including reproducing, storing,  adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia Corporation. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia Corporation.
00019 * ============================================================================
00020 */
00021 
00022 #ifndef __AKNSETTINGPAGE_H__
00023 #define __AKNSETTINGPAGE_H__ 
00024 
00025 #include <AknControl.h>
00026 
00027 #include <eikdef.h>
00028 #include <eikbtgpc.h>
00029 
00030 // For menu support
00031 #include <eikmenub.h>
00032 #include <eikmenup.h>
00033 #include <eikmobs.h>
00034 
00035 // for layout support
00036 #include <aknutils.h>
00037 
00038 // for navipane support (hint text)
00039 #include <aknnavi.h>
00040 
00041 //
00042 // Forward declarations
00043 //
00044 class CEikLabel;
00045 class CAknSettingPageSkinsInfo;
00046 class MAknsControlContext;
00047 class CAknsFrameBackgroundControlContext;
00048 class CAknSettingPageExtension;
00049 
00050 
00051 // Used as the return value of SettingId() if not yet set.
00052 // This because the Id might want to be the index of a 0-based array
00053 
00054 const TInt KAknSettingPageNoIdSet = -1;
00055 
00056 class CAknSettingPage;
00057 
00058 // This class is used as a means of notifying change in settings.
00059 
00060 class MAknSettingPageObserver 
00061 {
00062 public:
00063 enum TAknSettingPageEvent
00064         {
00065         EEventSettingChanged,
00066         EEventSettingCancelled,
00067         EEventSettingOked
00068         };
00069 public:
00070 
00074 virtual void HandleSettingPageEventL(CAknSettingPage* aSettingPage,TAknSettingPageEvent aEventType )=0;
00075 
00076 };
00077 
00078 class CAknSettingPage : public CAknControl, public MCoeControlObserver, public MEikMenuObserver
00079 {
00080 public:
00081 
00086         enum TAknSettingPageUpdateMode
00087                 {
00088                 EUpdateWhenChanged,
00089                 EUpdateWhenAccepted
00090                 };
00091 
00096         enum TEditedItemSkinClass
00097                 {
00098                 ESettingPageSkinEditedItemClassValueItemList,
00099                 ESettingPageSkinEditedItemClassVolume,
00100                 ESettingPageSkinEditedItemClassSlider,
00101                 ESettingPageSkinEditedItemClassTextEntry,
00102                 ESettingPageSkinEditedItemClassCodeDateTimeEntry
00103                 };
00108         IMPORT_C CAknSettingPage( TInt aSettingPageResourceId );
00135         IMPORT_C CAknSettingPage(       const TDesC* aSettingTitleText, 
00136                                                                 TInt aSettingNumber, 
00137                                                                 TInt aControlType,
00138                                                                 TInt aEditorResourceId, 
00139                                                                 TInt aSettingPageResourceId = 0 );
00143         IMPORT_C virtual ~CAknSettingPage();
00144 
00153         IMPORT_C TBool ExecuteLD( enum CAknSettingPage::TAknSettingPageUpdateMode aMode=EUpdateWhenAccepted );
00154 
00160         IMPORT_C virtual void ConstructL();
00161 
00169         IMPORT_C CCoeControl* EditorControl() const;
00170 
00176         IMPORT_C TInt SettingId() const;
00177 
00185         IMPORT_C void SetSettingId( TInt aSettingId );
00191         IMPORT_C void SetSettingNumberL( const TInt aSettingNumber );
00192 
00201         IMPORT_C void SetSettingTextL( const TDesC& aSettingText );
00202 
00208         IMPORT_C void SetSettingPageObserver( MAknSettingPageObserver* aObserver);
00209 
00214         IMPORT_C TInt SettingNumber() const;
00215 
00220         IMPORT_C TBool IsNumbered() const;
00221 
00226         IMPORT_C void SetNumbered( TBool aNumbered );
00227 
00237         IMPORT_C static void GetEditorResourceInfoL( 
00238                 TInt aSettingPageResourceId, 
00239                 TInt& aControlType, 
00240                 TInt& aEditorResourceId );
00241  
00242  
00250  IMPORT_C void SetEditState(const TBool aEditable);
00251  
00258  IMPORT_C TBool IsEditable() const;
00259  
00266  void GetCaptionForFep(TDes& aCaption) const;
00267  
00268 protected:
00269 
00276         IMPORT_C virtual void SizeChanged();
00277 
00278 
00284         IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow); 
00285         
00293         IMPORT_C virtual void ProcessCommandL(TInt aCommandId);
00294 
00306         IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00307 
00308 //
00309 //
00310 // Framework functions. New in this class
00311 //
00312 //
00321         IMPORT_C virtual TBool OkToExitL(TBool aAccept);
00322         
00328         IMPORT_C virtual void DynamicInitL();
00329 
00334         IMPORT_C virtual void UpdateSettingL();
00335 
00340         IMPORT_C virtual void AcceptSettingL();
00341 
00346         IMPORT_C virtual void RestoreOriginalSettingL();
00347 
00351         IMPORT_C virtual void DisplayMenuL() ;
00352 
00356         IMPORT_C virtual void HideMenu() ;
00357 
00362         IMPORT_C virtual void SetFocusToEditor();
00363 
00369         IMPORT_C virtual void SelectCurrentItemL();
00370 
00376         IMPORT_C void BaseConstructL();
00377 
00384         IMPORT_C void DismissL( TBool aAccept );  
00385 
00391         IMPORT_C TBool MenuShowing() const ;
00392 
00397         IMPORT_C void ConstructFromResourceL( TInt aResourceId);
00398 
00403         IMPORT_C void ConstructFromResourceL(TResourceReader& aRes);
00404 
00414         IMPORT_C void AttemptExitL(TBool aAccept);
00421         IMPORT_C TBool Waiting(); 
00422 
00430         IMPORT_C CEikButtonGroupContainer* Cba() const ;
00431 
00438         IMPORT_C TInt DefaultCbaResourceId() const; 
00439 
00448         IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
00449 
00454         IMPORT_C void StandardSettingPageLayout();
00455 
00462         IMPORT_C TBool IsBaseConstructed();
00463 
00468         IMPORT_C TInt SettingPageResourceId();
00473         IMPORT_C void BaseDraw(const TRect& aRect) const;
00474 
00478         IMPORT_C void ResetFlags();
00479 
00486         IMPORT_C virtual TBool PostDisplayCheckL();
00487 
00494         IMPORT_C virtual void UpdateCbaL();
00495 
00501         IMPORT_C TBool DataValidity() const;
00502 
00508         IMPORT_C void SetDataValidity(TBool aValid);
00509 
00515         IMPORT_C virtual void CheckAndSetDataValidity();
00516 
00530         void SetEditedItemLayoutRect( const TRect& aFrameRect, const TRect& aRealEditorRect);
00531 
00549         void CreateEditedItemControlContextL( TEditedItemSkinClass aSkinClass, TBool aParentAbsolute);
00550 
00558         TBool IsSkinsHandlingEditorFrameDrawing() const;
00559 
00566     CAknsFrameBackgroundControlContext* EditedItemControlContext() const;
00567 
00568 
00569 protected:
00574         IMPORT_C virtual void SetEmphasis(CCoeControl* /*aMenuControl*/,TBool aEmphasis);
00575 
00584         IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); 
00585 
00586 public: // From CCoeControl
00594     IMPORT_C void HandleResourceChange(TInt aType);
00600         IMPORT_C TInt CountComponentControls() const;
00601 
00608         IMPORT_C CCoeControl* ComponentControl(TInt anIndex) const;
00609 
00613     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00620         IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00621         
00622 private:
00623         IMPORT_C virtual void Reserved_MtsmPosition();
00624         IMPORT_C virtual void Reserved_MtsmObject();
00625 
00626 protected:
00632         IMPORT_C TInt InvalidDataCbaResourceId() const; 
00633 
00634 protected: // from MObjectProvider
00635         IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00636 
00637 protected:
00641         TInt iUpdateMode;
00642 
00643         // The following are not owned:
00644 
00648         MAknSettingPageObserver* iSettingPageObserver;
00649 
00650 private:
00651         //From CCoeControl
00652         IMPORT_C void Draw(const TRect& aRect) const;
00653         
00654 private:
00658     IMPORT_C void* ExtensionInterface( TUid aInterface );
00659 
00660 protected:
00661 
00669         IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
00670 
00671 private:
00675         IMPORT_C virtual void Reserved_2();
00676 
00680         void StartActiveScheduler();
00684         void StopActiveScheduler();
00685 
00691         void PopNaviDecoratorIfRequired();
00692 
00693 private:
00694 
00698 private: 
00699         IMPORT_C virtual void CAknSettingPage_Reserved_1();
00700         IMPORT_C virtual void CAknSettingPage_Reserved_2();
00701 
00702 protected:
00707     void SetDrawBackground(const TBool aDrawBackground);    
00708 
00712     TBool IsBackgroundDrawingEnabled() const;
00717     void SetStopActiveSchedulerFlag(const TBool aStopCalled );
00718 
00722     TBool IsStopActiveSchudlerCalled()const;
00723 
00730     IMPORT_C CEikLabel* TextLabel() const;
00731     
00738     IMPORT_C CEikLabel* ShadowText() const;
00739 
00740 private:
00749         const TDesC* iSettingTextFromConstructor;
00750         TInt iResourceId;
00751 
00752         TInt iSettingNumber;
00753         TInt iSettingId;
00754         TInt iMenuBarId;
00755         TInt iControlType;
00756         TInt iEditorResourceId;
00757         TInt iExtensionId;
00758         TInt iCbaResourceId;
00759 
00760         TAknLayoutRect iShadow;
00761         TAknLayoutRect iHighlight;
00762 
00763 // pointer to the return value from the setting page.  
00764 // Needed when presented in waiting mode.  
00765         TBool* iReturn; 
00766         
00767 // Internal flags
00768         TBitFlags iFlags ;
00769 
00770         enum TFlagIndices
00771                 {
00772                 EMenuShowingIndex = 0,
00773                 ENumberedStyleIndex,
00774                 EIsBaseConstructedIndex,
00775                 EHasValidDataIndex
00776                 };
00777 
00778 // Heap objects pointed to here are owned:
00779         CCoeControl* iEditorControl;
00780         CEikLabel* iNumberLabel;
00781         CEikLabel* iTextLabel;
00782         CEikButtonGroupContainer* iCba;
00783         CEikMenuBar* iMenuBar ;
00784         HBufC* iHintText;
00785         HBufC* iSettingText; 
00786         CAknNavigationDecorator* iNaviDecorator;
00787 
00788         // The following are not owned:
00789         // For hint text support
00790         CAknNavigationControlContainer* iNaviPane;
00791 
00792         // Softkey resource when the data is invalid
00793         TInt iInvalidDataCbaResourceId;
00794         
00795         // The following object is used to contain all skinning information required
00796         CAknSettingPageSkinsInfo* iSkinsInfo;
00797 
00798         CActiveSchedulerWait iWait;             // owned, safe to use as direct member data.
00799 
00800     // is setting page editable
00801     TInt iIsProtected;
00802     
00803     // extension to setting page
00804     CAknSettingPageExtension* iExtension;
00805 };
00806 
00807 #endif 

Copyright © Nokia Corporation 2001-2007
Back to top