williamr@4: /* williamr@4: * Copyright (c) 2002-2008 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: Tab control for the status pane's navigation pane. williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef AKNTABGRP_H williamr@4: #define AKNTABGRP_H williamr@4: williamr@4: // INCLUDES williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: #include "aknconsts.h" williamr@4: #include "AknUtils.h" williamr@4: williamr@4: #include williamr@4: williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: williamr@4: class CEikLabel; williamr@4: class CEikImage; williamr@4: class CAknTabGroup; williamr@4: class CAknTabGroupExtension; williamr@4: class MAknTabObserver; williamr@4: class MAknNaviDecoratorObserver; williamr@4: class TAknWindowLineLayout; williamr@4: class CAknTabExtension; williamr@4: williamr@4: /** williamr@4: * Tab item control used inside a tab group. williamr@4: * williamr@4: * @lib avkon.lib williamr@4: * @since 0.9 williamr@4: */ williamr@4: NONSHARABLE_CLASS( CAknTab ) : public CAknControl williamr@4: { williamr@4: friend class CAknTabGroup; williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * Indicates a tab title's type williamr@4: */ williamr@4: enum TAknTabDataType williamr@4: { williamr@4: /** Tab title is empty.*/ williamr@4: EAknTabNone, williamr@4: /** Tab title has only text. */ williamr@4: EAknTabText, williamr@4: /** Tab title has only icon */ williamr@4: EAknTabIcon, williamr@4: /** Tab title has both text and icon. */ williamr@4: EAknTabTextAndIcon williamr@4: }; williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * Destructor williamr@4: */ williamr@4: ~CAknTab(); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aReader Reference to resource reader. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewL( const CCoeControl& aParent, williamr@4: TResourceReader& aReader ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aReader Reference to resource reader. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewLC( const CCoeControl& aParent, williamr@4: TResourceReader& aReader ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aId Tab ID. williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aTabText Reference to title text. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewL( TInt aId, williamr@4: const CCoeControl& aParent, williamr@4: const TDesC& aTabText ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aId Tab ID. williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aTabText Reference to title text. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewLC( TInt aId, williamr@4: const CCoeControl& aParent, williamr@4: const TDesC& aTabText ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aId Tab ID. williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aTabText Reference to title text. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewL( TInt aId, williamr@4: const CCoeControl& aParent, williamr@4: const TDesC& aTabText, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aId Tab ID. williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aTabText Reference to title text. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewLC( TInt aId, williamr@4: const CCoeControl& aParent, williamr@4: const TDesC& aTabText, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aId Tab ID. williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewL( TInt aId, williamr@4: const CCoeControl& aParent, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Two-phased constructor. williamr@4: * williamr@4: * @param aId Tab ID. williamr@4: * @param aParent Reference to parent control. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: * williamr@4: * @return A pointer to constructed @c CAknTab object. williamr@4: */ williamr@4: static CAknTab* NewLC( TInt aId, williamr@4: const CCoeControl& aParent, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Replace the tab title. williamr@4: * williamr@4: * @param aTabText New title text. williamr@4: */ williamr@4: void ReplaceTextL( const TDesC& aTabText ); williamr@4: williamr@4: /** williamr@4: * Activate or deactive this tab. williamr@4: * williamr@4: * @param aActive @c ETrue for activation, @c EFalse for deactivation. williamr@4: * @param aDrawNow Indicates whether control need to be redrawn. williamr@4: */ williamr@4: void SetActive( TBool aActive, TDrawNow aDrawNow ); williamr@4: williamr@4: /** williamr@4: * Determines whether this tab is active. williamr@4: * williamr@4: * @return @c ETrue if a tab is active, @c EFalse if not. williamr@4: */ williamr@4: TBool Active() const; williamr@4: williamr@4: /** williamr@4: * Gets tab's ID. williamr@4: * williamr@4: * @return Tabs' ID. williamr@4: */ williamr@4: TInt Id() const; williamr@4: williamr@4: /** williamr@4: * Gets this tab's type. williamr@4: * williamr@4: * @return Tab's type. williamr@4: */ williamr@4: enum TAknTabDataType TabType() const; williamr@4: williamr@4: williamr@4: /** williamr@4: * Sets the total amount of tabs in the tabgroup where this tab belongs to. williamr@4: */ williamr@4: void SetTotalAmountOfTabs( TInt aAmount ); williamr@4: williamr@4: /** williamr@4: * Sets the narrow tab layout. williamr@4: * @internal Used by the UI framework. williamr@4: * Applications can set the narrow layout using @c CAknNaviDecorator class. williamr@4: */ williamr@4: void SetNarrowTabLayout( TBool aNarrow ); williamr@4: williamr@4: /** williamr@4: * Sets the flag indicating whether or not this tab contains williamr@4: * a multi-colored title icon. williamr@4: * williamr@4: * The multi-color mode should be used with color icons, williamr@4: * otherwise the tab icon is drawn using a color williamr@4: * defined in the current skin. williamr@4: * williamr@4: * @param aMultiColor @c ETrue to set the multi-color mode on, williamr@4: * @c EFalse to turn it off. williamr@4: */ williamr@4: void SetMultiColorMode( TBool aMultiColor ); williamr@4: williamr@4: /** williamr@4: * Checks whether or not this tab is drawn using multi-color mode or not. williamr@4: * williamr@4: * @return @c ETrue if this tab contains a multi-color icon, williamr@4: * @c EFalse otherwise. williamr@4: */ williamr@4: TBool MultiColorMode() const; williamr@4: williamr@4: /** williamr@4: * Sets the long tab layout. williamr@4: * @internal Used by the UI framework. williamr@4: */ williamr@4: void SetLongTabLayout( TBool aLongTab ); williamr@4: williamr@4: public: // From base class @c CCoeControl. williamr@4: williamr@4: /** williamr@4: * Gets the minimum size of the tab. williamr@4: * williamr@4: * @return Minimum size of the tab. williamr@4: */ williamr@4: virtual TSize MinimumSize(); williamr@4: williamr@4: /** williamr@4: * Sets the tab dimmed. williamr@4: * williamr@4: * @param aDimmed @c ETrue to dim the control, williamr@4: * @c EFalse to set the control as not dimmed. williamr@4: */ williamr@4: virtual void SetDimmed( TBool aDimmed ); williamr@4: williamr@4: /** williamr@4: * Gets the list of logical colors employed williamr@4: * in the drawing of the control, paired with an explanation of how williamr@4: * they are used. Appends the list into @c aColorUseList. williamr@4: * williamr@4: * @param[in,out] aColorUseList The color list. williamr@4: */ williamr@4: virtual void GetColorUseListL( williamr@4: CArrayFix& aColorUseList ) const; williamr@4: williamr@4: protected: // From base class @c CCoeControl. williamr@4: williamr@4: /** williamr@4: * Responds to size changes events to sets the size and williamr@4: * position of the contents of this control. williamr@4: */ williamr@4: virtual void SizeChanged(); williamr@4: williamr@4: /** williamr@4: * Gets the number of controls contained in a compound control. williamr@4: * williamr@4: * @return The number of component controls contained by this control. williamr@4: */ williamr@4: virtual TInt CountComponentControls() const; williamr@4: williamr@4: /** williamr@4: * Gets the specified component of a compound control. williamr@4: * williamr@4: * @param aIndex The index of the control to get. williamr@4: * williamr@4: * @return The component control with an index of @c aIndex. williamr@4: williamr@4: */ williamr@4: virtual CCoeControl* ComponentControl( TInt aIndex ) const; williamr@4: williamr@4: /** williamr@4: * Handles pointer events. williamr@4: * This function is called by framework whenever a pointer event williamr@4: * occurs in the control. williamr@4: * williamr@4: * @param aPointerEvent The pointer event. williamr@4: */ williamr@4: virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent ); williamr@4: williamr@4: private: // From base class @c CAknControl. williamr@4: williamr@4: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@4: williamr@4: private: // From base class @c CCoeControl. williamr@4: williamr@4: virtual void Draw( const TRect& aRect ) const; williamr@4: williamr@4: private: williamr@4: williamr@4: CAknTab( TInt aId ); williamr@4: williamr@4: void ConstructFromResourceL( TResourceReader& aReader ); williamr@4: williamr@4: void ConstructL( const TDesC& aTabText ); williamr@4: williamr@4: void ConstructL( const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: void LoadColorBitmapL(); williamr@4: williamr@4: /** williamr@4: * Handles a change to the control's resources. williamr@4: * williamr@4: * @param aType The event type. williamr@4: */ williamr@4: void HandleResourceChange( TInt aType ); williamr@4: williamr@4: void SizeChangedInNormalLayout(); williamr@4: void SizeChangedInFlatLayout(); williamr@4: void SizeChangedInNarrowLayout(); williamr@4: williamr@4: private: williamr@4: williamr@4: CEikLabel* iLabel; williamr@4: TInt iId; williamr@4: TBool iActive; williamr@4: williamr@4: const CFbsBitmap* iBitmap; williamr@4: const CFbsBitmap* iBitmapMask; williamr@4: TAknLayoutRect iBitmapRect; williamr@4: williamr@4: CAknTabExtension* iExtension; williamr@4: williamr@4: typedef CArrayPtrFlat CAknTabColorBitmapArray; williamr@4: CAknTabColorBitmapArray* iColorBitmaps; williamr@4: }; williamr@4: williamr@4: williamr@4: /** williamr@4: * Tab group functionality for navigation pane. williamr@4: * williamr@4: * @lib avkon.lib williamr@4: * @since 0.9 williamr@4: */ williamr@4: class CAknTabGroup : public CAknControl, williamr@4: public MCoeControlObserver, williamr@4: public MCoeControlContext, williamr@4: public MAknNaviDecoratorObserver williamr@4: { williamr@4: public: williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: IMPORT_C ~CAknTabGroup(); williamr@4: williamr@4: /** williamr@4: * Creates new tab group. williamr@4: * williamr@4: * @param aParent Parent control. williamr@4: */ williamr@4: IMPORT_C static CAknTabGroup* NewL( const CCoeControl& aParent ); williamr@4: williamr@4: /** williamr@4: * Creates new tab group and pushes it to the clean up stack. williamr@4: * williamr@4: * @param aParent Parent control. williamr@4: */ williamr@4: IMPORT_C static CAknTabGroup* NewLC( const CCoeControl& aParent ); williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * Add a tab to the tab group from resources. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: * williamr@4: * @return ID of the added tab. williamr@4: */ williamr@4: IMPORT_C TInt AddTabL( TResourceReader& aReader ); williamr@4: williamr@4: /** williamr@4: * Add a tab to the tab group. williamr@4: * williamr@4: * @param aTabId ID of the tab to be added. williamr@4: * @param aTabText Text for the tab. williamr@4: */ williamr@4: IMPORT_C void AddTabL( TInt aTabId, const TDesC& aText ); williamr@4: williamr@4: /** williamr@4: * Add a tab to the tab group. williamr@4: * williamr@4: * @param aTabId ID of the tab. williamr@4: * @param aTabText Text for the tab. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: */ williamr@4: IMPORT_C void AddTabL( TInt aTabId, williamr@4: const TDesC& aText, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Add a tab to the tab group. williamr@4: * williamr@4: * @param aTabId ID of the tab. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: */ williamr@4: IMPORT_C void AddTabL( TInt aTabId, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: /** williamr@4: * Replaces a tab with a new one from resources. williamr@4: * Tab with same ID is replaced. williamr@4: * williamr@4: * @param aReader Resource reader. williamr@4: */ williamr@4: IMPORT_C void ReplaceTabL( TResourceReader& aReader ); williamr@4: williamr@4: /** williamr@4: * Replaces a tab with a new one. williamr@4: * williamr@4: * @param aTabId ID of the tab to be replaced. williamr@4: * @param aTabText Text for the new tab. williamr@4: */ williamr@4: IMPORT_C void ReplaceTabL( TInt aTabId, const TDesC& aText ); williamr@4: williamr@4: /** williamr@4: * Replaces a tab with a new one. williamr@4: * williamr@4: * @param aTabId ID of the tab to be replaced. williamr@4: * @param aTabText Text for the new tab. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: */ williamr@4: IMPORT_C void ReplaceTabL( TInt aTabId, williamr@4: const TDesC& aText, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Replaces a tab with a new one. williamr@4: * williamr@4: * @param aTabId ID of the tab to be replaced. williamr@4: * @param aTabBitmap Bitmap for the tab. Ownership of the bitmap is taken. williamr@4: * @param aMask Bitmap's mask. Ownership of the mask is taken. williamr@4: */ williamr@4: IMPORT_C void ReplaceTabL( TInt aTabId, williamr@4: const CFbsBitmap* aTabBitmap, williamr@4: const CFbsBitmap* aMask = NULL ); williamr@4: williamr@4: /** williamr@4: * Replaces a tab text with a new one. williamr@4: * williamr@4: * @param aTabId ID of the tab containing the text to be replaced. williamr@4: * @param aTabText New tab text. williamr@4: */ williamr@4: IMPORT_C void ReplaceTabTextL( TInt aTabId, const TDesC& aTabText ); williamr@4: williamr@4: /** williamr@4: * Delete a tab from the tab group. williamr@4: * williamr@4: * @param aTabId ID of the tab to be deleted. williamr@4: */ williamr@4: IMPORT_C void DeleteTabL( TInt aTabId ); williamr@4: williamr@4: /** williamr@4: * Activate (highlight) a tab. williamr@4: * williamr@4: * @param aTabId ID of the tab to be highlighted. williamr@4: */ williamr@4: IMPORT_C void SetActiveTabById( TInt aTabId ); williamr@4: williamr@4: /** williamr@4: * Activate (highlight) a tab. williamr@4: * williamr@4: * @param aTabIndex Index of the tab to be highlighted. williamr@4: */ williamr@4: IMPORT_C void SetActiveTabByIndex( TInt aTabIndex ); williamr@4: williamr@4: /** williamr@4: * Returns the ID of the currently active (highlighted) tab. williamr@4: * williamr@4: * @return ID of the highlighted tab. williamr@4: */ williamr@4: IMPORT_C TInt ActiveTabId() const; williamr@4: williamr@4: /** williamr@4: * Returns the index of the currently active (highlighted) tab. williamr@4: * williamr@4: * @return Index of the highlighted tab. williamr@4: */ williamr@4: IMPORT_C TInt ActiveTabIndex() const; williamr@4: williamr@4: /** williamr@4: * Set width of each tab. williamr@4: * This width determines what tab layout is used. williamr@4: * To get a specific tab layout, use the following constants: williamr@4: * - KTabWidthWithOneTab One tab layout williamr@4: * - KTabWidthWithTwoTabs Two tabs layout williamr@4: * - KTabWidthWithThreeTabs Three tabs layout williamr@4: * - KTabWidthWithFourTabs Four tabs layout williamr@4: * - KTabWidthWithTwoLongTabs Two long tabs layout williamr@4: * - KTabWidthWithThreeLongTabs Three long tabs layout williamr@4: * williamr@4: * @param aWidth Width of each tab, @see aknconsts.h. williamr@4: */ williamr@4: IMPORT_C void SetTabFixedWidthL( TInt aWidth ); williamr@4: williamr@4: /** williamr@4: * Sets a tab dimmed/not dimmed. williamr@4: * williamr@4: * @param aTabId ID of the tab. williamr@4: * @param aDimmed @c ETrue to set the tab dimmed, williamr@4: * @c EFalse otherwise. williamr@4: */ williamr@4: IMPORT_C void DimTab( TInt aTabId, TBool aDimmed ); williamr@4: williamr@4: /** williamr@4: * Used to check whether or not a tab is dimmed. williamr@4: * williamr@4: * @param aTabId ID of the tab. williamr@4: * williamr@4: * @return @c ETrue if the tab is dimmed, @c EFalse otherwise. williamr@4: */ williamr@4: IMPORT_C virtual TBool IsTabDimmed( TInt aTabId ) const; williamr@4: williamr@4: /** williamr@4: * Returns the index of a tab. williamr@4: * williamr@4: * @param aTabId ID of a tab. williamr@4: * williamr@4: * @return Index of the tab. williamr@4: */ williamr@4: IMPORT_C virtual TInt TabIndexFromId( TInt aTabId ) const; williamr@4: williamr@4: /** williamr@4: * Returns the ID of a tab. williamr@4: * williamr@4: * @param aTabIndex Index of a tab. williamr@4: * williamr@4: * @return ID of the tab. williamr@4: */ williamr@4: IMPORT_C virtual TInt TabIdFromIndex( TInt aTabIndex ) const; williamr@4: williamr@4: /** williamr@4: * Number of tabs in the tab group. williamr@4: * williamr@4: * @return Number of tabs in the tab group. williamr@4: */ williamr@4: IMPORT_C virtual TInt TabCount() const; williamr@4: williamr@4: /** williamr@4: * Sets the tab observer for this tab group. williamr@4: * williamr@4: * @param aObserver Tab observer to set. williamr@4: */ williamr@4: IMPORT_C void SetObserver( MAknTabObserver* aObserver ); williamr@4: williamr@4: public: // From base class @c CCoeControl. williamr@4: williamr@4: /** williamr@4: * Return minimum size of the control. williamr@4: * williamr@4: * @return Minimum size of the control. williamr@4: */ williamr@4: IMPORT_C virtual TSize MinimumSize(); williamr@4: williamr@4: /** williamr@4: * Handles key events. williamr@4: * williamr@4: * @param aKeyEvent The key event. williamr@4: * @param aType The type of the event. williamr@4: * williamr@4: * @return Indicates whether or not the key event was used by this control. williamr@4: */ williamr@4: IMPORT_C virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, williamr@4: TEventCode aType ); williamr@4: williamr@4: /** williamr@4: * Gets the list of logical colors employed in the drawing of the control, williamr@4: * paired with an explanation of how they are used. williamr@4: * Appends the list into @c aColorUseList. williamr@4: * williamr@4: * @param[in,out] aColorUseList The color list. williamr@4: */ williamr@4: IMPORT_C virtual void GetColorUseListL( williamr@4: CArrayFix& aColorUseList ) const; williamr@4: williamr@4: /** williamr@4: * Handles a change to the control's resources. williamr@4: * williamr@4: * @param aType The type of resource change. williamr@4: */ williamr@4: void HandleResourceChange( TInt aType ); williamr@4: williamr@4: /** williamr@4: * Handles pointer events in tabs. williamr@4: * williamr@4: * @param aPointerEvent Pointer event to be handled. williamr@4: */ williamr@4: IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent ); williamr@4: williamr@4: public: // From base class @c MCoeControlObserver. williamr@4: williamr@4: /** williamr@4: * Handles an event from an observed control. 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 virtual void HandleControlEventL( CCoeControl* aControl, williamr@4: TCoeEvent aEventType ); williamr@4: williamr@4: public: // From base class @c MCoeControlContext. williamr@4: williamr@4: /** williamr@4: * Allows to modify graphics context before Draw. williamr@4: * williamr@4: * @param aGc Graphics context to be modified. williamr@4: */ williamr@4: IMPORT_C virtual void PrepareContext( CWindowGc& aGc ) const; williamr@4: williamr@4: public: // From base class @c MAknNaviDecoratorObserver. williamr@4: williamr@4: /* williamr@4: * Handles events from navi decorator parent control. williamr@4: * williamr@4: * @param aEventID ID of event to be handled. williamr@4: */ williamr@4: IMPORT_C virtual void HandleNaviDecoratorEventL( TInt aEventID ); williamr@4: williamr@4: protected: // From base class @c CCoeControl. williamr@4: williamr@4: /** williamr@4: * Handles the size change events. williamr@4: */ williamr@4: IMPORT_C virtual void SizeChanged(); williamr@4: williamr@4: /** williamr@4: * Returns number of controls inside this 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: * Returns a component control determined by control index. williamr@4: * williamr@4: * @param aIndex Index of a control to be returned. williamr@4: * williamr@4: * @return Pointer to the control. williamr@4: */ williamr@4: IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const; williamr@4: williamr@4: /** williamr@4: * This is called when the focus is changed. williamr@4: * williamr@4: * @param aDrawNow Whether or not to draw the control. williamr@4: */ williamr@4: IMPORT_C virtual void FocusChanged( TDrawNow aDrawNow ); williamr@4: williamr@4: /** williamr@4: * Reverse the order of tabs in tab array. williamr@4: */ williamr@4: void ReverseTabOrderL(); williamr@4: williamr@4: private: williamr@4: williamr@4: /* williamr@4: * Reserved williamr@4: */ williamr@4: IMPORT_C virtual void Reserved1(); williamr@4: williamr@4: /* williamr@4: * Reserved williamr@4: */ williamr@4: IMPORT_C virtual void Reserved2(); williamr@4: williamr@4: /* williamr@4: * Reserved williamr@4: */ williamr@4: IMPORT_C virtual void Reserved3(); williamr@4: williamr@4: williamr@4: private: williamr@4: IMPORT_C CAknTabGroup(); williamr@4: williamr@4: /** williamr@4: * Tab groups can be mirrored depending on current locale. To client williamr@4: * application everything always seems like tabs are not mirrored but williamr@4: * the internal order of tabs in tab group may or may not be mirrored. williamr@4: * If mirroring is off then this function just returns given williamr@4: * parameter as it is. If mirroring is on then this function returns williamr@4: * unmirrored index if given index was mirrord and vice versa. Two williamr@4: * nested calls to this function cancels its effect williamr@4: * (ConvertTabIndex(ConvertTabIndex(aIndex)) == aIndex). williamr@4: * williamr@4: * @param aIndex Index to be converted. williamr@4: * @return Converted index. williamr@4: */ williamr@4: TInt ConvertTabIndex(TInt aIndex) const; williamr@4: williamr@4: private: // From base class @c CCoeControl. williamr@4: williamr@4: IMPORT_C virtual void Draw( const TRect& aRect ) const; williamr@4: williamr@4: private: // From base class @c CAknControl. williamr@4: williamr@4: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@4: williamr@4: public: // New methods williamr@4: williamr@4: /** williamr@4: * Sets the multi-color drawing mode of a tab. williamr@4: * This should be called after adding a tab to the tab group williamr@4: * if the icon in the tab should be drawn as multi-colored. williamr@4: * The tab icon will be drawn using a color specified in the williamr@4: * active skin if multi-color mode is not defined. williamr@4: * williamr@4: * This function should be called right after a tab containing williamr@4: * a multi-color icon is added to the tab group. williamr@4: * williamr@4: * @param aTabId ID of the tab. williamr@4: * @param aMultiColor @c ETrue to set the multi-color mode on, williamr@4: * @c EFalse to turn it off. williamr@4: */ williamr@4: IMPORT_C void SetTabMultiColorMode( TInt aTabId, TBool aMultiColor ); williamr@4: williamr@4: /** Directions in which the tab group focus can be moved. */ williamr@4: enum TDirection williamr@4: { williamr@4: ELeft, williamr@4: ERight williamr@4: }; williamr@4: williamr@4: private: williamr@4: void ConstructL(); williamr@4: void CommonAddTabL(CAknTab* aTab); williamr@4: void CommonReplaceTabL(CAknTab* aTab); williamr@4: void HandleTabStateChanged(CCoeControl* aControl); williamr@4: TInt Index(TInt aTabId) const; williamr@4: TBool CycleFocus(TDirection aDirection,TDrawNow aDrawNow); williamr@4: TInt LeftMostTabIndex() const; williamr@4: TInt RightMostTabIndex() const; williamr@4: void DrawLowerBorder(TDrawNow aDrawNow) const; williamr@4: void DoDrawLowerBorder() const; williamr@4: void ReportNavigationEvent(); williamr@4: void LoadTabBitmapsL(TInt aNumberOfTabsShown, TBool aLongTabs); williamr@4: TBool TabsVisibleInCurrentLayout() const; williamr@4: void CurrentLayout( TAknWindowLineLayout& aLayout ) const; williamr@4: void InitTabGroupGraphicsL(); williamr@4: williamr@4: void InitTabAnimationEventTimer(); williamr@4: void CancelTabAnimationEventTimer(); williamr@4: static TInt TabAnimationEvent(TAny * aPtr); williamr@4: void DoTabAnimationEvent(); williamr@4: williamr@4: TBool NarrowTabLayoutNext(); williamr@4: TBool NarrowTabLayout(); williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * Sets the navigation decorator layout so that it corresponds williamr@4: * the current tab group layout. williamr@4: * williamr@4: * @param aNarrow @c ETrue if narrow tab group layout is used, williamr@4: * @c EFalse if normal layout is used. williamr@4: */ williamr@4: void SetDecoratorLayout( TBool aNarrow ); williamr@4: williamr@4: private: williamr@4: williamr@4: void SizeChangedInNormalLayout(); williamr@4: void SizeChangedInFlatLayout(); williamr@4: void SizeChangedInNarrowLayout(); williamr@4: void InitTabAnimationL(); williamr@4: williamr@4: williamr@4: /** williamr@4: * Gets the rectangle for the tab group. williamr@4: * If the tab arrows are not shown, then the tab group gets a wider williamr@4: * rectangle. williamr@4: * williamr@4: * @param aArrowsUsed @c ETrue if tab arrows are shown, williamr@4: * @c EFalse otherwise. williamr@4: */ williamr@4: static TRect ParentRect( TBool aArrowsUsed ); williamr@4: williamr@4: /** williamr@4: * @internal Used by the UI framework. williamr@4: * williamr@4: * Starts the animation shown when tab focus is cycled. williamr@4: * Note that this starts the animation only when required, i.e. williamr@4: * when layout that needs cycle animation is used and when the first williamr@4: * shown tab in the tab group changes. williamr@4: * williamr@4: * @param aDirection Direction which the focus in cycled to. williamr@4: * @param aNewTab Index of the tab that receives the focus. williamr@4: */ williamr@4: void StartCycleAnimationL( TDirection aDirection, TInt aNewTab ); williamr@4: williamr@4: /** williamr@4: * Called on the dynamic layout switch event, switches the current tab williamr@4: * layout to a corresponding one that is usable in the new layout. williamr@4: */ williamr@4: void SwitchTabLayoutL(); williamr@4: williamr@4: public: williamr@4: williamr@4: /** williamr@4: * @internal Used by the UI framework. williamr@4: * Applications can set the narrow layout using @c CAknNaviDecorator class. williamr@4: */ williamr@4: void SetNarrowTabLayoutL( TBool aNarrow, TBool aUseAnimation = EFalse ); williamr@4: williamr@4: /** williamr@4: * @internal Used by the UI framework. williamr@4: * williamr@4: * Sets the tab arrows' visibility. williamr@4: * williamr@4: * @param aVisible @c ETrue to set the arrows visible, williamr@4: * @c EFalse to hide them. williamr@4: */ williamr@4: void SetNaviArrowsVisible( TBool aVisible ); williamr@4: williamr@4: private: williamr@4: CArrayPtr* iTabArray; williamr@4: TInt iActiveTab; williamr@4: TRect iSpareRect; williamr@4: williamr@4: TInt iTabFixedWidth; williamr@4: TBool iLongTabs; williamr@4: TInt iNumberOfTabsShown; williamr@4: TInt iFirstShownTab; williamr@4: williamr@4: CFbsBitmap* iTabBitmaps[KTabNumberOfTabBitmaps]; williamr@4: CFbsBitmap* iTabMaskBitmaps[KTabNumberOfTabBitmaps]; williamr@4: williamr@4: TInt iBitmapNames[KTabNumberOfTabBitmaps]; williamr@4: TInt iBitmapMaskNames[KTabNumberOfTabBitmaps]; williamr@4: CAknTabGroupExtension* iExtension; williamr@4: williamr@4: MAknTabObserver* iTabObserver; williamr@4: TBool iMirrored; williamr@4: }; williamr@4: williamr@4: #endif // AKNTABGRP_H