williamr@4: /* williamr@4: * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: A default control in the status pane's navigation pane. williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef C_AKNNAVI_H williamr@4: #define C_AKNNAVI_H williamr@4: williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: class CAknNavigationDecorator; williamr@4: class CEikStatusPaneBase; williamr@4: class CFbsBitmap; williamr@4: class MAknTabObserver; williamr@4: class CAknNavigationControlContainerExtension; williamr@4: class MAknsControlContext; williamr@4: williamr@4: class MAknNavigationDecoratorInterface williamr@4: { williamr@4: public: williamr@4: virtual ~MAknNavigationDecoratorInterface() { } williamr@4: virtual CCoeControl* DecoratedControl() = 0; williamr@4: }; williamr@4: williamr@4: class MAknNavigationContainerInterface williamr@4: { williamr@4: public: williamr@4: virtual ~MAknNavigationContainerInterface() { } williamr@4: virtual CAknNavigationDecorator* CreateMessageLabelL(const TDesC& aText) = 0; williamr@4: virtual CAknNavigationDecorator* CreateTabGroupL() = 0; williamr@4: virtual void PushL( CAknNavigationDecorator& ) = 0; williamr@4: virtual void Pop() = 0; williamr@4: }; williamr@4: williamr@4: /** williamr@4: * A default control in the status pane's navigation pane. williamr@4: */ williamr@4: class CAknNavigationControlContainer : public CAknControl, williamr@4: public MCoeControlContext, williamr@4: public MCoeControlObserver, williamr@4: public MAknNavigationContainerInterface williamr@4: { williamr@4: williamr@4: public: williamr@4: williamr@4: DECLARE_TYPE_ID( 0x101F8740 ) williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * C++ default constructor. williamr@4: * williamr@4: * This object does not own the contents of the navi pane controls stack. williamr@4: */ williamr@4: IMPORT_C CAknNavigationControlContainer(); williamr@4: williamr@4: /** williamr@4: * Destructor. williamr@4: * williamr@4: * This object does not own the contents of the navi pane controls stack. williamr@4: */ williamr@4: IMPORT_C ~CAknNavigationControlContainer(); williamr@4: williamr@4: /** williamr@4: * Handles 2nd phase construction. williamr@4: */ williamr@4: IMPORT_C void ConstructL(); williamr@4: williamr@4: /** williamr@4: * Constructs from a resource. Created object is owned by this object until williamr@4: * @c ResourceDecorator() method is called. If the application does not williamr@4: * fetch the object it is deleted in destructor. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: */ williamr@4: IMPORT_C void ConstructFromResourceL( TResourceReader& aReader ); williamr@4: williamr@4: /** williamr@4: * Resource constructor that returns a new object to the application. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * @return Navigation decorator object that contains navigation pane williamr@4: * control read from resources. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* williamr@4: ConstructNavigationDecoratorFromResourceL( williamr@4: TResourceReader& aReader); williamr@4: williamr@4: /** williamr@4: * Creates and returns a new navigation decorator object containing tab williamr@4: * group. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @return Navigation decorator object that contains tab group. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateTabGroupL(); williamr@4: williamr@4: /** williamr@4: * Creates and returns a new navigation decorator object containing tab williamr@4: * group. The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aObserver Pointer to tab group observer williamr@4: * @return Navigation decorator object that contains tab group. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateTabGroupL( williamr@4: MAknTabObserver* aObserver); williamr@4: williamr@4: /** williamr@4: * Creates from a resource and returns a new navigation decorator object williamr@4: * containing tab group. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * @return Navigation decorator object that contains tab group. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateTabGroupL( williamr@4: TResourceReader& aReader); williamr@4: williamr@4: /** williamr@4: * Creates from a resource and returns a new navigation decorator object williamr@4: * containing tab group. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * @param aObserver Pointer to tab group observer. williamr@4: * @return Navigation decorator object that contains tab group. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateTabGroupL( williamr@4: TResourceReader& aReader, williamr@4: MAknTabObserver* aObserver); williamr@4: williamr@4: /** williamr@4: * Creates and returns a new navigation decorator object containing williamr@4: * navigation label. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aText Label text to the navigation pane. williamr@4: * @return Navigation decorator object that contains navigation label. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateNavigationLabelL( williamr@4: const TDesC& aText = KNullDesC); williamr@4: williamr@4: /** williamr@4: * Creates from a resource and returns a new navigation decorator object williamr@4: * containing navigation label. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * @return Navigation decorator object that contains navigation label. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateNavigationLabelL( williamr@4: TResourceReader& aReader); williamr@4: williamr@4: /** williamr@4: * Creates and returns a new navigation decorator object containing williamr@4: * navigation image. williamr@4: * The ownership of the returned object is transferred to the application. williamr@4: * Moves ownership of @c aBitmap and @c aMaskBitmap to the navigation williamr@4: * decorator object at the end of the method. williamr@4: * williamr@4: * @param aBitmap Image to be shown in the navigation pane. williamr@4: * @param aMaskBitmap Mask of the image to be shown in the williamr@4: * navigation panel. williamr@4: * @return Navigation decorator object that contains navigation image. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateNavigationImageL( williamr@4: const CFbsBitmap* aBitmap = NULL, williamr@4: const CFbsBitmap* aMaskBitmap = NULL); williamr@4: williamr@4: /** williamr@4: * Creates from a resource and returns a new navigation decorator object williamr@4: * containing navigation image. williamr@4: * The ownership of the returned object is transferred to the application. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * @return Navigation decorator object that williamr@4: * contains navigation image. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateNavigationImageL( williamr@4: TResourceReader& aReader); williamr@4: williamr@4: /** williamr@4: * Creates and returns a new navigation decorator object containing williamr@4: * help text. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aText Help text label to be shown in the navigation pane. williamr@4: * @return Navigation decorator object that williamr@4: * contains message label (=hint text). williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateMessageLabelL( williamr@4: const TDesC& aText = KNullDesC); williamr@4: williamr@4: /** williamr@4: * Creates from a resource and returns a new navigation decorator object williamr@4: * containing help text. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * @return Navigation decorator object that contains message label williamr@4: * (=hint text). williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateMessageLabelL( williamr@4: TResourceReader& aReader); williamr@4: williamr@4: /** williamr@4: * Creates volume control indicator to the navi pane. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @param aResourceId Resource file id for the volume control williamr@4: * @return Navigation decorator object that contains volume indicator. williamr@4: * williamr@4: * @deprecated Navi pane volume control is not supported anymore. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateVolumeIndicatorL(TInt aResourceId); williamr@4: williamr@4: /** williamr@4: * Creates editor indicator container control to the navi pane. williamr@4: * The ownership of the object is transferred to the application. williamr@4: * williamr@4: * @return Navigation decorator object that contains editor indicator williamr@4: * container. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* CreateEditorIndicatorContainerL(); williamr@4: williamr@4: /** williamr@4: * Pushes default content (empty navigation pane) to the navigation pane's williamr@4: * object stack. williamr@4: * This operation also draws default content to the navigation pane. williamr@4: * williamr@4: * @param aAllowDuplicates If this is @c ETrue, duplicate default williamr@4: * navi pane contents are allowed. williamr@4: */ williamr@4: IMPORT_C void PushDefaultL( TBool aAllowDuplicates = EFalse ); williamr@4: williamr@4: /** williamr@4: * Pushes a navigation decorator object to the navigation pane's object williamr@4: * stack. williamr@4: * This operation also draws the control to the navigation pane. An object williamr@4: * can be on the stack only once. If the object already exists in the stack williamr@4: * it is moved to topmost object. Ownership is not transfered. williamr@4: * Editor indicator control has priority over others. It is always at the williamr@4: * top if it exists. In this case all other controls are pushed under williamr@4: * the editor indicator object. williamr@4: * williamr@4: * @param aNaviPaneControl Object to be added at the top of the stack. williamr@4: */ williamr@4: IMPORT_C void PushL( CAknNavigationDecorator& aNaviPaneControl ); williamr@4: williamr@4: /** williamr@4: * Pops topmost object from the navigation pane's object stack. If editor williamr@4: * indicator control is topmost, it is not popped. The next control williamr@4: * is popped instead. williamr@4: * It is not possible to pop editor indicator object with this method. williamr@4: * Use @c Pop(CAknNavigationDecorator* aControl) or @c delete(aControl) williamr@4: * instead if editor indicator control is needed to be popped. williamr@4: */ williamr@4: IMPORT_C void Pop(); williamr@4: williamr@4: /** williamr@4: * Pops (remove) certain object from the navigation pane's object stack. williamr@4: * The removed object does not need to be topmost. williamr@4: * williamr@4: * @param aControl Object to be removed from the stack. williamr@4: */ williamr@4: IMPORT_C void Pop( CAknNavigationDecorator* aControl ); williamr@4: williamr@4: /** williamr@4: * Returns topmost object from navigation pane's object stack. williamr@4: * Editor indicator object is transparent for this operation. If editor williamr@4: * indicators exist on the navi pane, next object on the stack is returned. williamr@4: * williamr@4: * @return Navigation decorator object that is topmost in navigation pane's williamr@4: * object stack. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* Top(); williamr@4: williamr@4: /** williamr@4: * Return topmost object from navigation pane's object stack. williamr@4: * FEP Editor indicator object is transparent or visible for this operation williamr@4: * depending on the given parameter value. If editor indicator object is to williamr@4: * be ignored and it exist on the navi pane, next object on the stack is williamr@4: * returned. Note that generally FEP does all the needed visibility etc. williamr@4: * handling for FEP editor indicators, so by default applications should williamr@4: * ignore FEP editor indicators. williamr@4: * williamr@4: * @since 3.1 williamr@4: * @param aIgnoreFepEditorIndicator Tells if editor indicator williamr@4: * object is ignored. williamr@4: * williamr@4: * @return Navigation decorator object that is topmost in williamr@4: * navigation pane's object stack. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* Top(TBool aIgnoreFepEditorIndicator) const; williamr@4: williamr@4: williamr@4: /** williamr@4: * Replaces existing navigation decorator object in the navigation pane's williamr@4: * object stack. Any object can be on the stack only once. If the williamr@4: * replacement object already exists in the stack, previous copy is williamr@4: * removed from the stack. Ownership is not transfered. williamr@4: * Navi pane is redrawn if top item is changed. williamr@4: * williamr@4: * @param aToBeReplaced An object to be replaced. williamr@4: * @param aReplacement An object that is put to the stack instead. williamr@4: * @return Error number. @c KErrNone if the operation succeeds. williamr@4: * @c KErrNotFound if @c 'aToBeReplaced' object cannot be williamr@4: * found from the stack. williamr@4: */ williamr@4: IMPORT_C TInt ReplaceL( CAknNavigationDecorator& aToBeReplaced, williamr@4: CAknNavigationDecorator& aReplacement ); williamr@4: williamr@4: /** williamr@4: * Returns the object constructed from resources with williamr@4: * @c ConstrucFromResourcesL() -method to the application. williamr@4: * Ownership of the object is transferred to the application. williamr@4: * williamr@4: * @return Navigation Decorator object that was williamr@4: * created from resources. williamr@4: */ williamr@4: IMPORT_C CAknNavigationDecorator* ResourceDecorator(); williamr@4: williamr@4: /** williamr@4: * This non-exported method returns reference to navi arrow bitmaps. williamr@4: * williamr@4: * @param aId Id of the bitmap. williamr@4: * @return Reference to the navi arrow bitmap. williamr@4: */ williamr@4: CFbsBitmap& NaviArrowBitmap( TInt aId ); williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * This method can be used to set preferred layout style for navi decorator williamr@4: * objects that are pushed into navistack. williamr@4: * Given layout is applied to objects only if that object supports it and williamr@4: * status pane layout allows that mode to be used. williamr@4: * williamr@4: * @since 3.1 williamr@4: * williamr@4: * @param aLayoutStyle CAknNavigationDecorator::ENaviControlLayoutNormal, williamr@4: * CAknNavigationDecorator::ENaviControlLayoutNarrow or williamr@4: * CAknNavigationDecorator::ENaviControlLayoutWide williamr@4: * williamr@4: */ williamr@4: IMPORT_C void SetPreferredNaviDecoratorLayoutStyle( TInt aLayoutStyle ); williamr@4: williamr@4: /** williamr@4: * Static method to return current color scheme. williamr@4: * @return Current color scheme value. williamr@4: */ williamr@4: IMPORT_C static TInt ColorScheme(); williamr@4: williamr@4: /** williamr@4: * Used by the UI framework. Notifies context and signal williamr@4: * panes wheter navi wipe graphichs is to be drawn or not. williamr@4: */ williamr@4: void NotifyNaviWipeStatusL(); williamr@4: williamr@4: /** williamr@4: * Gets current wipe bitmap for navi pane. williamr@4: * williamr@4: * @return Wipe bitmap Id williamr@4: */ williamr@4: static TInt CurrentNaviWipeBitmap(); williamr@4: williamr@4: /** williamr@4: * From @c CCoeControl. williamr@4: * williamr@4: * Handles pointer events williamr@4: * williamr@4: * @param aPointerEvent The pointer event. williamr@4: */ williamr@4: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@4: williamr@4: /** williamr@4: * Used to notify the navi pane when it goes to background. williamr@4: * @internal Used by the UI framework. williamr@4: */ williamr@4: void HandleLosingForeground(); williamr@4: williamr@4: /** williamr@4: * Used to notify the navi pane when it gains foreground. williamr@4: * @internal Used by the UI framework. williamr@4: */ williamr@4: void HandleGainingForegroundL(); williamr@4: williamr@4: protected: // from CCoeControl williamr@4: williamr@4: /** williamr@4: * From @c CCoeControl. williamr@4: * williamr@4: * Handles the size change events. williamr@4: */ williamr@4: IMPORT_C virtual void SizeChanged(); williamr@4: williamr@4: /** williamr@4: * From @c CCoeControl. williamr@4: * williamr@4: * Handles a change to the control's resources of type @c aType williamr@4: * which are shared across the environment, e.g. color scheme change. williamr@4: * williamr@4: * @param aType Event type. williamr@4: */ williamr@4: IMPORT_C virtual void HandleResourceChange(TInt aType); williamr@4: williamr@4: /** williamr@4: * From @c CCoeControl. williamr@4: * williamr@4: * Returns number of controls inside the context pane control. williamr@4: * williamr@4: * @return Number of component controls. williamr@4: */ williamr@4: IMPORT_C virtual TInt CountComponentControls() const; williamr@4: williamr@4: /** williamr@4: * From @c CCoeControl. williamr@4: * williamr@4: * Returns a control determined by control id. williamr@4: * williamr@4: * @param aIndex Index of a control to be returned. williamr@4: * @return Pointer to control. williamr@4: */ williamr@4: IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const; williamr@4: williamr@4: protected: // from MCoeControlObserver williamr@4: williamr@4: /** williamr@4: * From @c MCoeControlObserver. williamr@4: * williamr@4: * Handles Control event. williamr@4: * williamr@4: * @param aControl Control that caused the event. williamr@4: * @param aEventType Type of the event. williamr@4: */ williamr@4: IMPORT_C void HandleControlEventL(CCoeControl* aControl, williamr@4: TCoeEvent aEventType); williamr@4: williamr@4: private: // from CCoeControl williamr@4: williamr@4: IMPORT_C virtual void Draw(const TRect& aRect) const; williamr@4: williamr@4: private: williamr@4: williamr@4: /** williamr@4: * From CAknControl williamr@4: */ williamr@4: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * Not used / implemented williamr@4: * williamr@4: * @deprecated williamr@4: * williamr@4: * @since S60 3.0 williamr@4: * williamr@4: * @return @c EFalse williamr@4: */ williamr@4: TBool NaviWipeUsed() const; williamr@4: williamr@4: /** williamr@4: * Gets navi bitmap. williamr@4: * williamr@4: * @return Bitmap's colour. williamr@4: */ williamr@4: CFbsBitmap* NaviColorBitmap() const; williamr@4: williamr@4: /** williamr@4: * Not used / implemented williamr@4: * williamr@4: * @deprecated williamr@4: * williamr@4: * @since S60 3.0 williamr@4: */ williamr@4: static void SetBackgroundContextAttributes( CCoeControl* aControl, williamr@4: TBool aNaviWipeUsed ); williamr@4: williamr@4: private: williamr@4: TBool IsFepOwnedEditorIndicatorControl( williamr@4: CAknNavigationDecorator* aDecorator ) const; williamr@4: williamr@4: void HandleVisibilityOfNonFepOwnedIndicatorControl( williamr@4: CAknNavigationDecorator* aDecorator, TBool aVisible); williamr@4: williamr@4: /** williamr@4: * Checks wheter default navi wipe bitmap can be drawn to navipane and draws williamr@4: * it if it is possible. williamr@4: * williamr@4: * @since S60 2.6 williamr@4: * @param aGc Used graphics context. williamr@4: * @param aRect Rect of the navipane. williamr@4: * @return @c ETrue if draw operation was done, otherwise @c EFalse. williamr@4: * williamr@4: */ williamr@4: TBool DrawDefaultNaviWipe(CWindowGc& aGc, const TRect& aRect) const; williamr@4: williamr@4: /** williamr@4: * Checks wheter default navi solid bitmap can be drawn to navipane and draws williamr@4: * it if it is possible. williamr@4: * williamr@4: * @since S60 2.6 williamr@4: * @param aGc Used graphics context. williamr@4: * @param aRect Rect of the navipane. williamr@4: * @return ETrue if draw operation was done, otherwise EFalse. williamr@4: * williamr@4: */ williamr@4: TBool DrawDefaultNaviSolid(CWindowGc& aGc, const TRect& aRect) const; williamr@4: williamr@4: /** williamr@4: * Checks wheter skinned navi wipe bitmap can be drawn to navipane and draws williamr@4: * it if it is possible. Also skinned background bitmap is drawn. williamr@4: * williamr@4: * @since S60 2.6 williamr@4: * @param aGc Used graphics context. williamr@4: * @param aRect Rect of the navipane. williamr@4: * @param aSkin Used skin instance. williamr@4: * @param aCc Used skin control context. williamr@4: * @return ETrue if draw operation was done, otherwise EFalse. williamr@4: */ williamr@4: TBool DrawSkinnedNaviWipe( CWindowGc& aGc, williamr@4: const TRect& aRect, williamr@4: MAknsSkinInstance* aSkin, williamr@4: MAknsControlContext* aCc ) const; williamr@4: williamr@4: /** williamr@4: * Checks wheter skinned navi solid bitmap can be drawn to navipane and draws williamr@4: * it if it is possible. Also skinned background bitmap is drawn. williamr@4: * williamr@4: * @since S60 2.6 williamr@4: * @param aGc Used graphics context. williamr@4: * @param aRect Rect of the navipane. williamr@4: * @param aSkin Used skin instance. williamr@4: * @param aCc Used skin control context. williamr@4: * @return ETrue if draw operation was done, otherwise EFalse. williamr@4: */ williamr@4: TBool DrawSkinnedNaviSolid( CWindowGc& aGc, williamr@4: const TRect& aRect, williamr@4: MAknsSkinInstance* aSkin, williamr@4: MAknsControlContext* aCc ) const; williamr@4: williamr@4: /** williamr@4: * Loads a color bitmap for CAknNavigationDecorator. williamr@4: * @since S60 2.8 williamr@4: */ williamr@4: void LoadNaviColorBitmapL(); williamr@4: williamr@4: void SetContainerWindowNonFading( TBool aNonFading ); williamr@4: williamr@4: TRect VolumePopupRect(); williamr@4: williamr@4: protected: // from CCoeControl williamr@4: williamr@4: /** williamr@4: * From @c CCoeControl. williamr@4: * williamr@4: * Retrieves an object of the same type as that encapsulated in aId. williamr@4: * williamr@4: * This function is used to allow controls to ask their owners for williamr@4: * access to other objects that they own. williamr@4: * williamr@4: * Other than in the case where NULL is returned, the object returned williamr@4: * must be of the same object type - that is, the @c ETypeId member of williamr@4: * the object pointed to by the pointer returned by this function must williamr@4: * be equal to the @c iUid member of @c aId. williamr@4: * williamr@4: * @param aId An encapsulated object type ID. williamr@4: * @return Encapsulated pointer to the provided object. williamr@4: * Note that the encapsulated pointer may be NULL. williamr@4: */ williamr@4: TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); williamr@4: williamr@4: private: williamr@4: williamr@4: CEikStatusPaneBase* iStatusPane; williamr@4: williamr@4: CAknNavigationDecorator* iNaviDecoratorFromResource; williamr@4: williamr@4: typedef CArrayPtrFlat CAknNaviPaneStack; williamr@4: CAknNaviPaneStack* iNaviPaneControls; williamr@4: williamr@4: CFbsBitmap* iNaviArrowBitmap[4]; williamr@4: williamr@4: TInt iSpare; williamr@4: CAknNavigationControlContainerExtension* iExtension; williamr@4: }; williamr@4: williamr@4: #endif // C_AKNNAVI_H