epoc32/include/mw/akntabgrp.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/akntabgrp.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,886 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Tab control for the status pane's navigation pane.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef AKNTABGRP_H
    1.23 +#define AKNTABGRP_H
    1.24 +
    1.25 +//  INCLUDES
    1.26 +#include <AknControl.h>
    1.27 +#include <coeccntx.h>
    1.28 +#include <coecobs.h>
    1.29 +#include <AknNaviDecoratorObserver.h>
    1.30 +#include "aknconsts.h"
    1.31 +#include "AknUtils.h"
    1.32 +
    1.33 +#include <avkon.mbg>
    1.34 +
    1.35 +
    1.36 +// FORWARD DECLARATIONS
    1.37 +
    1.38 +class CEikLabel;
    1.39 +class CEikImage;
    1.40 +class CAknTabGroup;
    1.41 +class CAknTabGroupExtension;
    1.42 +class MAknTabObserver;
    1.43 +class MAknNaviDecoratorObserver;
    1.44 +class TAknWindowLineLayout;
    1.45 +class CAknTabExtension;
    1.46 +
    1.47 +/**
    1.48 +*  Tab item control used inside a tab group.
    1.49 +*
    1.50 +*  @lib avkon.lib
    1.51 +*  @since 0.9
    1.52 +*/
    1.53 +NONSHARABLE_CLASS( CAknTab ) : public CAknControl
    1.54 +    {
    1.55 +friend class CAknTabGroup;
    1.56 +
    1.57 +public:
    1.58 +
    1.59 +    /**
    1.60 +    * Indicates a tab title's type
    1.61 +    */
    1.62 +    enum TAknTabDataType
    1.63 +        {
    1.64 +        /** Tab title is empty.*/
    1.65 +        EAknTabNone,
    1.66 +        /** Tab title has only text. */
    1.67 +        EAknTabText,
    1.68 +        /** Tab title has only icon */
    1.69 +        EAknTabIcon,
    1.70 +        /** Tab title has both text and icon. */
    1.71 +        EAknTabTextAndIcon
    1.72 +        };
    1.73 +
    1.74 +public:
    1.75 +
    1.76 +    /**
    1.77 +    * Destructor
    1.78 +    */
    1.79 +    ~CAknTab();
    1.80 +
    1.81 +    /**
    1.82 +    * Two-phased constructor.
    1.83 +    *
    1.84 +    * @param  aParent  Reference to parent control.
    1.85 +    * @param  aReader  Reference to resource reader.
    1.86 +    *
    1.87 +    * @return A pointer to constructed @c CAknTab object.
    1.88 +    */
    1.89 +    static CAknTab* NewL( const CCoeControl& aParent,
    1.90 +                          TResourceReader& aReader );
    1.91 +
    1.92 +    /**
    1.93 +    * Two-phased constructor.
    1.94 +    *
    1.95 +    * @param  aParent  Reference to parent control.
    1.96 +    * @param  aReader  Reference to resource reader.
    1.97 +    *
    1.98 +    * @return A pointer to constructed @c CAknTab object.
    1.99 +    */
   1.100 +    static CAknTab* NewLC( const CCoeControl& aParent,
   1.101 +                           TResourceReader& aReader );
   1.102 +
   1.103 +    /**
   1.104 +    * Two-phased constructor.
   1.105 +    *
   1.106 +    * @param  aId       Tab ID.
   1.107 +    * @param  aParent   Reference to parent control.
   1.108 +    * @param  aTabText  Reference to title text.
   1.109 +    *
   1.110 +    * @return A pointer to constructed @c CAknTab object.
   1.111 +    */
   1.112 +    static CAknTab* NewL( TInt aId,
   1.113 +                          const CCoeControl& aParent,
   1.114 +                          const TDesC& aTabText );
   1.115 +
   1.116 +    /**
   1.117 +    * Two-phased constructor.
   1.118 +    *
   1.119 +    * @param  aId       Tab ID.
   1.120 +    * @param  aParent   Reference to parent control.
   1.121 +    * @param  aTabText  Reference to title text.
   1.122 +    *
   1.123 +    * @return A pointer to constructed @c CAknTab object.
   1.124 +    */
   1.125 +    static CAknTab* NewLC( TInt aId,
   1.126 +                           const CCoeControl& aParent,
   1.127 +                           const TDesC& aTabText );
   1.128 +
   1.129 +    /**
   1.130 +    * Two-phased constructor.
   1.131 +    *
   1.132 +    * @param  aId         Tab ID.
   1.133 +    * @param  aParent     Reference to parent control.
   1.134 +    * @param  aTabText    Reference to title text.
   1.135 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.136 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.137 +    *
   1.138 +    * @return A pointer to constructed @c CAknTab object.
   1.139 +    */
   1.140 +    static CAknTab* NewL( TInt aId,
   1.141 +                          const CCoeControl& aParent,
   1.142 +                          const TDesC& aTabText,
   1.143 +                          const CFbsBitmap* aTabBitmap,
   1.144 +                          const CFbsBitmap* aMask = NULL );
   1.145 +
   1.146 +    /**
   1.147 +    * Two-phased constructor.
   1.148 +    *
   1.149 +    * @param  aId         Tab ID.
   1.150 +    * @param  aParent     Reference to parent control.
   1.151 +    * @param  aTabText    Reference to title text.
   1.152 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.153 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.154 +    *
   1.155 +    * @return A pointer to constructed @c CAknTab object.
   1.156 +    */
   1.157 +    static CAknTab* NewLC( TInt aId,
   1.158 +                           const CCoeControl& aParent,
   1.159 +                           const TDesC& aTabText,
   1.160 +                           const CFbsBitmap* aTabBitmap,
   1.161 +                           const CFbsBitmap* aMask = NULL );
   1.162 +
   1.163 +    /**
   1.164 +    * Two-phased constructor.
   1.165 +    *
   1.166 +    * @param  aId         Tab ID.
   1.167 +    * @param  aParent     Reference to parent control.
   1.168 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.169 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.170 +    *
   1.171 +    * @return A pointer to constructed @c CAknTab object.
   1.172 +    */
   1.173 +    static CAknTab* NewL( TInt aId,
   1.174 +                          const CCoeControl& aParent,
   1.175 +                          const CFbsBitmap* aTabBitmap,
   1.176 +                          const CFbsBitmap* aMask = NULL );
   1.177 +
   1.178 +    /**
   1.179 +    * Two-phased constructor.
   1.180 +    *
   1.181 +    * @param  aId         Tab ID.
   1.182 +    * @param  aParent     Reference to parent control.
   1.183 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.184 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.185 +    *
   1.186 +    * @return A pointer to constructed @c CAknTab object.
   1.187 +    */
   1.188 +    static CAknTab* NewLC( TInt aId,
   1.189 +                           const CCoeControl& aParent,
   1.190 +                           const CFbsBitmap* aTabBitmap,
   1.191 +                           const CFbsBitmap* aMask = NULL );
   1.192 +
   1.193 +    /**
   1.194 +    * Replace the tab title.
   1.195 +    *
   1.196 +    * @param  aTabText  New title text.
   1.197 +    */
   1.198 +    void ReplaceTextL( const TDesC& aTabText );
   1.199 +
   1.200 +    /**
   1.201 +    * Activate or deactive this tab.
   1.202 +    *
   1.203 +    * @param  aActive   @c ETrue for activation, @c EFalse for deactivation.
   1.204 +    * @param  aDrawNow  Indicates whether control need to be redrawn.
   1.205 +    */
   1.206 +    void SetActive( TBool aActive, TDrawNow aDrawNow );
   1.207 +
   1.208 +    /**
   1.209 +    * Determines whether this tab is active.
   1.210 +    *
   1.211 +    * @return @c ETrue if a tab is active, @c EFalse if not.
   1.212 +    */
   1.213 +    TBool Active() const;
   1.214 +
   1.215 +    /**
   1.216 +    * Gets tab's ID.
   1.217 +    *
   1.218 +    * @return Tabs' ID.
   1.219 +    */
   1.220 +    TInt Id() const;
   1.221 +
   1.222 +    /**
   1.223 +    * Gets this tab's type.
   1.224 +    *
   1.225 +    * @return Tab's type.
   1.226 +    */
   1.227 +    enum TAknTabDataType TabType() const;
   1.228 +
   1.229 +
   1.230 +    /**
   1.231 +    * Sets the total amount of tabs in the tabgroup where this tab belongs to.
   1.232 +    */
   1.233 +    void SetTotalAmountOfTabs( TInt aAmount );
   1.234 +
   1.235 +    /**
   1.236 +    * Sets the narrow tab layout.
   1.237 +    * @internal Used by the UI framework.
   1.238 +    * Applications can set the narrow layout using @c CAknNaviDecorator class.
   1.239 +    */
   1.240 +    void SetNarrowTabLayout( TBool aNarrow );
   1.241 +    
   1.242 +    /**
   1.243 +    * Sets the flag indicating whether or not this tab contains
   1.244 +    * a multi-colored title icon.
   1.245 +    *
   1.246 +    * The multi-color mode should be used with color icons,
   1.247 +    * otherwise the tab icon is drawn using a color
   1.248 +    * defined in the current skin.
   1.249 +    * 
   1.250 +    * @param  aMultiColor  @c ETrue to set the multi-color mode on,
   1.251 +    *                      @c EFalse to turn it off.
   1.252 +    */
   1.253 +    void SetMultiColorMode( TBool aMultiColor );
   1.254 +    
   1.255 +    /**
   1.256 +    * Checks whether or not this tab is drawn using multi-color mode or not.
   1.257 +    *
   1.258 +    * @return @c ETrue if this tab contains a multi-color icon,
   1.259 +    *         @c EFalse otherwise.
   1.260 +    */
   1.261 +    TBool MultiColorMode() const;
   1.262 +    
   1.263 +    /**
   1.264 +    * Sets the long tab layout.
   1.265 +    * @internal Used by the UI framework.
   1.266 +    */
   1.267 +    void SetLongTabLayout( TBool aLongTab );
   1.268 +
   1.269 +public: // From base class @c CCoeControl.
   1.270 +
   1.271 +    /**
   1.272 +    * Gets the minimum size of the tab.
   1.273 +    *
   1.274 +    * @return Minimum size of the tab.
   1.275 +    */
   1.276 +    virtual TSize MinimumSize();
   1.277 +
   1.278 +    /**
   1.279 +    * Sets the tab dimmed.
   1.280 +    *
   1.281 +    * @param  aDimmed  @c ETrue to dim the control,
   1.282 +    *                  @c EFalse to set the control as not dimmed.
   1.283 +    */
   1.284 +    virtual void SetDimmed( TBool aDimmed );
   1.285 +
   1.286 +    /**
   1.287 +    * Gets the list of logical colors employed
   1.288 +    * in the drawing of the control, paired with an explanation of how
   1.289 +    * they are used. Appends the list into @c aColorUseList.
   1.290 +    *
   1.291 +    * @param[in,out]  aColorUseList  The color list.
   1.292 +    */
   1.293 +    virtual void GetColorUseListL(
   1.294 +        CArrayFix<TCoeColorUse>& aColorUseList ) const;
   1.295 +
   1.296 +protected: // From base class @c CCoeControl.
   1.297 +
   1.298 +    /**
   1.299 +    * Responds to size changes events to sets the size and
   1.300 +    * position of the contents of this control.
   1.301 +    */
   1.302 +    virtual void SizeChanged();
   1.303 +
   1.304 +    /**
   1.305 +    * Gets the number of controls contained in a compound control.
   1.306 +    *
   1.307 +    * @return The number of component controls contained by this control.
   1.308 +    */
   1.309 +    virtual TInt CountComponentControls() const;
   1.310 +
   1.311 +    /**
   1.312 +    * Gets the specified component of a compound control.
   1.313 +    *
   1.314 +    * @param  aIndex  The index of the control to get.
   1.315 +    *
   1.316 +    * @return The component control with an index of @c aIndex.
   1.317 +
   1.318 +    */
   1.319 +    virtual CCoeControl* ComponentControl( TInt aIndex ) const;
   1.320 +
   1.321 +    /**
   1.322 +    * Handles pointer events.
   1.323 +    * This function is called by framework whenever a pointer event
   1.324 +    * occurs in the control.
   1.325 +    *
   1.326 +    * @param  aPointerEvent  The pointer event.
   1.327 +    */
   1.328 +    virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
   1.329 +
   1.330 +private: // From base class @c CAknControl.
   1.331 +
   1.332 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.333 +
   1.334 +private: // From base class @c CCoeControl.
   1.335 +
   1.336 +    virtual void Draw( const TRect& aRect ) const;
   1.337 +
   1.338 +private:
   1.339 +
   1.340 +    CAknTab( TInt aId );
   1.341 +
   1.342 +    void ConstructFromResourceL( TResourceReader& aReader );
   1.343 +    
   1.344 +    void ConstructL( const TDesC& aTabText );
   1.345 +    
   1.346 +    void ConstructL( const CFbsBitmap* aTabBitmap,
   1.347 +                     const CFbsBitmap* aMask = NULL );
   1.348 +
   1.349 +    void LoadColorBitmapL();
   1.350 +
   1.351 +    /**
   1.352 +    * Handles a change to the control's resources.
   1.353 +    *
   1.354 +    * @param  aType  The event type.
   1.355 +    */
   1.356 +    void HandleResourceChange( TInt aType );
   1.357 +
   1.358 +    void SizeChangedInNormalLayout();
   1.359 +    void SizeChangedInFlatLayout();
   1.360 +    void SizeChangedInNarrowLayout();
   1.361 +
   1.362 +private:
   1.363 +
   1.364 +    CEikLabel* iLabel;
   1.365 +    TInt       iId;
   1.366 +    TBool      iActive;
   1.367 +
   1.368 +    const CFbsBitmap* iBitmap;
   1.369 +    const CFbsBitmap* iBitmapMask;
   1.370 +    TAknLayoutRect    iBitmapRect;
   1.371 +
   1.372 +    CAknTabExtension* iExtension;
   1.373 +    
   1.374 +    typedef CArrayPtrFlat<CFbsBitmap> CAknTabColorBitmapArray;
   1.375 +    CAknTabColorBitmapArray* iColorBitmaps;
   1.376 +    };
   1.377 +
   1.378 +
   1.379 +/**
   1.380 +* Tab group functionality for navigation pane.
   1.381 +*
   1.382 +* @lib avkon.lib
   1.383 +* @since 0.9
   1.384 +*/
   1.385 +class CAknTabGroup : public CAknControl,
   1.386 +                     public MCoeControlObserver,
   1.387 +                     public MCoeControlContext,
   1.388 +                     public MAknNaviDecoratorObserver
   1.389 +    {
   1.390 +public:
   1.391 +    /**
   1.392 +    * Destructor.
   1.393 +    */
   1.394 +    IMPORT_C ~CAknTabGroup();
   1.395 +
   1.396 +    /**
   1.397 +    * Creates new tab group.
   1.398 +    *
   1.399 +    * @param  aParent  Parent control.
   1.400 +    */
   1.401 +    IMPORT_C static CAknTabGroup* NewL( const CCoeControl& aParent );
   1.402 +
   1.403 +    /**
   1.404 +    * Creates new tab group and pushes it to the clean up stack.
   1.405 +    *
   1.406 +    * @param  aParent  Parent control.
   1.407 +    */
   1.408 +    IMPORT_C static CAknTabGroup* NewLC( const CCoeControl& aParent );
   1.409 +
   1.410 +public:
   1.411 +
   1.412 +    /**
   1.413 +    * Add a tab to the tab group from resources.
   1.414 +    *
   1.415 +    * @param  aReader  Resource reader.
   1.416 +    *
   1.417 +    * @return ID of the added tab.
   1.418 +    */
   1.419 +    IMPORT_C TInt AddTabL( TResourceReader& aReader );
   1.420 +
   1.421 +    /**
   1.422 +    * Add a tab to the tab group.
   1.423 +    *
   1.424 +    * @param  aTabId    ID of the tab to be added.
   1.425 +    * @param  aTabText  Text for the tab.
   1.426 +    */
   1.427 +    IMPORT_C void AddTabL( TInt aTabId, const TDesC& aText );
   1.428 +
   1.429 +    /**
   1.430 +    * Add a tab to the tab group.
   1.431 +    *
   1.432 +    * @param  aTabId      ID of the tab.
   1.433 +    * @param  aTabText    Text for the tab.
   1.434 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.435 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.436 +    */
   1.437 +    IMPORT_C void AddTabL( TInt aTabId,
   1.438 +                           const TDesC& aText,
   1.439 +                           const CFbsBitmap* aTabBitmap,
   1.440 +                           const CFbsBitmap* aMask = NULL );
   1.441 +
   1.442 +    /**
   1.443 +    * Add a tab to the tab group.
   1.444 +    *
   1.445 +    * @param  aTabId      ID of the tab.
   1.446 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.447 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.448 +    */
   1.449 +    IMPORT_C void AddTabL( TInt aTabId,
   1.450 +                           const CFbsBitmap* aTabBitmap,
   1.451 +                           const CFbsBitmap* aMask = NULL );
   1.452 +    /**
   1.453 +    * Replaces a tab with a new one from resources.
   1.454 +    * Tab with same ID is replaced.
   1.455 +    *
   1.456 +    * @param  aReader  Resource reader.
   1.457 +    */
   1.458 +    IMPORT_C void ReplaceTabL( TResourceReader& aReader );
   1.459 +
   1.460 +    /**
   1.461 +    * Replaces a tab with a new one.
   1.462 +    *
   1.463 +    * @param  aTabId    ID of the tab to be replaced.
   1.464 +    * @param  aTabText  Text for the new tab.
   1.465 +    */
   1.466 +    IMPORT_C void ReplaceTabL( TInt aTabId, const TDesC& aText );
   1.467 +
   1.468 +    /**
   1.469 +    * Replaces a tab with a new one.
   1.470 +    *
   1.471 +    * @param  aTabId      ID of the tab to be replaced.
   1.472 +    * @param  aTabText    Text for the new tab.
   1.473 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.474 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.475 +    */
   1.476 +    IMPORT_C void ReplaceTabL( TInt aTabId,
   1.477 +                               const TDesC& aText,
   1.478 +                               const CFbsBitmap* aTabBitmap,
   1.479 +                               const CFbsBitmap* aMask = NULL );
   1.480 +
   1.481 +    /**
   1.482 +    * Replaces a tab with a new one.
   1.483 +    *
   1.484 +    * @param  aTabId      ID of the tab to be replaced.
   1.485 +    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
   1.486 +    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
   1.487 +    */
   1.488 +    IMPORT_C void ReplaceTabL( TInt aTabId,
   1.489 +                               const CFbsBitmap* aTabBitmap,
   1.490 +                               const CFbsBitmap* aMask = NULL );
   1.491 +
   1.492 +    /**
   1.493 +    * Replaces a tab text with a new one.
   1.494 +    *
   1.495 +    * @param  aTabId    ID of the tab containing the text to be replaced.
   1.496 +    * @param  aTabText  New tab text.
   1.497 +    */
   1.498 +    IMPORT_C void ReplaceTabTextL( TInt aTabId, const TDesC& aTabText );
   1.499 +
   1.500 +    /**
   1.501 +    * Delete a tab from the tab group.
   1.502 +    *
   1.503 +    * @param  aTabId  ID of the tab to be deleted.
   1.504 +    */
   1.505 +    IMPORT_C void DeleteTabL( TInt aTabId );
   1.506 +
   1.507 +    /**
   1.508 +    * Activate (highlight) a tab.
   1.509 +    *
   1.510 +    * @param  aTabId  ID of the tab to be highlighted.
   1.511 +    */
   1.512 +    IMPORT_C void SetActiveTabById( TInt aTabId );
   1.513 +
   1.514 +    /**
   1.515 +    * Activate (highlight) a tab.
   1.516 +    *
   1.517 +    * @param  aTabIndex  Index of the tab to be highlighted.
   1.518 +    */
   1.519 +    IMPORT_C void SetActiveTabByIndex( TInt aTabIndex );
   1.520 +
   1.521 +    /**
   1.522 +    * Returns the ID of the currently active (highlighted) tab.
   1.523 +    *
   1.524 +    * @return ID of the highlighted tab.
   1.525 +    */
   1.526 +    IMPORT_C TInt ActiveTabId() const;
   1.527 +
   1.528 +    /**
   1.529 +    * Returns the index of the currently active (highlighted) tab.
   1.530 +    *
   1.531 +    * @return Index of the highlighted tab.
   1.532 +    */
   1.533 +    IMPORT_C TInt ActiveTabIndex() const;
   1.534 +
   1.535 +    /**
   1.536 +    * Set width of each tab.
   1.537 +    * This width determines what tab layout is used.
   1.538 +    * To get a specific tab layout, use the following constants:
   1.539 +    *  - KTabWidthWithOneTab         One tab layout
   1.540 +    *  - KTabWidthWithTwoTabs        Two tabs layout
   1.541 +    *  - KTabWidthWithThreeTabs      Three tabs layout
   1.542 +    *  - KTabWidthWithFourTabs       Four tabs layout
   1.543 +    *  - KTabWidthWithTwoLongTabs    Two long tabs layout
   1.544 +    *  - KTabWidthWithThreeLongTabs  Three long tabs layout
   1.545 +    *
   1.546 +    * @param  aWidth  Width of each tab, @see aknconsts.h.
   1.547 +    */
   1.548 +    IMPORT_C void SetTabFixedWidthL( TInt aWidth );
   1.549 +    
   1.550 +    /**
   1.551 +    * Sets a tab dimmed/not dimmed.
   1.552 +    *
   1.553 +    * @param  aTabId   ID of the tab.
   1.554 +    * @param  aDimmed  @c ETrue to set the tab dimmed,
   1.555 +    *                  @c EFalse otherwise.
   1.556 +    */
   1.557 +    IMPORT_C void DimTab( TInt aTabId, TBool aDimmed );
   1.558 +    
   1.559 +    /**
   1.560 +    * Used to check whether or not a tab is dimmed.
   1.561 +    *
   1.562 +    * @param  aTabId  ID of the tab.
   1.563 +    *
   1.564 +    * @return @c ETrue if the tab is dimmed, @c EFalse otherwise.
   1.565 +    */
   1.566 +    IMPORT_C virtual TBool IsTabDimmed( TInt aTabId ) const;
   1.567 +
   1.568 +    /**
   1.569 +    * Returns the index of a tab.
   1.570 +    *
   1.571 +    * @param  aTabId  ID of a tab.
   1.572 +    *
   1.573 +    * @return Index of the tab.
   1.574 +    */
   1.575 +    IMPORT_C virtual TInt TabIndexFromId( TInt aTabId ) const;
   1.576 +
   1.577 +    /**
   1.578 +    * Returns the ID of a tab.
   1.579 +    *
   1.580 +    * @param  aTabIndex  Index of a tab.
   1.581 +    *
   1.582 +    * @return ID of the tab.
   1.583 +    */
   1.584 +    IMPORT_C virtual TInt TabIdFromIndex( TInt aTabIndex ) const;
   1.585 +
   1.586 +    /**
   1.587 +    * Number of tabs in the tab group.
   1.588 +    *
   1.589 +    * @return  Number of tabs in the tab group.
   1.590 +    */
   1.591 +    IMPORT_C virtual TInt TabCount() const;
   1.592 +
   1.593 +    /**
   1.594 +    * Sets the tab observer for this tab group.
   1.595 +    *
   1.596 +    * @param  aObserver  Tab observer to set.
   1.597 +    */
   1.598 +    IMPORT_C void SetObserver( MAknTabObserver* aObserver );
   1.599 +
   1.600 +public: // From base class @c CCoeControl.
   1.601 +
   1.602 +    /**
   1.603 +    * Return minimum size of the control.
   1.604 +    *
   1.605 +    * @return Minimum size of the control.
   1.606 +    */
   1.607 +    IMPORT_C virtual TSize MinimumSize();
   1.608 +
   1.609 +    /**
   1.610 +    * Handles key events.
   1.611 +    *
   1.612 +    * @param  aKeyEvent  The key event.
   1.613 +    * @param  aType      The type of the event.
   1.614 +    *
   1.615 +    * @return Indicates whether or not the key event was used by this control.
   1.616 +    */
   1.617 +    IMPORT_C virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
   1.618 +                                                  TEventCode aType );
   1.619 +
   1.620 +    /**
   1.621 +    * Gets the list of logical colors employed in the drawing of the control,
   1.622 +    * paired with an explanation of how they are used.
   1.623 +    * Appends the list into @c aColorUseList.
   1.624 +    *
   1.625 +    * @param[in,out]  aColorUseList  The color list.
   1.626 +    */
   1.627 +    IMPORT_C virtual void GetColorUseListL(
   1.628 +        CArrayFix<TCoeColorUse>& aColorUseList ) const;
   1.629 +
   1.630 +    /**
   1.631 +    * Handles a change to the control's resources.
   1.632 +    *
   1.633 +    * @param  aType  The type of resource change.
   1.634 +    */
   1.635 +    void HandleResourceChange( TInt aType );
   1.636 +
   1.637 +    /**
   1.638 +    * Handles pointer events in tabs.
   1.639 +    *
   1.640 +    * @param  aPointerEvent  Pointer event to be handled.
   1.641 +    */
   1.642 +    IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
   1.643 +
   1.644 +public: // From base class @c MCoeControlObserver.
   1.645 +
   1.646 +    /**
   1.647 +    * Handles an event from an observed control.
   1.648 +    *
   1.649 +    * @param  aControl    Control that caused the event.
   1.650 +    * @param  aEventType  Type of the event.
   1.651 +    */
   1.652 +    IMPORT_C virtual void HandleControlEventL( CCoeControl* aControl,
   1.653 +                                               TCoeEvent aEventType );
   1.654 +
   1.655 +public: // From base class @c MCoeControlContext.
   1.656 +
   1.657 +    /**
   1.658 +    * Allows to modify graphics context before Draw.
   1.659 +    *
   1.660 +    * @param  aGc  Graphics context to be modified.
   1.661 +    */
   1.662 +    IMPORT_C virtual void PrepareContext( CWindowGc& aGc ) const;
   1.663 +
   1.664 +public: // From base class @c MAknNaviDecoratorObserver.
   1.665 +
   1.666 +    /*
   1.667 +    * Handles events from navi decorator parent control.
   1.668 +    *
   1.669 +    * @param  aEventID  ID of event to be handled.
   1.670 +    */
   1.671 +    IMPORT_C virtual void HandleNaviDecoratorEventL( TInt aEventID );
   1.672 +
   1.673 +protected: // From base class @c CCoeControl.
   1.674 +
   1.675 +    /**
   1.676 +    * Handles the size change events.
   1.677 +    */
   1.678 +    IMPORT_C virtual void SizeChanged();
   1.679 +
   1.680 +    /**
   1.681 +    * Returns number of controls inside this control.
   1.682 +    *
   1.683 +    * @return Number of component controls.
   1.684 +    */
   1.685 +    IMPORT_C virtual TInt CountComponentControls() const;
   1.686 +
   1.687 +    /**
   1.688 +    * Returns a component control determined by control index.
   1.689 +    *
   1.690 +    * @param  aIndex  Index of a control to be returned.
   1.691 +    *
   1.692 +    * @return Pointer to the control.
   1.693 +    */
   1.694 +    IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
   1.695 +
   1.696 +    /**
   1.697 +    * This is called when the focus is changed.
   1.698 +    *
   1.699 +    * @param  aDrawNow  Whether or not to draw the control.
   1.700 +    */
   1.701 +    IMPORT_C virtual void FocusChanged( TDrawNow aDrawNow );
   1.702 +
   1.703 +    /**
   1.704 +    * Reverse the order of tabs in tab array.
   1.705 +    */
   1.706 +    void ReverseTabOrderL();
   1.707 +    
   1.708 +private:
   1.709 +
   1.710 +    /*
   1.711 +    * Reserved
   1.712 +    */
   1.713 +    IMPORT_C virtual void Reserved1();
   1.714 +
   1.715 +    /*
   1.716 +    * Reserved
   1.717 +    */
   1.718 +    IMPORT_C virtual void Reserved2();
   1.719 +
   1.720 +    /*
   1.721 +    * Reserved
   1.722 +    */
   1.723 +    IMPORT_C virtual void Reserved3();
   1.724 +
   1.725 +
   1.726 +private:
   1.727 +    IMPORT_C CAknTabGroup();
   1.728 +
   1.729 +    /**
   1.730 +    * Tab groups can be mirrored depending on current locale. To client
   1.731 +    * application everything always seems like tabs are not mirrored but
   1.732 +    * the internal order of tabs in tab group may or may not be mirrored.
   1.733 +    * If mirroring is off then this function just returns given
   1.734 +    * parameter as it is. If mirroring is on then this function returns
   1.735 +    * unmirrored index if given index was mirrord and vice versa. Two
   1.736 +    * nested calls to this function cancels its effect
   1.737 +    * (ConvertTabIndex(ConvertTabIndex(aIndex)) == aIndex).
   1.738 +    *
   1.739 +    * @param  aIndex  Index to be converted.
   1.740 +    * @return Converted index.
   1.741 +    */
   1.742 +    TInt ConvertTabIndex(TInt aIndex) const;
   1.743 +
   1.744 +private: // From base class @c CCoeControl.
   1.745 +
   1.746 +    IMPORT_C virtual void Draw( const TRect& aRect ) const;
   1.747 +
   1.748 +private: // From base class @c CAknControl.
   1.749 +
   1.750 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.751 +    
   1.752 +public: // New methods
   1.753 +
   1.754 +    /**
   1.755 +    * Sets the multi-color drawing mode of a tab.
   1.756 +    * This should be called after adding a tab to the tab group
   1.757 +    * if the icon in the tab should be drawn as multi-colored.
   1.758 +    * The tab icon will be drawn using a color specified in the
   1.759 +    * active skin if multi-color mode is not defined.
   1.760 +    *
   1.761 +    * This function should be called right after a tab containing
   1.762 +    * a multi-color icon is added to the tab group.
   1.763 +    * 
   1.764 +    * @param  aTabId       ID of the tab.
   1.765 +    * @param  aMultiColor  @c ETrue to set the multi-color mode on,
   1.766 +    *                      @c EFalse to turn it off.
   1.767 +    */
   1.768 +    IMPORT_C void SetTabMultiColorMode( TInt aTabId, TBool aMultiColor );
   1.769 +
   1.770 +    /** Directions in which the tab group focus can be moved. */
   1.771 +    enum TDirection
   1.772 +        {
   1.773 +        ELeft,
   1.774 +        ERight
   1.775 +        };
   1.776 +
   1.777 +private:
   1.778 +    void ConstructL();
   1.779 +    void CommonAddTabL(CAknTab* aTab);
   1.780 +    void CommonReplaceTabL(CAknTab* aTab);
   1.781 +    void HandleTabStateChanged(CCoeControl* aControl);
   1.782 +    TInt Index(TInt aTabId) const;
   1.783 +    TBool CycleFocus(TDirection aDirection,TDrawNow aDrawNow);
   1.784 +    TInt LeftMostTabIndex() const;
   1.785 +    TInt RightMostTabIndex() const;
   1.786 +    void DrawLowerBorder(TDrawNow aDrawNow) const;
   1.787 +    void DoDrawLowerBorder() const;
   1.788 +    void ReportNavigationEvent();
   1.789 +    void LoadTabBitmapsL(TInt aNumberOfTabsShown, TBool aLongTabs);
   1.790 +    TBool TabsVisibleInCurrentLayout() const;
   1.791 +    void CurrentLayout( TAknWindowLineLayout& aLayout ) const;
   1.792 +    void InitTabGroupGraphicsL();
   1.793 +
   1.794 +    void InitTabAnimationEventTimer();
   1.795 +    void CancelTabAnimationEventTimer();
   1.796 +    static TInt TabAnimationEvent(TAny * aPtr);
   1.797 +    void DoTabAnimationEvent();
   1.798 +
   1.799 +    TBool NarrowTabLayoutNext();
   1.800 +    TBool NarrowTabLayout();
   1.801 +
   1.802 +public:
   1.803 +
   1.804 +    /**
   1.805 +    * Sets the navigation decorator layout so that it corresponds
   1.806 +    * the current tab group layout.
   1.807 +    * 
   1.808 +    * @param  aNarrow  @c ETrue if narrow tab group layout is used,
   1.809 +    *                  @c EFalse if normal layout is used.
   1.810 +    */
   1.811 +    void SetDecoratorLayout( TBool aNarrow );
   1.812 +
   1.813 +private:
   1.814 +
   1.815 +    void SizeChangedInNormalLayout();
   1.816 +    void SizeChangedInFlatLayout();
   1.817 +    void SizeChangedInNarrowLayout();
   1.818 +    void InitTabAnimationL();
   1.819 +    
   1.820 +
   1.821 +    /**
   1.822 +    * Gets the rectangle for the tab group.
   1.823 +    * If the tab arrows are not shown, then the tab group gets a wider
   1.824 +    * rectangle.
   1.825 +    *
   1.826 +    * @param  aArrowsUsed  @c ETrue if tab arrows are shown,
   1.827 +    *                      @c EFalse otherwise.
   1.828 +    */
   1.829 +    static TRect ParentRect( TBool aArrowsUsed );
   1.830 +    
   1.831 +    /**
   1.832 +    * @internal Used by the UI framework.
   1.833 +    *
   1.834 +    * Starts the animation shown when tab focus is cycled.
   1.835 +    * Note that this starts the animation only when required, i.e.
   1.836 +    * when layout that needs cycle animation is used and when the first
   1.837 +    * shown tab in the tab group changes.
   1.838 +    *
   1.839 +    * @param  aDirection  Direction which the focus in cycled to.
   1.840 +    * @param  aNewTab     Index of the tab that receives the focus.
   1.841 +    */
   1.842 +    void StartCycleAnimationL( TDirection aDirection, TInt aNewTab );
   1.843 +    
   1.844 +    /**
   1.845 +    * Called on the dynamic layout switch event, switches the current tab
   1.846 +    * layout to a corresponding one that is usable in the new layout.
   1.847 +    */ 
   1.848 +    void SwitchTabLayoutL();
   1.849 +
   1.850 +public:
   1.851 +
   1.852 +    /**
   1.853 +    * @internal Used by the UI framework.
   1.854 +    * Applications can set the narrow layout using @c CAknNaviDecorator class.
   1.855 +    */
   1.856 +    void SetNarrowTabLayoutL( TBool aNarrow, TBool aUseAnimation = EFalse );
   1.857 +    
   1.858 +    /**
   1.859 +    * @internal Used by the UI framework.
   1.860 +    *
   1.861 +    * Sets the tab arrows' visibility.
   1.862 +    *
   1.863 +    * @param  aVisible  @c ETrue to set the arrows visible,
   1.864 +    *                   @c EFalse to hide them.
   1.865 +    */
   1.866 +    void SetNaviArrowsVisible( TBool aVisible );
   1.867 +
   1.868 +private:
   1.869 +    CArrayPtr<CAknTab>*     iTabArray;
   1.870 +    TInt                    iActiveTab;
   1.871 +    TRect                   iSpareRect;
   1.872 +
   1.873 +    TInt                    iTabFixedWidth;
   1.874 +    TBool                   iLongTabs;
   1.875 +    TInt                    iNumberOfTabsShown;
   1.876 +    TInt                    iFirstShownTab;
   1.877 +
   1.878 +    CFbsBitmap*             iTabBitmaps[KTabNumberOfTabBitmaps];
   1.879 +    CFbsBitmap*             iTabMaskBitmaps[KTabNumberOfTabBitmaps];
   1.880 +
   1.881 +    TInt                    iBitmapNames[KTabNumberOfTabBitmaps];
   1.882 +    TInt                    iBitmapMaskNames[KTabNumberOfTabBitmaps];
   1.883 +    CAknTabGroupExtension*  iExtension;
   1.884 +
   1.885 +    MAknTabObserver*        iTabObserver;
   1.886 +    TBool                   iMirrored;
   1.887 +    };
   1.888 +
   1.889 +#endif // AKNTABGRP_H