Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Base class for setting page (setting item editing) UI
20 #ifndef __AKNSETTINGPAGE_H__
21 #define __AKNSETTINGPAGE_H__
23 #include <AknControl.h>
36 // for navipane support (hint text)
40 // Forward declarations
43 class CAknSettingPageSkinsInfo;
44 class MAknsControlContext;
45 class CAknsFrameBackgroundControlContext;
46 class CAknSettingPageExtension;
49 // Used as the return value of SettingId() if not yet set.
50 // This because the Id might want to be the index of a 0-based array
52 const TInt KAknSettingPageNoIdSet = -1;
54 class CAknSettingPage;
56 // This class is used as a means of notifying change in settings.
58 class MAknSettingPageObserver
61 enum TAknSettingPageEvent
64 EEventSettingCancelled,
70 * Handles an event of type aEventType reported by the Setting Page to this observer.
72 virtual void HandleSettingPageEventL(CAknSettingPage* aSettingPage,TAknSettingPageEvent aEventType )=0;
76 class CAknSettingPage : public CAknControl, public MCoeControlObserver, public MEikMenuObserver
81 * This enumeration is passed in the ExecuteLD() method to control how often the setting page
82 * updates the externally held client object
84 enum TAknSettingPageUpdateMode
91 * This enumeration is used to select the type and IIDs for the various classes defined in the
92 * Skins LAF spec for "Opened Setting Items"
94 enum TEditedItemSkinClass
96 ESettingPageSkinEditedItemClassValueItemList,
97 ESettingPageSkinEditedItemClassVolume,
98 ESettingPageSkinEditedItemClassSlider,
99 ESettingPageSkinEditedItemClassTextEntry,
100 ESettingPageSkinEditedItemClassCodeDateTimeEntry
103 * Simple contructor for using a single setting page resource which itself gives all
106 IMPORT_C CAknSettingPage( TInt aSettingPageResourceId );
108 * Constructor that allows separate setting page and editor resources
110 * In all cases the number (if supplied i.e. <> 0 ) is used.
112 * Editor Resource Setting Page Resource
113 * present present Both are used (but text & number overridden)
114 * = 0 present Editor resource is used via SP resource
115 * present = 0 Default Avkon SP resource if used
116 * = 0 = 0 Not permitted
118 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
119 * cannot initialize such a member without allocation or having an internal dummy buffer.
121 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
122 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
123 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
124 * specific API for setting them, WILL override resource.
125 * It is assumed that number from resource is very rare. Special text is somewhat more likely.
127 * @param aSettingTitleText Text at top of setting pane (not copied; must be owned externally until ExecuteLD is called)
128 * @param aSettingNumber Number at top left (if present)
129 * @param aControlType Determines the type constructed and how its resource is read
130 * @param aEditorResourceId Editor resource to use in the setting page (if present)
131 * @param aSettingPageResourceId Setting Page to use (if present)
133 IMPORT_C CAknSettingPage( const TDesC* aSettingTitleText,
136 TInt aEditorResourceId,
137 TInt aSettingPageResourceId = 0 );
141 IMPORT_C virtual ~CAknSettingPage();
144 * Executes a waiting dialog-like setting page
146 * The passed mode determines if the editor's value is updated continuously, or just
147 * when it is accepted.
149 * @param aMode The update mode of the class
151 IMPORT_C TBool ExecuteLD( enum CAknSettingPage::TAknSettingPageUpdateMode aMode=EUpdateWhenAccepted );
154 * public method for construction. Only thing required to do in this class is to call the
155 * BaseConstructL(). Derived classes may be required to do more
158 IMPORT_C virtual void ConstructL();
161 * Returns reference to the hosted "editor" control as a CCoeControl.
162 * This routine is used in derived classes, which may then cast to the specific run-time type
163 * Note also that derived classes may provide type-specific access that performs these casts already
165 * @return CCoeControl* pointer to the hosted editor control
167 IMPORT_C CCoeControl* EditorControl() const;
170 * Returns the setting Id.
172 * @return TInt the setting Id
174 IMPORT_C TInt SettingId() const;
177 * Sets the setting Id. The Id may be used to unabiguously number a setting in some context.
178 * It would be useful to call SettingId() on aSettingPageControl in handling an observer
179 * callback. The Id is not used internally.
181 * @param aSettingId An id to provide to the observer in the callback
183 IMPORT_C void SetSettingId( TInt aSettingId );
185 * Substitutes the new setting number.
187 * @param aSettingNumber The new setting number to display
189 IMPORT_C void SetSettingNumberL( const TInt aSettingNumber );
192 * Substitutes the new setting text. Memory is allocated for a copy.
193 * If already constructed, the label is reformatted.
195 * Note that calling this will over-ride text in Setting Page resource
197 * @param aSettingText The new setting text to display
199 IMPORT_C void SetSettingTextL( const TDesC& aSettingText );
202 * Sets the observer for the setting page.
204 * @param aObserver The observer for changes to the setting
206 IMPORT_C void SetSettingPageObserver( MAknSettingPageObserver* aObserver);
209 * Access method for the number of the setting page
212 IMPORT_C TInt SettingNumber() const;
215 * Access method for whether the setting page is numbered or not
218 IMPORT_C TBool IsNumbered() const;
221 * Set method for whether the setting page is numbered or not
224 IMPORT_C void SetNumbered( TBool aNumbered );
227 * Reads the passed-in setting page resource in order to read the contained editor control
228 * resource information
229 * @param aSettingPageResoruceId This is used to specifiy what resource to read
230 * @param aControlType Returns the control type (MAY return 0 - that's a valid control type!
231 * @param aEditorResourceId Returns the setting page's LLINK editor resource, but returns 0 if not present
233 * This will leave if an invalid resource ID is passed
235 IMPORT_C static void GetEditorResourceInfoL(
236 TInt aSettingPageResourceId,
238 TInt& aEditorResourceId );
242 * Set the edit-state of the setting page. The setting page can be edited or
243 * it can be only viewed by the user.
246 * @param aEditable If false, the setting page cannot be modified by the user
248 IMPORT_C void SetEditState(const TBool aEditable);
251 * Is the setting page possible to edit by the user.
254 * @return Can user modify the setting page. True if can, false if cannot.
256 IMPORT_C TBool IsEditable() const;
259 * Used for aknsettingpage's extenstion corresponding function
262 * @param aCaption On return, this should be set to the caption of the target control.
264 void GetCaptionForFep(TDes& aCaption) const;
270 * This routine is called as part of the set-up of the control. It is the place to put
274 IMPORT_C virtual void SizeChanged();
279 * Takes any action required when the control gains or loses focus e.g. to change its appearance.
280 * The control should be redrawn depending on the value of aDrawNow. Empty by default.
282 IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
285 * From MEikCommandObserver
286 * Processes events from the softkeys. Responds to EAknSoftkeyOk and EAknSoftkeyBack
287 * to accept or cancel the pop-up.
289 * @param aCommandId Event Id from the soft-key
291 IMPORT_C virtual void ProcessCommandL(TInt aCommandId);
294 * From MCoeControlObserver:
295 * Acts upon changes in the hosted control's state.
297 * This class's implementation is trivial and should be able to be
298 * safely re-implemented in directly client-derived classes.
299 * For non-base setting page classes, a call to the base class should be made
301 * @param aControl The control changing its state (not used)
302 * @param aEventType The type of control event
304 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
308 // Framework functions. New in this class
312 * Framework method to determine if it is OK to exit the setting page.
313 * Derived classes may check for valid data before allowing the dismissal of the
316 * @param aAccept ETrue if the user has indicated to accept the setting page; EFalse otherwise
317 * @return TBool a value indicating whether the setting page should be dismissed
319 IMPORT_C virtual TBool OkToExitL(TBool aAccept);
322 * Called immediately prior to activation of the dialog. Framework routine for derived
326 IMPORT_C virtual void DynamicInitL();
329 * Called when something has changed and the client's object needs to have its value updated
332 IMPORT_C virtual void UpdateSettingL();
335 * Called when the user accepts a setting and the setting page is about to be dismissed. The latest value of the
336 * setting is written to the client's object
338 IMPORT_C virtual void AcceptSettingL();
341 * Called when the user rejects the setting. A backup copy may need to be restored if UpdateWhenChanged flag was set
344 IMPORT_C virtual void RestoreOriginalSettingL();
349 IMPORT_C virtual void DisplayMenuL() ;
354 IMPORT_C virtual void HideMenu() ;
357 * Puts the focus back on the editor. For complicated setting pages that have focus removed from them
358 * at some point, then a re-implementation may have to do some work here.
360 IMPORT_C virtual void SetFocusToEditor();
363 * This method should be implemented in listbox classes to move the selection in
364 * listbox editors prior to exiting from the setting page. It is called on a
365 * CAknSettingPage* reference, and is therefore declared here.
367 IMPORT_C virtual void SelectCurrentItemL();
370 * Protected non-virtual base method for construction. Only thing required to do in this class is
371 * call the ConstructFromResourceL routine and set the flag that says construction has occured
374 IMPORT_C void BaseConstructL();
377 * Called to remove the setting page. Should not be called except from within re-implemented
380 * @param aAccept ETrue to accept the current value; EFalse otherwise
382 IMPORT_C void DismissL( TBool aAccept );
385 * This is used as a protected access function for the state of the menu bar
387 * @return TBool ETrue if the menu is currently showing
389 IMPORT_C TBool MenuShowing() const ;
392 * This constructs the control based upon the id passed
395 IMPORT_C void ConstructFromResourceL( TInt aResourceId);
398 * This constructs the control based upon a constructed and positioned reader
401 IMPORT_C void ConstructFromResourceL(TResourceReader& aRes);
404 * Called when the user accepts or cancels the setting. Default implementation
405 * sets the return value and exists.
407 * Re-implementations must call DismissL and StopActiveScheduler() if the setting is
410 * @param aAccept ETrue if the user accepted. EFalse if the user cancelled.
412 IMPORT_C void AttemptExitL(TBool aAccept);
414 * Method to determine the current running state of the setting page's
415 * ActiveScheduler level.
417 * @return EFalse only if the CActiveSheduler level is not running
419 IMPORT_C TBool Waiting();
422 * Access method to the Command button array
424 * Must be called after full construction, or null reference will be returned.
426 * @return CEikButtonGroupContainer* a pointer to the cba owned by the setting page
428 IMPORT_C CEikButtonGroupContainer* Cba() const ;
431 * This is used to access the default resource id for the cba - the one used when
434 * @return TInt the default resource Id
436 IMPORT_C TInt DefaultCbaResourceId() const;
439 * This routine routes the keys to the editor.
440 * However, if the menu is showing, then events are sent to the menu.
442 * @param aKeyEvent event information
443 * @param aType type of event being handled
446 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
449 * This routine is the base layout for CAknSettingPage. It lays out the labels and configures
450 * the drawing in general.
452 IMPORT_C void StandardSettingPageLayout();
455 * This method can be used to test if BaseConstructL() has been called yet
458 * @return TBool ETrue if BaseContructL has been called (and not left)
460 IMPORT_C TBool IsBaseConstructed();
463 * Access method for the internally held resource Id
466 IMPORT_C TInt SettingPageResourceId();
468 * Perform the drawing of coded within CAknSettingPage
471 IMPORT_C void BaseDraw(const TRect& aRect) const;
474 * Set default construction values of internal state
476 IMPORT_C void ResetFlags();
479 * Framework method called as soon as the setting page is displayed, but before the new active sheduler level
480 * is started. Returning EFalse will dismiss the setting page right away
482 * @return TBool ETrue if the setting page is to continue
484 IMPORT_C virtual TBool PostDisplayCheckL();
487 * This framework method is used to update the contents of the CBA in a custom way.
488 * Some setting page classes implement a degree of validation and will implement this.
489 * Derived classes should ensure that this is being called frequently enough for their
492 IMPORT_C virtual void UpdateCbaL();
495 * Called to access the validity state of the data
497 * @return TBool ETRrue if the data is valid
499 IMPORT_C TBool DataValidity() const;
502 * used to set the validity of the data
504 * @param TBool aValid Sets the validity true or false
506 IMPORT_C void SetDataValidity(TBool aValid);
509 * Framework method to set the validity of the data
510 * This is called when the data changes.
513 IMPORT_C virtual void CheckAndSetDataValidity();
516 * Method to be called by CAknSettingPage descendents when they have laid themselves out.
517 * This tells the base class how big the layout spec rectangle hosting the editor is.
518 * The second rectangle is the size of the area that the base class does not have to
519 * draw to for skins. Usually, this is the area actually inhabited by the editor control.
521 * Coordinates are to be given in pixels relative to the main_pane.
523 * @param aFrameRect Layout rectangle in which to host the editor.
524 * @param aRealEditorRect Layout rectangle actually occupied by the editor control
528 void SetEditedItemLayoutRect( const TRect& aFrameRect, const TRect& aRealEditorRect);
531 * Method to cause this class to construct a control context or type and IID, selected according to
532 * the value of enumeration TEditedItemSkinClass, set its coordinate system
534 * This must be called after a call to SetEditedItemLayoutRect has been made on CAknSettingPage.
535 * This is becasue this routine must set the control context's origin to the top left of the value
536 * given to SetEditedItemLayoutRect. Since SetEditeItemLayoutRect is to be called in a SizeChanged
537 * method, this means that the this should be called after the SizeChanged in the child class.
539 * @param aClass enumeration specifying which class of editor (according to LAF spec) is being
541 * @param aParentAbsolute ETrue if there is an intervening Window between CAknSettingPage's window
542 * and any control that is to draw skin items with this component.
547 void CreateEditedItemControlContextL( TEditedItemSkinClass aSkinClass, TBool aParentAbsolute);
550 * Indicates whether skin system will be able to draw the editor frame and background
552 * @return TBool ETrue iff the drawing of the edited item frame is going to be handled by
553 * the base CAknSettingPage class itself using Skins
556 TBool IsSkinsHandlingEditorFrameDrawing() const;
559 * Control context for providing to the skinning for the hosted editor and its framing
561 * @return A valid control context for frame drawing for a hosted editor or NULL
564 CAknsFrameBackgroundControlContext* EditedItemControlContext() const;
569 * From MEikMenuObserver
570 * Called when menu is cancelled.
572 IMPORT_C virtual void SetEmphasis(CCoeControl* /*aMenuControl*/,TBool aEmphasis);
575 * From MEikMenuObserver
576 * This function intializes the items on the menu. It is used to disable and enable menu items and may be
577 * over ridden to add new ones.
578 * In addition it adds menu items which have been provided in the ConstructL in the form of a Menu Bar resource.
579 * Instead of using the Menu Bar directly it extracts the menu panes and adds them to its own menu pane.
580 * It must be called in the DynInitMenuPaneL() function of any derived class before anything else.
582 IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
584 public: // From CCoeControl
586 * Handles a change to the control's resources of type aType
587 * which are shared across the environment, e.g. colors or fonts.
590 * @param aType Reason for the "resource" change, usually an system event UID
592 IMPORT_C void HandleResourceChange(TInt aType);
594 * Standard CCoeControl routine to return the number of componentn controls
596 * @param aIndex index at which to return control
598 IMPORT_C TInt CountComponentControls() const;
601 * Standard CCoeControl routine to return the control at a given index
603 * @param aIndex index at which to return control
606 IMPORT_C CCoeControl* ComponentControl(TInt anIndex) const;
609 * Handles pointer events
611 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
614 * Gets the control's input capabilities.
616 * @return The control's input capabilities.
618 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
621 IMPORT_C virtual void Reserved_MtsmPosition();
622 IMPORT_C virtual void Reserved_MtsmObject();
626 * Access method for the softkey resource used when there is invalid data
628 * @return TInt The resource Id of the softkey bindings.
630 IMPORT_C TInt InvalidDataCbaResourceId() const;
632 protected: // from MObjectProvider
633 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
637 * Hold the update mode passed in the constructor
641 // The following are not owned:
644 * Pointer to setting page observer; may be NULL
646 MAknSettingPageObserver* iSettingPageObserver;
650 IMPORT_C void Draw(const TRect& aRect) const;
656 IMPORT_C void* ExtensionInterface( TUid aInterface );
661 * Writes the internal state of the control and its components to aStream.
662 * Does nothing in release mode.
663 * Designed to be overidden and base called by subclasses.
665 * @param aWriteSteam A connected write stream
667 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
671 * Reserved method derived from CCoeControl
673 IMPORT_C virtual void Reserved_2();
676 * Activate another level on the active scheduler
678 void StartActiveScheduler();
680 * Stop current (additional) level on the active scheduler
682 void StopActiveScheduler();
685 * Pop the navidecorator. The iNaviPane is used as a flag to show if popping is required to
686 * be done or not. It is zeroed by this method.
689 void PopNaviDecoratorIfRequired();
694 * New reserved methods for CAknSettingPage hierarchy
697 IMPORT_C virtual void CAknSettingPage_Reserved_1();
698 IMPORT_C virtual void CAknSettingPage_Reserved_2();
702 * Enables / disables transparency effect, i.e. does the setting page draw its own background or not.
703 * @param aDrawBackground EFalse enables transparency
705 void SetDrawBackground(const TBool aDrawBackground);
708 * Is the setting page drawing the background itself or not (= "transparency")
710 TBool IsBackgroundDrawingEnabled() const;
712 * Set the flag to indicate that if the function CAknSettingPage::StopActiveScheduler called or not
713 *@param aStopCalled ETrue means the StopActiveScheduler is called.
715 void SetStopActiveSchedulerFlag(const TBool aStopCalled );
718 * Is the setting page call the StopActiveScheduler or not
720 TBool IsStopActiveSchudlerCalled()const;
723 * Pointer to setting text label
724 * @return pointer to the label
728 IMPORT_C CEikLabel* TextLabel() const;
731 * Pointer to shadow text label
732 * @return pointer to the label
736 IMPORT_C CEikLabel* ShadowText() const;
740 * This member points to the setting title text that is passed as part of its more complicated constructor.
741 * The descriptor pointed to is not owned, and therefor must be preserved in the client, at least until the
742 * 2nd stage construction is performed (inside ExecuteLD).
744 * Since, however, setting pages are all waiting, the descriptor can usually be on the stack in the client.
747 const TDesC* iSettingTextFromConstructor;
754 TInt iEditorResourceId;
758 TAknLayoutRect iShadow;
759 TAknLayoutRect iHighlight;
761 // pointer to the return value from the setting page.
762 // Needed when presented in waiting mode.
770 EMenuShowingIndex = 0,
772 EIsBaseConstructedIndex,
776 // Heap objects pointed to here are owned:
777 CCoeControl* iEditorControl;
778 CEikLabel* iNumberLabel;
779 CEikLabel* iTextLabel;
780 CEikButtonGroupContainer* iCba;
781 CEikMenuBar* iMenuBar ;
784 CAknNavigationDecorator* iNaviDecorator;
786 // The following are not owned:
787 // For hint text support
788 CAknNavigationControlContainer* iNaviPane;
790 // Softkey resource when the data is invalid
791 TInt iInvalidDataCbaResourceId;
793 // The following object is used to contain all skinning information required
794 CAknSettingPageSkinsInfo* iSkinsInfo;
796 CActiveSchedulerWait iWait; // owned, safe to use as direct member data.
798 // is setting page editable
801 // extension to setting page
802 CAknSettingPageExtension* iExtension;