williamr@2: /* williamr@2: * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: A default control in the status pane's small indicator pane. williamr@2: * Editor indicators uses also same control in the navigation williamr@2: * pane and in queries. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef AKNINDICATORCONTAINER_H williamr@2: #define AKNINDICATORCONTAINER_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: williamr@2: class CIncallStatusBubble; williamr@2: class CAknIndicator; williamr@2: class CAknIndicatorContainerExtension; williamr@2: class CAknPictographInterface; williamr@2: class MAknIndicatorObserver; williamr@2: williamr@2: /** williamr@2: * The default control in the status pane's small indicator pane. williamr@2: * This container is also used for the status indicators in navi pane and williamr@2: * for editor indicators in queries. williamr@2: */ williamr@2: class CAknIndicatorContainer : public CAknControl, public MEikStatusPaneObserver williamr@2: { williamr@2: friend class CAknIndicatorContainerExtension; williamr@2: friend class CAknIndicatorDataObserver; williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Layout orientations of the indicator container. williamr@2: * These are used to specify how the indicators are laid williamr@2: * out inside the indicator container. williamr@2: */ williamr@2: enum TLayoutOrientation williamr@2: { williamr@2: EVertical, ///< Indicators are arranged vertically. williamr@2: EHorizontal ///< Indicators are arranged horizontally. williamr@2: }; williamr@2: williamr@2: /** Alignment of the indicators. */ williamr@2: enum TIndicatorAlignment williamr@2: { williamr@2: ELeft, ///< Indicators are aligned on the left side. williamr@2: ERight ///< Indicators are aligned on the right side. williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Context of the indicator container. williamr@2: * These are used to specify what type of status indicators williamr@2: * the indicator container contains. williamr@2: */ williamr@2: enum TIndicatorContext williamr@2: { williamr@2: EUniversalIndicators = 0, ///< Universal status indicators. williamr@2: ENaviPaneEditorIndicators, ///< Editor indicators shown in navi pane. williamr@2: EQueryEditorIndicators, ///< Editor indicators shown in queries. williamr@2: EFindIndicators ///< Search field indicators. williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Position of a indicator. williamr@2: * These are used for invidual indicators to coarsely specify williamr@2: * where they are positioned inside the indicator container. williamr@2: */ williamr@2: enum TIndicatorPosition williamr@2: { williamr@2: ELeftSide, ///< Indicator positioned on the left side. williamr@2: ERightSide, ///< Indicator positioned on the right side. williamr@2: EMiddle ///< Indicator positioned in the middle. williamr@2: }; williamr@2: williamr@2: /** Additional flags that can be used for custom indicators. */ williamr@2: enum TCustomIndicatorFlags williamr@2: { williamr@2: EMultiColorIndicator = 0x1, ///< Indicator is multi-colored. williamr@2: EIndicatorPositionInverted = 0x2 ///< Indicator's position is inverted. williamr@2: }; williamr@2: williamr@2: /** Layout modes of indicator container. */ williamr@2: enum TLayoutMode williamr@2: { williamr@2: ELayoutModeUsual, ///< Used for universal indicators when not in idle. williamr@2: ELayoutModeWide ///< Used for navi pane indicators and universal indicators in idle. williamr@2: }; williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Default constructor. williamr@2: * Creates an @c EUniversalIndicators object. williamr@2: */ williamr@2: IMPORT_C CAknIndicatorContainer(); williamr@2: williamr@2: /** williamr@2: * Constructor. Creates @c EUniversalIndicators, @c ENaviPaneEditorIndicators williamr@2: * or @c EQueryEditorIndicators object. williamr@2: * williamr@2: * @param aIndicatorContext Indicator container context. williamr@2: */ williamr@2: IMPORT_C CAknIndicatorContainer( TInt aIndicatorContext ); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CAknIndicatorContainer(); williamr@2: williamr@2: /** williamr@2: * Second-phase constructor. williamr@2: */ williamr@2: IMPORT_C void ConstructL(); williamr@2: williamr@2: /** williamr@2: * Sets indicator state. The state can be one of the following: williamr@2: * - @c EAknIndicatorStateOff williamr@2: * williamr@2: * - @c EAknIndicatorStateOn williamr@2: * williamr@2: * - @c EAknIndicatorStateAnimate williamr@2: * williamr@2: * Editor indicators do not support animation. williamr@2: * williamr@2: * @param aIndicatorId ID of the indicator to be modified. williamr@2: * @param aState A state to be set to the indicator. williamr@2: * @param aDrawNow A flag to indicate if the indicator williamr@2: * is redrawn with this call. williamr@2: */ williamr@2: IMPORT_C void SetIndicatorState( TUid aIndicatorId, williamr@2: TInt aState, williamr@2: TBool aDrawNow = ETrue ); williamr@2: williamr@2: /** williamr@2: * Return the current state of an indicator. williamr@2: * williamr@2: * @param aIndicatorId ID of the indicator. williamr@2: * @return Current state of the indicator. williamr@2: */ williamr@2: IMPORT_C TInt IndicatorState( TUid aIndicatorId ); williamr@2: williamr@2: /** williamr@2: * Sets value to the message length indicator williamr@2: * (@c EAknNaviPaneEditorIndicatorMessageLength). williamr@2: * williamr@2: * @param aIndicatorId ID of the indicator to be modified. williamr@2: * @param aString Value of the indicator. williamr@2: */ williamr@2: IMPORT_C void SetIndicatorValueL( TUid aIndicatorId, const TDesC& aString ); williamr@2: williamr@2: /** williamr@2: * Sets value to the incall status bubble indicator on the williamr@2: * top of the status pane. williamr@2: * williamr@2: * @param aFlags Mode of the bubble. williamr@2: */ williamr@2: IMPORT_C void SetIncallBubbleFlags( const TInt& aFlags ); williamr@2: williamr@2: /** williamr@2: * Constructs the object from resource. williamr@2: * williamr@2: * @param aReader Resource reader. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL( TResourceReader& aReader ); williamr@2: williamr@2: /** williamr@2: * Returns the context of the indicator container. williamr@2: * williamr@2: * @return Context of the indicator container. williamr@2: */ williamr@2: IMPORT_C TInt IndicatorContext() const; williamr@2: williamr@2: williamr@2: public: // From base class @c MEikStatusPaneObserver. williamr@2: williamr@2: /** williamr@2: * The @c MEikStatusPaneObserver interface allows a status pane observer williamr@2: * to pick up changes in the size or position of the status pane. williamr@2: * Such events will be as a result of layout changes which williamr@2: * cause an actual change in the status pane rectangle. williamr@2: */ williamr@2: IMPORT_C void HandleStatusPaneSizeChange(); williamr@2: williamr@2: public: // From base class @c CCoeControl. williamr@2: williamr@2: /** williamr@2: * Handles pointer events. williamr@2: * williamr@2: * @param aPointerEvent The pointer event. williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent ); williamr@2: williamr@2: protected: // From base class @c CCoeControl. williamr@2: williamr@2: /** williamr@2: * Handles a change to the control's resources of type @c aType williamr@2: * which are shared across the environment, e.g. color scheme change. williamr@2: * Responds fade events and fades incall status bubble window group. williamr@2: * williamr@2: * @param aType Event type. williamr@2: */ williamr@2: IMPORT_C virtual void HandleResourceChange( TInt aType ); williamr@2: williamr@2: /** williamr@2: * Handles size change events. williamr@2: */ williamr@2: IMPORT_C virtual void SizeChanged(); williamr@2: williamr@2: /** williamr@2: * Handles position change events. williamr@2: */ williamr@2: IMPORT_C virtual void PositionChanged(); williamr@2: williamr@2: /** williamr@2: * Returns number of controls inside the context pane control. williamr@2: * williamr@2: * @return Amount of component controls. williamr@2: */ williamr@2: IMPORT_C virtual TInt CountComponentControls() const; williamr@2: williamr@2: /** williamr@2: * Returns a control determined by control index. williamr@2: * williamr@2: * @param aIndex Index of a control to be returned. williamr@2: * @return Pointer to control williamr@2: */ williamr@2: IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const; williamr@2: williamr@2: private: // From base class @c CCoeControl. williamr@2: williamr@2: IMPORT_C virtual void Draw(const TRect& aRect) const; williamr@2: williamr@2: private: // From base class @c CAknControl. williamr@2: williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: private: williamr@2: williamr@2: virtual void Reserved_1(); williamr@2: void PrioritizeIndicatorsL(); williamr@2: williamr@2: static TInt TickerCallback( TAny* aThis ); williamr@2: TInt DoTick(); williamr@2: williamr@2: void IncallBubbleSizeChanged( TBool aAllowIdleStateBubble ); williamr@2: williamr@2: void SizeChangedInSmallStatusPane(); williamr@2: williamr@2: void SizeChangedInNormalStatusPane(); williamr@2: williamr@2: void SizeChangedInStaconPane(); williamr@2: williamr@2: void SizeChangedInFlatStatusPane(); williamr@2: williamr@2: void SizeChangedInExtendedStatusPane(); williamr@2: williamr@2: void SizeChangedInIdleExtendedStatusPane(); williamr@2: williamr@2: void SizeChangedInIdleVertical(); williamr@2: williamr@2: void SetContainerWindowNonFading( TBool aNonFading ); williamr@2: williamr@2: void SetupIndicatorLayoutModes(); williamr@2: williamr@2: TInt SelectIndicatorLayoutMode(); williamr@2: williamr@2: void CreateIndicatorFromPaneResourceL( TUid aUid, williamr@2: TInt aIndicatorPaneResourceId, williamr@2: TInt aCustomIndicatorFlags ); williamr@2: williamr@2: TBool IndicatorExists( TUid aUid ) const; williamr@2: williamr@2: void CreateIncallBubbleL(); williamr@2: williamr@2: TBool UpdateSmallLayoutL(); williamr@2: williamr@2: void SetIncallBubbleDisabled( TBool aDisabled ); williamr@2: williamr@2: void ResetAnimTicker( TBool bForeground ); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Sets value to the progress bar indicator williamr@2: * (@c EAknNaviPaneEditorIndicatorProgressBar). williamr@2: * Panics if the specified indicator is not a progress bar indicator. williamr@2: * williamr@2: * @since 2.1 williamr@2: * @param aIndicatorId ID of the indicator to be modified. williamr@2: * @param aValue Current progress of the task that bar describes. williamr@2: * @param aMaxValue Progress value when task is finished. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetIndicatorValue( TUid aIndicatorId, williamr@2: TInt aValue, williamr@2: TInt aMaxValue ); williamr@2: williamr@2: /** williamr@2: * Redraws those indicators that are visible and contain pictographs. williamr@2: */ williamr@2: void DrawPictographArea(); williamr@2: williamr@2: /** williamr@2: * Returns the pictograph interface owned by the indicator container, williamr@2: * or @c NULL if pictographs are not supported. williamr@2: */ williamr@2: CAknPictographInterface* PictographInterface() const; williamr@2: williamr@2: williamr@2: /** williamr@2: * Sets whether incall bubble is shown also on the top of the idle williamr@2: * status pane. Normally it is shown only in usual statuspane layouts, williamr@2: * but with this method it can be set to shown also in idle. williamr@2: * williamr@2: * NOTE: This method works only if indicatorcontainer is used as container williamr@2: * for universal indicators. williamr@2: * williamr@2: * @param aAllowed If true incall bubble is shown also in idle statuspane. williamr@2: * Otherwise bubble is shown only in usual statuspane williamr@2: * layouts. williamr@2: */ williamr@2: IMPORT_C void SetIncallBubbleAllowedInIdle( TBool aAllowed ); williamr@2: williamr@2: /** williamr@2: * Sets whether incall bubble is shown on the top of the usual status pane. williamr@2: * Normally it is shown in usual statuspane layouts, but with this williamr@2: * method it can prevent it to be shown. williamr@2: * williamr@2: * NOTE: This method works only if indicatorcontainer is used as williamr@2: * container for universal indicators. williamr@2: * williamr@2: * @param aAllowed If true incall bubble is shown in usual statuspane. williamr@2: */ williamr@2: IMPORT_C void SetIncallBubbleAllowedInUsual( TBool aAllowed ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Sets observer for given indicator. williamr@2: * williamr@2: * @param aIndicatorObserver Observer of the indicator. williamr@2: * @param aIndicatorUid UID of indicator to be observed. williamr@2: */ williamr@2: IMPORT_C void SetIndicatorObserver( MAknIndicatorObserver* aIndicatorObserver, williamr@2: TUid aIndicatorUid ); williamr@2: williamr@2: /** williamr@2: * Creates a custom indicator. williamr@2: * Indicators created with this method can be used in addition williamr@2: * to default indicators. williamr@2: * williamr@2: * @since 3.1 williamr@2: * williamr@2: * @param aIndicatorResourceId Resource ID of INDICATOR struct to be used williamr@2: * in costructing indicator. williamr@2: * UID in the resource is ignored, a dynamic williamr@2: * UID is given to indicator and returned williamr@2: * to caller. williamr@2: * @param aCustomIndicatorFlags Flags that can be used to set additional williamr@2: * indicator properties. williamr@2: * - @c EMultiColorIndicator: williamr@2: * Indicator is shown as multicolor williamr@2: * (default is 2-color). williamr@2: * - @c EIndicatorPositionInverted: williamr@2: * Indicator is aligned to the opposite williamr@2: * side than default (default is right williamr@2: * side). Note that this flag does not williamr@2: * quarantee exact location for the williamr@2: * indicator, indicators are shown in williamr@2: * priority order and location may vary williamr@2: * and look different in different layouts. williamr@2: * williamr@2: * @return UID of the new indicator. williamr@2: * williamr@2: */ williamr@2: IMPORT_C TUid CreateIndicatorFromResourceL( TInt aIndicatorResourceId, williamr@2: TInt aCustomIndicatorFlags ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Replaces the icon of the given indicator. williamr@2: * williamr@2: * @since 3.1 williamr@2: * @param aIndicator UID of the indicator. williamr@2: * @param aState State which icon is replaced (@c EAknIndicatorStateOn williamr@2: * or @c EAknIndicatorStateAnimate) williamr@2: * @param aLayoutMode Layout mode of the icon to be replaced williamr@2: * (@c ELayoutModeUsual or @c ELayoutModeWide) williamr@2: * @param aIconBitmap Bitmap of the new icon. Ownership is transferred to williamr@2: * @c CAknIndicatorContainer. williamr@2: * @param aIconMask Mask of the new icon. Ownership is transferred to williamr@2: * @c CAknIndicatorContainer. williamr@2: * @param aIconIndex If parameter aState is @c EAknIndicatorStateAnimate, williamr@2: * then this parameter must contain the index of the williamr@2: * icon to be replaced in the animation sequence. williamr@2: * Old icon must exist for given index so that the williamr@2: * number of animation frames does not change. williamr@2: */ williamr@2: IMPORT_C void ReplaceIndicatorIconL( TUid aIndicator, williamr@2: TInt aState, williamr@2: TInt aLayoutMode, williamr@2: CFbsBitmap* aIconBitmap, williamr@2: CFbsBitmap* aIconMask, williamr@2: TInt aIconIndex = 0 ); williamr@2: williamr@2: private: williamr@2: williamr@2: /** Array of the indicators. */ williamr@2: typedef CArrayPtrFlat CAknIndicatorQueue; williamr@2: CAknIndicatorQueue* iIndicators; williamr@2: williamr@2: /** Layout orientations. */ williamr@2: TLayoutOrientation iLayoutOrientation; williamr@2: TLayoutOrientation iPreviousLayoutOrientation; williamr@2: williamr@2: /** Alignment of the indicators. */ williamr@2: TIndicatorAlignment iAlignment; williamr@2: williamr@2: /** Number of indicators shown. */ williamr@2: TInt iIndicatorsShown; williamr@2: williamr@2: /** Number of animated indicators shown. */ williamr@2: TInt iAnimatedIndicatorsShown; williamr@2: williamr@2: /** Extension class. */ williamr@2: CAknIndicatorContainerExtension* iExtension; williamr@2: williamr@2: /** Context of the indicators. */ williamr@2: TInt iIndicatorContext; williamr@2: williamr@2: /** Indicator animation timer. */ williamr@2: CPeriodic* iTicker; williamr@2: williamr@2: /** Reserved for future use. */ williamr@2: TBool iSpare2; williamr@2: williamr@2: /** Synchronization value used in the indicator animations. */ williamr@2: TInt iSynchronizingValue; williamr@2: williamr@2: /** Small incall status bubble. */ williamr@2: CIncallStatusBubble* iIncallBubble; williamr@2: }; williamr@2: williamr@2: #endif // AKNINDICATORCONTAINER_H williamr@2: williamr@2: // End of File