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  
00260 protected:
00261 
00268         IMPORT_C virtual void SizeChanged();
00269 
00270 
00276         IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow); 
00277         
00285         IMPORT_C virtual void ProcessCommandL(TInt aCommandId);
00286 
00298         IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00299 
00300 //
00301 //
00302 // Framework functions. New in this class
00303 //
00304 //
00313         IMPORT_C virtual TBool OkToExitL(TBool aAccept);
00314         
00320         IMPORT_C virtual void DynamicInitL();
00321 
00326         IMPORT_C virtual void UpdateSettingL();
00327 
00332         IMPORT_C virtual void AcceptSettingL();
00333 
00338         IMPORT_C virtual void RestoreOriginalSettingL();
00339 
00343         IMPORT_C virtual void DisplayMenuL() ;
00344 
00348         IMPORT_C virtual void HideMenu() ;
00349 
00354         IMPORT_C virtual void SetFocusToEditor();
00355 
00361         IMPORT_C virtual void SelectCurrentItemL();
00362 
00368         IMPORT_C void BaseConstructL();
00369 
00376         IMPORT_C void DismissL( TBool aAccept );  
00377 
00383         IMPORT_C TBool MenuShowing() const ;
00384 
00389         IMPORT_C void ConstructFromResourceL( TInt aResourceId);
00390 
00395         IMPORT_C void ConstructFromResourceL(TResourceReader& aRes);
00396 
00406         IMPORT_C void AttemptExitL(TBool aAccept);
00413         IMPORT_C TBool Waiting(); 
00414 
00422         IMPORT_C CEikButtonGroupContainer* Cba() const ;
00423 
00430         IMPORT_C TInt DefaultCbaResourceId() const; 
00431 
00440         IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
00441 
00446         IMPORT_C void StandardSettingPageLayout();
00447 
00454         IMPORT_C TBool IsBaseConstructed();
00455 
00460         IMPORT_C TInt SettingPageResourceId();
00465         IMPORT_C void BaseDraw(const TRect& aRect) const;
00466 
00470         IMPORT_C void ResetFlags();
00471 
00478         IMPORT_C virtual TBool PostDisplayCheckL();
00479 
00486         IMPORT_C virtual void UpdateCbaL();
00487 
00493         IMPORT_C TBool DataValidity() const;
00494 
00500         IMPORT_C void SetDataValidity(TBool aValid);
00501 
00507         IMPORT_C virtual void CheckAndSetDataValidity();
00508 
00522         void SetEditedItemLayoutRect( const TRect& aFrameRect, const TRect& aRealEditorRect);
00523 
00541         void CreateEditedItemControlContextL( TEditedItemSkinClass aSkinClass, TBool aParentAbsolute);
00542 
00550         TBool IsSkinsHandlingEditorFrameDrawing() const;
00551 
00558     CAknsFrameBackgroundControlContext* EditedItemControlContext() const;
00559 
00560 
00561 protected:
00566         IMPORT_C virtual void SetEmphasis(CCoeControl* /*aMenuControl*/,TBool aEmphasis);
00567 
00576         IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); 
00577 
00578 public: // From CCoeControl
00586     IMPORT_C void HandleResourceChange(TInt aType);
00592         IMPORT_C TInt CountComponentControls() const;
00593 
00600         IMPORT_C CCoeControl* ComponentControl(TInt anIndex) const;
00601 
00605     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00606 
00607 private:
00608         IMPORT_C virtual void Reserved_MtsmPosition();
00609         IMPORT_C virtual void Reserved_MtsmObject();
00610 
00611 protected:
00617         IMPORT_C TInt InvalidDataCbaResourceId() const; 
00618 
00619 protected: // from MObjectProvider
00620         IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00621 
00622 protected:
00626         TInt iUpdateMode;
00627 
00628         // The following are not owned:
00629 
00633         MAknSettingPageObserver* iSettingPageObserver;
00634 
00635 private:
00636         //From CCoeControl
00637         IMPORT_C void Draw(const TRect& aRect) const;
00638 
00639 
00640         
00641 private:
00645     IMPORT_C void* ExtensionInterface( TUid aInterface );
00646 
00647 protected:
00648 
00656         IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
00657 
00658 private:
00662         IMPORT_C virtual void Reserved_2();
00663 
00667         void StartActiveScheduler();
00671         void StopActiveScheduler();
00672 
00678         void PopNaviDecoratorIfRequired();
00679 
00680 private:
00681 
00685 private: 
00686         IMPORT_C virtual void CAknSettingPage_Reserved_1();
00687         IMPORT_C virtual void CAknSettingPage_Reserved_2();
00688 
00689 protected:
00694     void SetDrawBackground(const TBool aDrawBackground);    
00695 
00699     TBool IsBackgroundDrawingEnabled() const;
00700 
00701 private:
00710         const TDesC* iSettingTextFromConstructor;
00711         TInt iResourceId;
00712 
00713         TInt iSettingNumber;
00714         TInt iSettingId;
00715         TInt iMenuBarId;
00716         TInt iControlType;
00717         TInt iEditorResourceId;
00718         TInt iExtensionId;
00719         TInt iCbaResourceId;
00720 
00721         TAknLayoutRect iShadow;
00722         TAknLayoutRect iHighlight;
00723 
00724 // pointer to the return value from the setting page.  
00725 // Needed when presented in waiting mode.  
00726         TBool* iReturn; 
00727         
00728 // Internal flags
00729         TBitFlags iFlags ;
00730 
00731         enum TFlagIndices
00732                 {
00733                 EMenuShowingIndex = 0,
00734                 ENumberedStyleIndex,
00735                 EIsBaseConstructedIndex,
00736                 EHasValidDataIndex
00737                 };
00738 
00739 // Heap objects pointed to here are owned:
00740         CCoeControl* iEditorControl;
00741         CEikLabel* iNumberLabel;
00742         CEikLabel* iTextLabel;
00743         CEikButtonGroupContainer* iCba;
00744         CEikMenuBar* iMenuBar ;
00745         HBufC* iHintText;
00746         HBufC* iSettingText; 
00747         CAknNavigationDecorator* iNaviDecorator;
00748 
00749         // The following are not owned:
00750         // For hint text support
00751         CAknNavigationControlContainer* iNaviPane;
00752 
00753         // Softkey resource when the data is invalid
00754         TInt iInvalidDataCbaResourceId;
00755         
00756         // The following object is used to contain all skinning information required
00757         CAknSettingPageSkinsInfo* iSkinsInfo;
00758 
00759         CActiveSchedulerWait iWait;             // owned, safe to use as direct member data.
00760 
00761     // is setting page editable
00762     TInt iIsProtected;
00763     
00764     // extension to setting page
00765     CAknSettingPageExtension* iExtension;
00766 };
00767 
00768 #endif

Copyright © Nokia Corporation 2001-2008
Back to top