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 00243 #start_since SINCE_3_1_SDK 00244 00252 IMPORT_C void SetEditState(const TBool aEditable); 00253 #end_since SINCE_3_1_SDK 00254 #start_since SINCE_3_1_SDK 00255 00262 IMPORT_C TBool IsEditable() const; 00263 #end_since SINCE_3_1_SDK 00264 protected: 00265 00272 IMPORT_C virtual void SizeChanged(); 00273 00274 00280 IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow); 00281 00289 IMPORT_C virtual void ProcessCommandL(TInt aCommandId); 00290 00302 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00303 00304 // 00305 // 00306 // Framework functions. New in this class 00307 // 00308 // 00317 IMPORT_C virtual TBool OkToExitL(TBool aAccept); 00318 00324 IMPORT_C virtual void DynamicInitL(); 00325 00330 IMPORT_C virtual void UpdateSettingL(); 00331 00336 IMPORT_C virtual void AcceptSettingL(); 00337 00342 IMPORT_C virtual void RestoreOriginalSettingL(); 00343 00347 IMPORT_C virtual void DisplayMenuL() ; 00348 00352 IMPORT_C virtual void HideMenu() ; 00353 00358 IMPORT_C virtual void SetFocusToEditor(); 00359 00365 IMPORT_C virtual void SelectCurrentItemL(); 00366 00372 IMPORT_C void BaseConstructL(); 00373 00380 IMPORT_C void DismissL( TBool aAccept ); 00381 00387 IMPORT_C TBool MenuShowing() const ; 00388 00393 IMPORT_C void ConstructFromResourceL( TInt aResourceId); 00394 00399 IMPORT_C void ConstructFromResourceL(TResourceReader& aRes); 00400 00410 IMPORT_C void AttemptExitL(TBool aAccept); 00417 IMPORT_C TBool Waiting(); 00418 00426 IMPORT_C CEikButtonGroupContainer* Cba() const ; 00427 00434 IMPORT_C TInt DefaultCbaResourceId() const; 00435 00444 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType); 00445 00450 IMPORT_C void StandardSettingPageLayout(); 00451 00458 IMPORT_C TBool IsBaseConstructed(); 00459 00464 IMPORT_C TInt SettingPageResourceId(); 00469 IMPORT_C void BaseDraw(const TRect& aRect) const; 00470 00474 IMPORT_C void ResetFlags(); 00475 00482 IMPORT_C virtual TBool PostDisplayCheckL(); 00483 00490 IMPORT_C virtual void UpdateCbaL(); 00491 00497 IMPORT_C TBool DataValidity() const; 00498 00504 IMPORT_C void SetDataValidity(TBool aValid); 00505 00511 IMPORT_C virtual void CheckAndSetDataValidity(); 00512 00526 void SetEditedItemLayoutRect( const TRect& aFrameRect, const TRect& aRealEditorRect); 00527 00545 void CreateEditedItemControlContextL( TEditedItemSkinClass aSkinClass, TBool aParentAbsolute); 00546 00554 TBool IsSkinsHandlingEditorFrameDrawing() const; 00555 00562 CAknsFrameBackgroundControlContext* EditedItemControlContext() const; 00563 00564 00565 protected: 00570 IMPORT_C virtual void SetEmphasis(CCoeControl* /*aMenuControl*/,TBool aEmphasis); 00571 00580 IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); 00581 00582 public: // From CCoeControl 00590 IMPORT_C void HandleResourceChange(TInt aType); 00596 IMPORT_C TInt CountComponentControls() const; 00597 00604 IMPORT_C CCoeControl* ComponentControl(TInt anIndex) const; 00605 00609 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00610 00611 private: 00612 IMPORT_C virtual void Reserved_MtsmPosition(); 00613 IMPORT_C virtual void Reserved_MtsmObject(); 00614 00615 protected: 00621 IMPORT_C TInt InvalidDataCbaResourceId() const; 00622 00623 protected: // from MObjectProvider 00624 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId); 00625 00626 protected: 00630 TInt iUpdateMode; 00631 00632 // The following are not owned: 00633 00637 MAknSettingPageObserver* iSettingPageObserver; 00638 00639 private: 00640 //From CCoeControl 00641 IMPORT_C void Draw(const TRect& aRect) const; 00642 00643 00644 00645 private: 00649 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00650 00651 protected: 00652 00660 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const; 00661 00662 private: 00666 IMPORT_C virtual void Reserved_2(); 00667 00671 void StartActiveScheduler(); 00675 void StopActiveScheduler(); 00676 00682 void PopNaviDecoratorIfRequired(); 00683 00684 private: 00685 00689 private: 00690 IMPORT_C virtual void CAknSettingPage_Reserved_1(); 00691 IMPORT_C virtual void CAknSettingPage_Reserved_2(); 00692 00693 protected: 00698 void SetDrawBackground(const TBool aDrawBackground); 00699 00703 TBool IsBackgroundDrawingEnabled() const; 00704 00705 private: 00714 const TDesC* iSettingTextFromConstructor; 00715 TInt iResourceId; 00716 00717 TInt iSettingNumber; 00718 TInt iSettingId; 00719 TInt iMenuBarId; 00720 TInt iControlType; 00721 TInt iEditorResourceId; 00722 TInt iExtensionId; 00723 TInt iCbaResourceId; 00724 00725 TAknLayoutRect iShadow; 00726 TAknLayoutRect iHighlight; 00727 00728 // pointer to the return value from the setting page. 00729 // Needed when presented in waiting mode. 00730 TBool* iReturn; 00731 00732 // Internal flags 00733 TBitFlags iFlags ; 00734 00735 enum TFlagIndices 00736 { 00737 EMenuShowingIndex = 0, 00738 ENumberedStyleIndex, 00739 EIsBaseConstructedIndex, 00740 EHasValidDataIndex 00741 }; 00742 00743 // Heap objects pointed to here are owned: 00744 CCoeControl* iEditorControl; 00745 CEikLabel* iNumberLabel; 00746 CEikLabel* iTextLabel; 00747 CEikButtonGroupContainer* iCba; 00748 CEikMenuBar* iMenuBar ; 00749 HBufC* iHintText; 00750 HBufC* iSettingText; 00751 CAknNavigationDecorator* iNaviDecorator; 00752 00753 // The following are not owned: 00754 // For hint text support 00755 CAknNavigationControlContainer* iNaviPane; 00756 00757 // Softkey resource when the data is invalid 00758 TInt iInvalidDataCbaResourceId; 00759 00760 // The following object is used to contain all skinning information required 00761 CAknSettingPageSkinsInfo* iSkinsInfo; 00762 00763 CActiveSchedulerWait iWait; // owned, safe to use as direct member data. 00764 00765 // is setting page editable 00766 TInt iIsProtected; 00767 00768 // extension to setting page 00769 CAknSettingPageExtension* iExtension; 00770 }; 00771 00772 #endif