epoc32/include/mw/akntabgrp.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description:  Tab control for the status pane's navigation pane.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
#ifndef AKNTABGRP_H
williamr@4
    20
#define AKNTABGRP_H
williamr@4
    21
williamr@4
    22
//  INCLUDES
williamr@4
    23
#include <AknControl.h>
williamr@4
    24
#include <coeccntx.h>
williamr@4
    25
#include <coecobs.h>
williamr@4
    26
#include <AknNaviDecoratorObserver.h>
williamr@4
    27
#include "aknconsts.h"
williamr@4
    28
#include "AknUtils.h"
williamr@4
    29
williamr@4
    30
#include <avkon.mbg>
williamr@4
    31
williamr@4
    32
williamr@4
    33
// FORWARD DECLARATIONS
williamr@4
    34
williamr@4
    35
class CEikLabel;
williamr@4
    36
class CEikImage;
williamr@4
    37
class CAknTabGroup;
williamr@4
    38
class CAknTabGroupExtension;
williamr@4
    39
class MAknTabObserver;
williamr@4
    40
class MAknNaviDecoratorObserver;
williamr@4
    41
class TAknWindowLineLayout;
williamr@4
    42
class CAknTabExtension;
williamr@4
    43
williamr@4
    44
/**
williamr@4
    45
*  Tab item control used inside a tab group.
williamr@4
    46
*
williamr@4
    47
*  @lib avkon.lib
williamr@4
    48
*  @since 0.9
williamr@4
    49
*/
williamr@4
    50
NONSHARABLE_CLASS( CAknTab ) : public CAknControl
williamr@4
    51
    {
williamr@4
    52
friend class CAknTabGroup;
williamr@4
    53
williamr@4
    54
public:
williamr@4
    55
williamr@4
    56
    /**
williamr@4
    57
    * Indicates a tab title's type
williamr@4
    58
    */
williamr@4
    59
    enum TAknTabDataType
williamr@4
    60
        {
williamr@4
    61
        /** Tab title is empty.*/
williamr@4
    62
        EAknTabNone,
williamr@4
    63
        /** Tab title has only text. */
williamr@4
    64
        EAknTabText,
williamr@4
    65
        /** Tab title has only icon */
williamr@4
    66
        EAknTabIcon,
williamr@4
    67
        /** Tab title has both text and icon. */
williamr@4
    68
        EAknTabTextAndIcon
williamr@4
    69
        };
williamr@4
    70
williamr@4
    71
public:
williamr@4
    72
williamr@4
    73
    /**
williamr@4
    74
    * Destructor
williamr@4
    75
    */
williamr@4
    76
    ~CAknTab();
williamr@4
    77
williamr@4
    78
    /**
williamr@4
    79
    * Two-phased constructor.
williamr@4
    80
    *
williamr@4
    81
    * @param  aParent  Reference to parent control.
williamr@4
    82
    * @param  aReader  Reference to resource reader.
williamr@4
    83
    *
williamr@4
    84
    * @return A pointer to constructed @c CAknTab object.
williamr@4
    85
    */
williamr@4
    86
    static CAknTab* NewL( const CCoeControl& aParent,
williamr@4
    87
                          TResourceReader& aReader );
williamr@4
    88
williamr@4
    89
    /**
williamr@4
    90
    * Two-phased constructor.
williamr@4
    91
    *
williamr@4
    92
    * @param  aParent  Reference to parent control.
williamr@4
    93
    * @param  aReader  Reference to resource reader.
williamr@4
    94
    *
williamr@4
    95
    * @return A pointer to constructed @c CAknTab object.
williamr@4
    96
    */
williamr@4
    97
    static CAknTab* NewLC( const CCoeControl& aParent,
williamr@4
    98
                           TResourceReader& aReader );
williamr@4
    99
williamr@4
   100
    /**
williamr@4
   101
    * Two-phased constructor.
williamr@4
   102
    *
williamr@4
   103
    * @param  aId       Tab ID.
williamr@4
   104
    * @param  aParent   Reference to parent control.
williamr@4
   105
    * @param  aTabText  Reference to title text.
williamr@4
   106
    *
williamr@4
   107
    * @return A pointer to constructed @c CAknTab object.
williamr@4
   108
    */
williamr@4
   109
    static CAknTab* NewL( TInt aId,
williamr@4
   110
                          const CCoeControl& aParent,
williamr@4
   111
                          const TDesC& aTabText );
williamr@4
   112
williamr@4
   113
    /**
williamr@4
   114
    * Two-phased constructor.
williamr@4
   115
    *
williamr@4
   116
    * @param  aId       Tab ID.
williamr@4
   117
    * @param  aParent   Reference to parent control.
williamr@4
   118
    * @param  aTabText  Reference to title text.
williamr@4
   119
    *
williamr@4
   120
    * @return A pointer to constructed @c CAknTab object.
williamr@4
   121
    */
williamr@4
   122
    static CAknTab* NewLC( TInt aId,
williamr@4
   123
                           const CCoeControl& aParent,
williamr@4
   124
                           const TDesC& aTabText );
williamr@4
   125
williamr@4
   126
    /**
williamr@4
   127
    * Two-phased constructor.
williamr@4
   128
    *
williamr@4
   129
    * @param  aId         Tab ID.
williamr@4
   130
    * @param  aParent     Reference to parent control.
williamr@4
   131
    * @param  aTabText    Reference to title text.
williamr@4
   132
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   133
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   134
    *
williamr@4
   135
    * @return A pointer to constructed @c CAknTab object.
williamr@4
   136
    */
williamr@4
   137
    static CAknTab* NewL( TInt aId,
williamr@4
   138
                          const CCoeControl& aParent,
williamr@4
   139
                          const TDesC& aTabText,
williamr@4
   140
                          const CFbsBitmap* aTabBitmap,
williamr@4
   141
                          const CFbsBitmap* aMask = NULL );
williamr@4
   142
williamr@4
   143
    /**
williamr@4
   144
    * Two-phased constructor.
williamr@4
   145
    *
williamr@4
   146
    * @param  aId         Tab ID.
williamr@4
   147
    * @param  aParent     Reference to parent control.
williamr@4
   148
    * @param  aTabText    Reference to title text.
williamr@4
   149
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   150
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   151
    *
williamr@4
   152
    * @return A pointer to constructed @c CAknTab object.
williamr@4
   153
    */
williamr@4
   154
    static CAknTab* NewLC( TInt aId,
williamr@4
   155
                           const CCoeControl& aParent,
williamr@4
   156
                           const TDesC& aTabText,
williamr@4
   157
                           const CFbsBitmap* aTabBitmap,
williamr@4
   158
                           const CFbsBitmap* aMask = NULL );
williamr@4
   159
williamr@4
   160
    /**
williamr@4
   161
    * Two-phased constructor.
williamr@4
   162
    *
williamr@4
   163
    * @param  aId         Tab ID.
williamr@4
   164
    * @param  aParent     Reference to parent control.
williamr@4
   165
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   166
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   167
    *
williamr@4
   168
    * @return A pointer to constructed @c CAknTab object.
williamr@4
   169
    */
williamr@4
   170
    static CAknTab* NewL( TInt aId,
williamr@4
   171
                          const CCoeControl& aParent,
williamr@4
   172
                          const CFbsBitmap* aTabBitmap,
williamr@4
   173
                          const CFbsBitmap* aMask = NULL );
williamr@4
   174
williamr@4
   175
    /**
williamr@4
   176
    * Two-phased constructor.
williamr@4
   177
    *
williamr@4
   178
    * @param  aId         Tab ID.
williamr@4
   179
    * @param  aParent     Reference to parent control.
williamr@4
   180
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   181
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   182
    *
williamr@4
   183
    * @return A pointer to constructed @c CAknTab object.
williamr@4
   184
    */
williamr@4
   185
    static CAknTab* NewLC( TInt aId,
williamr@4
   186
                           const CCoeControl& aParent,
williamr@4
   187
                           const CFbsBitmap* aTabBitmap,
williamr@4
   188
                           const CFbsBitmap* aMask = NULL );
williamr@4
   189
williamr@4
   190
    /**
williamr@4
   191
    * Replace the tab title.
williamr@4
   192
    *
williamr@4
   193
    * @param  aTabText  New title text.
williamr@4
   194
    */
williamr@4
   195
    void ReplaceTextL( const TDesC& aTabText );
williamr@4
   196
williamr@4
   197
    /**
williamr@4
   198
    * Activate or deactive this tab.
williamr@4
   199
    *
williamr@4
   200
    * @param  aActive   @c ETrue for activation, @c EFalse for deactivation.
williamr@4
   201
    * @param  aDrawNow  Indicates whether control need to be redrawn.
williamr@4
   202
    */
williamr@4
   203
    void SetActive( TBool aActive, TDrawNow aDrawNow );
williamr@4
   204
williamr@4
   205
    /**
williamr@4
   206
    * Determines whether this tab is active.
williamr@4
   207
    *
williamr@4
   208
    * @return @c ETrue if a tab is active, @c EFalse if not.
williamr@4
   209
    */
williamr@4
   210
    TBool Active() const;
williamr@4
   211
williamr@4
   212
    /**
williamr@4
   213
    * Gets tab's ID.
williamr@4
   214
    *
williamr@4
   215
    * @return Tabs' ID.
williamr@4
   216
    */
williamr@4
   217
    TInt Id() const;
williamr@4
   218
williamr@4
   219
    /**
williamr@4
   220
    * Gets this tab's type.
williamr@4
   221
    *
williamr@4
   222
    * @return Tab's type.
williamr@4
   223
    */
williamr@4
   224
    enum TAknTabDataType TabType() const;
williamr@4
   225
williamr@4
   226
williamr@4
   227
    /**
williamr@4
   228
    * Sets the total amount of tabs in the tabgroup where this tab belongs to.
williamr@4
   229
    */
williamr@4
   230
    void SetTotalAmountOfTabs( TInt aAmount );
williamr@4
   231
williamr@4
   232
    /**
williamr@4
   233
    * Sets the narrow tab layout.
williamr@4
   234
    * @internal Used by the UI framework.
williamr@4
   235
    * Applications can set the narrow layout using @c CAknNaviDecorator class.
williamr@4
   236
    */
williamr@4
   237
    void SetNarrowTabLayout( TBool aNarrow );
williamr@4
   238
    
williamr@4
   239
    /**
williamr@4
   240
    * Sets the flag indicating whether or not this tab contains
williamr@4
   241
    * a multi-colored title icon.
williamr@4
   242
    *
williamr@4
   243
    * The multi-color mode should be used with color icons,
williamr@4
   244
    * otherwise the tab icon is drawn using a color
williamr@4
   245
    * defined in the current skin.
williamr@4
   246
    * 
williamr@4
   247
    * @param  aMultiColor  @c ETrue to set the multi-color mode on,
williamr@4
   248
    *                      @c EFalse to turn it off.
williamr@4
   249
    */
williamr@4
   250
    void SetMultiColorMode( TBool aMultiColor );
williamr@4
   251
    
williamr@4
   252
    /**
williamr@4
   253
    * Checks whether or not this tab is drawn using multi-color mode or not.
williamr@4
   254
    *
williamr@4
   255
    * @return @c ETrue if this tab contains a multi-color icon,
williamr@4
   256
    *         @c EFalse otherwise.
williamr@4
   257
    */
williamr@4
   258
    TBool MultiColorMode() const;
williamr@4
   259
    
williamr@4
   260
    /**
williamr@4
   261
    * Sets the long tab layout.
williamr@4
   262
    * @internal Used by the UI framework.
williamr@4
   263
    */
williamr@4
   264
    void SetLongTabLayout( TBool aLongTab );
williamr@4
   265
williamr@4
   266
public: // From base class @c CCoeControl.
williamr@4
   267
williamr@4
   268
    /**
williamr@4
   269
    * Gets the minimum size of the tab.
williamr@4
   270
    *
williamr@4
   271
    * @return Minimum size of the tab.
williamr@4
   272
    */
williamr@4
   273
    virtual TSize MinimumSize();
williamr@4
   274
williamr@4
   275
    /**
williamr@4
   276
    * Sets the tab dimmed.
williamr@4
   277
    *
williamr@4
   278
    * @param  aDimmed  @c ETrue to dim the control,
williamr@4
   279
    *                  @c EFalse to set the control as not dimmed.
williamr@4
   280
    */
williamr@4
   281
    virtual void SetDimmed( TBool aDimmed );
williamr@4
   282
williamr@4
   283
    /**
williamr@4
   284
    * Gets the list of logical colors employed
williamr@4
   285
    * in the drawing of the control, paired with an explanation of how
williamr@4
   286
    * they are used. Appends the list into @c aColorUseList.
williamr@4
   287
    *
williamr@4
   288
    * @param[in,out]  aColorUseList  The color list.
williamr@4
   289
    */
williamr@4
   290
    virtual void GetColorUseListL(
williamr@4
   291
        CArrayFix<TCoeColorUse>& aColorUseList ) const;
williamr@4
   292
williamr@4
   293
protected: // From base class @c CCoeControl.
williamr@4
   294
williamr@4
   295
    /**
williamr@4
   296
    * Responds to size changes events to sets the size and
williamr@4
   297
    * position of the contents of this control.
williamr@4
   298
    */
williamr@4
   299
    virtual void SizeChanged();
williamr@4
   300
williamr@4
   301
    /**
williamr@4
   302
    * Gets the number of controls contained in a compound control.
williamr@4
   303
    *
williamr@4
   304
    * @return The number of component controls contained by this control.
williamr@4
   305
    */
williamr@4
   306
    virtual TInt CountComponentControls() const;
williamr@4
   307
williamr@4
   308
    /**
williamr@4
   309
    * Gets the specified component of a compound control.
williamr@4
   310
    *
williamr@4
   311
    * @param  aIndex  The index of the control to get.
williamr@4
   312
    *
williamr@4
   313
    * @return The component control with an index of @c aIndex.
williamr@4
   314
williamr@4
   315
    */
williamr@4
   316
    virtual CCoeControl* ComponentControl( TInt aIndex ) const;
williamr@4
   317
williamr@4
   318
    /**
williamr@4
   319
    * Handles pointer events.
williamr@4
   320
    * This function is called by framework whenever a pointer event
williamr@4
   321
    * occurs in the control.
williamr@4
   322
    *
williamr@4
   323
    * @param  aPointerEvent  The pointer event.
williamr@4
   324
    */
williamr@4
   325
    virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@4
   326
williamr@4
   327
private: // From base class @c CAknControl.
williamr@4
   328
williamr@4
   329
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@4
   330
williamr@4
   331
private: // From base class @c CCoeControl.
williamr@4
   332
williamr@4
   333
    virtual void Draw( const TRect& aRect ) const;
williamr@4
   334
williamr@4
   335
private:
williamr@4
   336
williamr@4
   337
    CAknTab( TInt aId );
williamr@4
   338
williamr@4
   339
    void ConstructFromResourceL( TResourceReader& aReader );
williamr@4
   340
    
williamr@4
   341
    void ConstructL( const TDesC& aTabText );
williamr@4
   342
    
williamr@4
   343
    void ConstructL( const CFbsBitmap* aTabBitmap,
williamr@4
   344
                     const CFbsBitmap* aMask = NULL );
williamr@4
   345
williamr@4
   346
    void LoadColorBitmapL();
williamr@4
   347
williamr@4
   348
    /**
williamr@4
   349
    * Handles a change to the control's resources.
williamr@4
   350
    *
williamr@4
   351
    * @param  aType  The event type.
williamr@4
   352
    */
williamr@4
   353
    void HandleResourceChange( TInt aType );
williamr@4
   354
williamr@4
   355
    void SizeChangedInNormalLayout();
williamr@4
   356
    void SizeChangedInFlatLayout();
williamr@4
   357
    void SizeChangedInNarrowLayout();
williamr@4
   358
williamr@4
   359
private:
williamr@4
   360
williamr@4
   361
    CEikLabel* iLabel;
williamr@4
   362
    TInt       iId;
williamr@4
   363
    TBool      iActive;
williamr@4
   364
williamr@4
   365
    const CFbsBitmap* iBitmap;
williamr@4
   366
    const CFbsBitmap* iBitmapMask;
williamr@4
   367
    TAknLayoutRect    iBitmapRect;
williamr@4
   368
williamr@4
   369
    CAknTabExtension* iExtension;
williamr@4
   370
    
williamr@4
   371
    typedef CArrayPtrFlat<CFbsBitmap> CAknTabColorBitmapArray;
williamr@4
   372
    CAknTabColorBitmapArray* iColorBitmaps;
williamr@4
   373
    };
williamr@4
   374
williamr@4
   375
williamr@4
   376
/**
williamr@4
   377
* Tab group functionality for navigation pane.
williamr@4
   378
*
williamr@4
   379
* @lib avkon.lib
williamr@4
   380
* @since 0.9
williamr@4
   381
*/
williamr@4
   382
class CAknTabGroup : public CAknControl,
williamr@4
   383
                     public MCoeControlObserver,
williamr@4
   384
                     public MCoeControlContext,
williamr@4
   385
                     public MAknNaviDecoratorObserver
williamr@4
   386
    {
williamr@4
   387
public:
williamr@4
   388
    /**
williamr@4
   389
    * Destructor.
williamr@4
   390
    */
williamr@4
   391
    IMPORT_C ~CAknTabGroup();
williamr@4
   392
williamr@4
   393
    /**
williamr@4
   394
    * Creates new tab group.
williamr@4
   395
    *
williamr@4
   396
    * @param  aParent  Parent control.
williamr@4
   397
    */
williamr@4
   398
    IMPORT_C static CAknTabGroup* NewL( const CCoeControl& aParent );
williamr@4
   399
williamr@4
   400
    /**
williamr@4
   401
    * Creates new tab group and pushes it to the clean up stack.
williamr@4
   402
    *
williamr@4
   403
    * @param  aParent  Parent control.
williamr@4
   404
    */
williamr@4
   405
    IMPORT_C static CAknTabGroup* NewLC( const CCoeControl& aParent );
williamr@4
   406
williamr@4
   407
public:
williamr@4
   408
williamr@4
   409
    /**
williamr@4
   410
    * Add a tab to the tab group from resources.
williamr@4
   411
    *
williamr@4
   412
    * @param  aReader  Resource reader.
williamr@4
   413
    *
williamr@4
   414
    * @return ID of the added tab.
williamr@4
   415
    */
williamr@4
   416
    IMPORT_C TInt AddTabL( TResourceReader& aReader );
williamr@4
   417
williamr@4
   418
    /**
williamr@4
   419
    * Add a tab to the tab group.
williamr@4
   420
    *
williamr@4
   421
    * @param  aTabId    ID of the tab to be added.
williamr@4
   422
    * @param  aTabText  Text for the tab.
williamr@4
   423
    */
williamr@4
   424
    IMPORT_C void AddTabL( TInt aTabId, const TDesC& aText );
williamr@4
   425
williamr@4
   426
    /**
williamr@4
   427
    * Add a tab to the tab group.
williamr@4
   428
    *
williamr@4
   429
    * @param  aTabId      ID of the tab.
williamr@4
   430
    * @param  aTabText    Text for the tab.
williamr@4
   431
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   432
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   433
    */
williamr@4
   434
    IMPORT_C void AddTabL( TInt aTabId,
williamr@4
   435
                           const TDesC& aText,
williamr@4
   436
                           const CFbsBitmap* aTabBitmap,
williamr@4
   437
                           const CFbsBitmap* aMask = NULL );
williamr@4
   438
williamr@4
   439
    /**
williamr@4
   440
    * Add a tab to the tab group.
williamr@4
   441
    *
williamr@4
   442
    * @param  aTabId      ID of the tab.
williamr@4
   443
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   444
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   445
    */
williamr@4
   446
    IMPORT_C void AddTabL( TInt aTabId,
williamr@4
   447
                           const CFbsBitmap* aTabBitmap,
williamr@4
   448
                           const CFbsBitmap* aMask = NULL );
williamr@4
   449
    /**
williamr@4
   450
    * Replaces a tab with a new one from resources.
williamr@4
   451
    * Tab with same ID is replaced.
williamr@4
   452
    *
williamr@4
   453
    * @param  aReader  Resource reader.
williamr@4
   454
    */
williamr@4
   455
    IMPORT_C void ReplaceTabL( TResourceReader& aReader );
williamr@4
   456
williamr@4
   457
    /**
williamr@4
   458
    * Replaces a tab with a new one.
williamr@4
   459
    *
williamr@4
   460
    * @param  aTabId    ID of the tab to be replaced.
williamr@4
   461
    * @param  aTabText  Text for the new tab.
williamr@4
   462
    */
williamr@4
   463
    IMPORT_C void ReplaceTabL( TInt aTabId, const TDesC& aText );
williamr@4
   464
williamr@4
   465
    /**
williamr@4
   466
    * Replaces a tab with a new one.
williamr@4
   467
    *
williamr@4
   468
    * @param  aTabId      ID of the tab to be replaced.
williamr@4
   469
    * @param  aTabText    Text for the new tab.
williamr@4
   470
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   471
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   472
    */
williamr@4
   473
    IMPORT_C void ReplaceTabL( TInt aTabId,
williamr@4
   474
                               const TDesC& aText,
williamr@4
   475
                               const CFbsBitmap* aTabBitmap,
williamr@4
   476
                               const CFbsBitmap* aMask = NULL );
williamr@4
   477
williamr@4
   478
    /**
williamr@4
   479
    * Replaces a tab with a new one.
williamr@4
   480
    *
williamr@4
   481
    * @param  aTabId      ID of the tab to be replaced.
williamr@4
   482
    * @param  aTabBitmap  Bitmap for the tab. Ownership of the bitmap is taken.
williamr@4
   483
    * @param  aMask       Bitmap's mask. Ownership of the mask is taken.
williamr@4
   484
    */
williamr@4
   485
    IMPORT_C void ReplaceTabL( TInt aTabId,
williamr@4
   486
                               const CFbsBitmap* aTabBitmap,
williamr@4
   487
                               const CFbsBitmap* aMask = NULL );
williamr@4
   488
williamr@4
   489
    /**
williamr@4
   490
    * Replaces a tab text with a new one.
williamr@4
   491
    *
williamr@4
   492
    * @param  aTabId    ID of the tab containing the text to be replaced.
williamr@4
   493
    * @param  aTabText  New tab text.
williamr@4
   494
    */
williamr@4
   495
    IMPORT_C void ReplaceTabTextL( TInt aTabId, const TDesC& aTabText );
williamr@4
   496
williamr@4
   497
    /**
williamr@4
   498
    * Delete a tab from the tab group.
williamr@4
   499
    *
williamr@4
   500
    * @param  aTabId  ID of the tab to be deleted.
williamr@4
   501
    */
williamr@4
   502
    IMPORT_C void DeleteTabL( TInt aTabId );
williamr@4
   503
williamr@4
   504
    /**
williamr@4
   505
    * Activate (highlight) a tab.
williamr@4
   506
    *
williamr@4
   507
    * @param  aTabId  ID of the tab to be highlighted.
williamr@4
   508
    */
williamr@4
   509
    IMPORT_C void SetActiveTabById( TInt aTabId );
williamr@4
   510
williamr@4
   511
    /**
williamr@4
   512
    * Activate (highlight) a tab.
williamr@4
   513
    *
williamr@4
   514
    * @param  aTabIndex  Index of the tab to be highlighted.
williamr@4
   515
    */
williamr@4
   516
    IMPORT_C void SetActiveTabByIndex( TInt aTabIndex );
williamr@4
   517
williamr@4
   518
    /**
williamr@4
   519
    * Returns the ID of the currently active (highlighted) tab.
williamr@4
   520
    *
williamr@4
   521
    * @return ID of the highlighted tab.
williamr@4
   522
    */
williamr@4
   523
    IMPORT_C TInt ActiveTabId() const;
williamr@4
   524
williamr@4
   525
    /**
williamr@4
   526
    * Returns the index of the currently active (highlighted) tab.
williamr@4
   527
    *
williamr@4
   528
    * @return Index of the highlighted tab.
williamr@4
   529
    */
williamr@4
   530
    IMPORT_C TInt ActiveTabIndex() const;
williamr@4
   531
williamr@4
   532
    /**
williamr@4
   533
    * Set width of each tab.
williamr@4
   534
    * This width determines what tab layout is used.
williamr@4
   535
    * To get a specific tab layout, use the following constants:
williamr@4
   536
    *  - KTabWidthWithOneTab         One tab layout
williamr@4
   537
    *  - KTabWidthWithTwoTabs        Two tabs layout
williamr@4
   538
    *  - KTabWidthWithThreeTabs      Three tabs layout
williamr@4
   539
    *  - KTabWidthWithFourTabs       Four tabs layout
williamr@4
   540
    *  - KTabWidthWithTwoLongTabs    Two long tabs layout
williamr@4
   541
    *  - KTabWidthWithThreeLongTabs  Three long tabs layout
williamr@4
   542
    *
williamr@4
   543
    * @param  aWidth  Width of each tab, @see aknconsts.h.
williamr@4
   544
    */
williamr@4
   545
    IMPORT_C void SetTabFixedWidthL( TInt aWidth );
williamr@4
   546
    
williamr@4
   547
    /**
williamr@4
   548
    * Sets a tab dimmed/not dimmed.
williamr@4
   549
    *
williamr@4
   550
    * @param  aTabId   ID of the tab.
williamr@4
   551
    * @param  aDimmed  @c ETrue to set the tab dimmed,
williamr@4
   552
    *                  @c EFalse otherwise.
williamr@4
   553
    */
williamr@4
   554
    IMPORT_C void DimTab( TInt aTabId, TBool aDimmed );
williamr@4
   555
    
williamr@4
   556
    /**
williamr@4
   557
    * Used to check whether or not a tab is dimmed.
williamr@4
   558
    *
williamr@4
   559
    * @param  aTabId  ID of the tab.
williamr@4
   560
    *
williamr@4
   561
    * @return @c ETrue if the tab is dimmed, @c EFalse otherwise.
williamr@4
   562
    */
williamr@4
   563
    IMPORT_C virtual TBool IsTabDimmed( TInt aTabId ) const;
williamr@4
   564
williamr@4
   565
    /**
williamr@4
   566
    * Returns the index of a tab.
williamr@4
   567
    *
williamr@4
   568
    * @param  aTabId  ID of a tab.
williamr@4
   569
    *
williamr@4
   570
    * @return Index of the tab.
williamr@4
   571
    */
williamr@4
   572
    IMPORT_C virtual TInt TabIndexFromId( TInt aTabId ) const;
williamr@4
   573
williamr@4
   574
    /**
williamr@4
   575
    * Returns the ID of a tab.
williamr@4
   576
    *
williamr@4
   577
    * @param  aTabIndex  Index of a tab.
williamr@4
   578
    *
williamr@4
   579
    * @return ID of the tab.
williamr@4
   580
    */
williamr@4
   581
    IMPORT_C virtual TInt TabIdFromIndex( TInt aTabIndex ) const;
williamr@4
   582
williamr@4
   583
    /**
williamr@4
   584
    * Number of tabs in the tab group.
williamr@4
   585
    *
williamr@4
   586
    * @return  Number of tabs in the tab group.
williamr@4
   587
    */
williamr@4
   588
    IMPORT_C virtual TInt TabCount() const;
williamr@4
   589
williamr@4
   590
    /**
williamr@4
   591
    * Sets the tab observer for this tab group.
williamr@4
   592
    *
williamr@4
   593
    * @param  aObserver  Tab observer to set.
williamr@4
   594
    */
williamr@4
   595
    IMPORT_C void SetObserver( MAknTabObserver* aObserver );
williamr@4
   596
williamr@4
   597
public: // From base class @c CCoeControl.
williamr@4
   598
williamr@4
   599
    /**
williamr@4
   600
    * Return minimum size of the control.
williamr@4
   601
    *
williamr@4
   602
    * @return Minimum size of the control.
williamr@4
   603
    */
williamr@4
   604
    IMPORT_C virtual TSize MinimumSize();
williamr@4
   605
williamr@4
   606
    /**
williamr@4
   607
    * Handles key events.
williamr@4
   608
    *
williamr@4
   609
    * @param  aKeyEvent  The key event.
williamr@4
   610
    * @param  aType      The type of the event.
williamr@4
   611
    *
williamr@4
   612
    * @return Indicates whether or not the key event was used by this control.
williamr@4
   613
    */
williamr@4
   614
    IMPORT_C virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
williamr@4
   615
                                                  TEventCode aType );
williamr@4
   616
williamr@4
   617
    /**
williamr@4
   618
    * Gets the list of logical colors employed in the drawing of the control,
williamr@4
   619
    * paired with an explanation of how they are used.
williamr@4
   620
    * Appends the list into @c aColorUseList.
williamr@4
   621
    *
williamr@4
   622
    * @param[in,out]  aColorUseList  The color list.
williamr@4
   623
    */
williamr@4
   624
    IMPORT_C virtual void GetColorUseListL(
williamr@4
   625
        CArrayFix<TCoeColorUse>& aColorUseList ) const;
williamr@4
   626
williamr@4
   627
    /**
williamr@4
   628
    * Handles a change to the control's resources.
williamr@4
   629
    *
williamr@4
   630
    * @param  aType  The type of resource change.
williamr@4
   631
    */
williamr@4
   632
    void HandleResourceChange( TInt aType );
williamr@4
   633
williamr@4
   634
    /**
williamr@4
   635
    * Handles pointer events in tabs.
williamr@4
   636
    *
williamr@4
   637
    * @param  aPointerEvent  Pointer event to be handled.
williamr@4
   638
    */
williamr@4
   639
    IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@4
   640
williamr@4
   641
public: // From base class @c MCoeControlObserver.
williamr@4
   642
williamr@4
   643
    /**
williamr@4
   644
    * Handles an event from an observed control.
williamr@4
   645
    *
williamr@4
   646
    * @param  aControl    Control that caused the event.
williamr@4
   647
    * @param  aEventType  Type of the event.
williamr@4
   648
    */
williamr@4
   649
    IMPORT_C virtual void HandleControlEventL( CCoeControl* aControl,
williamr@4
   650
                                               TCoeEvent aEventType );
williamr@4
   651
williamr@4
   652
public: // From base class @c MCoeControlContext.
williamr@4
   653
williamr@4
   654
    /**
williamr@4
   655
    * Allows to modify graphics context before Draw.
williamr@4
   656
    *
williamr@4
   657
    * @param  aGc  Graphics context to be modified.
williamr@4
   658
    */
williamr@4
   659
    IMPORT_C virtual void PrepareContext( CWindowGc& aGc ) const;
williamr@4
   660
williamr@4
   661
public: // From base class @c MAknNaviDecoratorObserver.
williamr@4
   662
williamr@4
   663
    /*
williamr@4
   664
    * Handles events from navi decorator parent control.
williamr@4
   665
    *
williamr@4
   666
    * @param  aEventID  ID of event to be handled.
williamr@4
   667
    */
williamr@4
   668
    IMPORT_C virtual void HandleNaviDecoratorEventL( TInt aEventID );
williamr@4
   669
williamr@4
   670
protected: // From base class @c CCoeControl.
williamr@4
   671
williamr@4
   672
    /**
williamr@4
   673
    * Handles the size change events.
williamr@4
   674
    */
williamr@4
   675
    IMPORT_C virtual void SizeChanged();
williamr@4
   676
williamr@4
   677
    /**
williamr@4
   678
    * Returns number of controls inside this control.
williamr@4
   679
    *
williamr@4
   680
    * @return Number of component controls.
williamr@4
   681
    */
williamr@4
   682
    IMPORT_C virtual TInt CountComponentControls() const;
williamr@4
   683
williamr@4
   684
    /**
williamr@4
   685
    * Returns a component control determined by control index.
williamr@4
   686
    *
williamr@4
   687
    * @param  aIndex  Index of a control to be returned.
williamr@4
   688
    *
williamr@4
   689
    * @return Pointer to the control.
williamr@4
   690
    */
williamr@4
   691
    IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
williamr@4
   692
williamr@4
   693
    /**
williamr@4
   694
    * This is called when the focus is changed.
williamr@4
   695
    *
williamr@4
   696
    * @param  aDrawNow  Whether or not to draw the control.
williamr@4
   697
    */
williamr@4
   698
    IMPORT_C virtual void FocusChanged( TDrawNow aDrawNow );
williamr@4
   699
williamr@4
   700
    /**
williamr@4
   701
    * Reverse the order of tabs in tab array.
williamr@4
   702
    */
williamr@4
   703
    void ReverseTabOrderL();
williamr@4
   704
    
williamr@4
   705
private:
williamr@4
   706
williamr@4
   707
    /*
williamr@4
   708
    * Reserved
williamr@4
   709
    */
williamr@4
   710
    IMPORT_C virtual void Reserved1();
williamr@4
   711
williamr@4
   712
    /*
williamr@4
   713
    * Reserved
williamr@4
   714
    */
williamr@4
   715
    IMPORT_C virtual void Reserved2();
williamr@4
   716
williamr@4
   717
    /*
williamr@4
   718
    * Reserved
williamr@4
   719
    */
williamr@4
   720
    IMPORT_C virtual void Reserved3();
williamr@4
   721
williamr@4
   722
williamr@4
   723
private:
williamr@4
   724
    IMPORT_C CAknTabGroup();
williamr@4
   725
williamr@4
   726
    /**
williamr@4
   727
    * Tab groups can be mirrored depending on current locale. To client
williamr@4
   728
    * application everything always seems like tabs are not mirrored but
williamr@4
   729
    * the internal order of tabs in tab group may or may not be mirrored.
williamr@4
   730
    * If mirroring is off then this function just returns given
williamr@4
   731
    * parameter as it is. If mirroring is on then this function returns
williamr@4
   732
    * unmirrored index if given index was mirrord and vice versa. Two
williamr@4
   733
    * nested calls to this function cancels its effect
williamr@4
   734
    * (ConvertTabIndex(ConvertTabIndex(aIndex)) == aIndex).
williamr@4
   735
    *
williamr@4
   736
    * @param  aIndex  Index to be converted.
williamr@4
   737
    * @return Converted index.
williamr@4
   738
    */
williamr@4
   739
    TInt ConvertTabIndex(TInt aIndex) const;
williamr@4
   740
williamr@4
   741
private: // From base class @c CCoeControl.
williamr@4
   742
williamr@4
   743
    IMPORT_C virtual void Draw( const TRect& aRect ) const;
williamr@4
   744
williamr@4
   745
private: // From base class @c CAknControl.
williamr@4
   746
williamr@4
   747
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@4
   748
    
williamr@4
   749
public: // New methods
williamr@4
   750
williamr@4
   751
    /**
williamr@4
   752
    * Sets the multi-color drawing mode of a tab.
williamr@4
   753
    * This should be called after adding a tab to the tab group
williamr@4
   754
    * if the icon in the tab should be drawn as multi-colored.
williamr@4
   755
    * The tab icon will be drawn using a color specified in the
williamr@4
   756
    * active skin if multi-color mode is not defined.
williamr@4
   757
    *
williamr@4
   758
    * This function should be called right after a tab containing
williamr@4
   759
    * a multi-color icon is added to the tab group.
williamr@4
   760
    * 
williamr@4
   761
    * @param  aTabId       ID of the tab.
williamr@4
   762
    * @param  aMultiColor  @c ETrue to set the multi-color mode on,
williamr@4
   763
    *                      @c EFalse to turn it off.
williamr@4
   764
    */
williamr@4
   765
    IMPORT_C void SetTabMultiColorMode( TInt aTabId, TBool aMultiColor );
williamr@4
   766
williamr@4
   767
    /** Directions in which the tab group focus can be moved. */
williamr@4
   768
    enum TDirection
williamr@4
   769
        {
williamr@4
   770
        ELeft,
williamr@4
   771
        ERight
williamr@4
   772
        };
williamr@4
   773
williamr@4
   774
private:
williamr@4
   775
    void ConstructL();
williamr@4
   776
    void CommonAddTabL(CAknTab* aTab);
williamr@4
   777
    void CommonReplaceTabL(CAknTab* aTab);
williamr@4
   778
    void HandleTabStateChanged(CCoeControl* aControl);
williamr@4
   779
    TInt Index(TInt aTabId) const;
williamr@4
   780
    TBool CycleFocus(TDirection aDirection,TDrawNow aDrawNow);
williamr@4
   781
    TInt LeftMostTabIndex() const;
williamr@4
   782
    TInt RightMostTabIndex() const;
williamr@4
   783
    void DrawLowerBorder(TDrawNow aDrawNow) const;
williamr@4
   784
    void DoDrawLowerBorder() const;
williamr@4
   785
    void ReportNavigationEvent();
williamr@4
   786
    void LoadTabBitmapsL(TInt aNumberOfTabsShown, TBool aLongTabs);
williamr@4
   787
    TBool TabsVisibleInCurrentLayout() const;
williamr@4
   788
    void CurrentLayout( TAknWindowLineLayout& aLayout ) const;
williamr@4
   789
    void InitTabGroupGraphicsL();
williamr@4
   790
williamr@4
   791
    void InitTabAnimationEventTimer();
williamr@4
   792
    void CancelTabAnimationEventTimer();
williamr@4
   793
    static TInt TabAnimationEvent(TAny * aPtr);
williamr@4
   794
    void DoTabAnimationEvent();
williamr@4
   795
williamr@4
   796
    TBool NarrowTabLayoutNext();
williamr@4
   797
    TBool NarrowTabLayout();
williamr@4
   798
williamr@4
   799
public:
williamr@4
   800
williamr@4
   801
    /**
williamr@4
   802
    * Sets the navigation decorator layout so that it corresponds
williamr@4
   803
    * the current tab group layout.
williamr@4
   804
    * 
williamr@4
   805
    * @param  aNarrow  @c ETrue if narrow tab group layout is used,
williamr@4
   806
    *                  @c EFalse if normal layout is used.
williamr@4
   807
    */
williamr@4
   808
    void SetDecoratorLayout( TBool aNarrow );
williamr@4
   809
williamr@4
   810
private:
williamr@4
   811
williamr@4
   812
    void SizeChangedInNormalLayout();
williamr@4
   813
    void SizeChangedInFlatLayout();
williamr@4
   814
    void SizeChangedInNarrowLayout();
williamr@4
   815
    void InitTabAnimationL();
williamr@4
   816
    
williamr@4
   817
williamr@4
   818
    /**
williamr@4
   819
    * Gets the rectangle for the tab group.
williamr@4
   820
    * If the tab arrows are not shown, then the tab group gets a wider
williamr@4
   821
    * rectangle.
williamr@4
   822
    *
williamr@4
   823
    * @param  aArrowsUsed  @c ETrue if tab arrows are shown,
williamr@4
   824
    *                      @c EFalse otherwise.
williamr@4
   825
    */
williamr@4
   826
    static TRect ParentRect( TBool aArrowsUsed );
williamr@4
   827
    
williamr@4
   828
    /**
williamr@4
   829
    * @internal Used by the UI framework.
williamr@4
   830
    *
williamr@4
   831
    * Starts the animation shown when tab focus is cycled.
williamr@4
   832
    * Note that this starts the animation only when required, i.e.
williamr@4
   833
    * when layout that needs cycle animation is used and when the first
williamr@4
   834
    * shown tab in the tab group changes.
williamr@4
   835
    *
williamr@4
   836
    * @param  aDirection  Direction which the focus in cycled to.
williamr@4
   837
    * @param  aNewTab     Index of the tab that receives the focus.
williamr@4
   838
    */
williamr@4
   839
    void StartCycleAnimationL( TDirection aDirection, TInt aNewTab );
williamr@4
   840
    
williamr@4
   841
    /**
williamr@4
   842
    * Called on the dynamic layout switch event, switches the current tab
williamr@4
   843
    * layout to a corresponding one that is usable in the new layout.
williamr@4
   844
    */ 
williamr@4
   845
    void SwitchTabLayoutL();
williamr@4
   846
williamr@4
   847
public:
williamr@4
   848
williamr@4
   849
    /**
williamr@4
   850
    * @internal Used by the UI framework.
williamr@4
   851
    * Applications can set the narrow layout using @c CAknNaviDecorator class.
williamr@4
   852
    */
williamr@4
   853
    void SetNarrowTabLayoutL( TBool aNarrow, TBool aUseAnimation = EFalse );
williamr@4
   854
    
williamr@4
   855
    /**
williamr@4
   856
    * @internal Used by the UI framework.
williamr@4
   857
    *
williamr@4
   858
    * Sets the tab arrows' visibility.
williamr@4
   859
    *
williamr@4
   860
    * @param  aVisible  @c ETrue to set the arrows visible,
williamr@4
   861
    *                   @c EFalse to hide them.
williamr@4
   862
    */
williamr@4
   863
    void SetNaviArrowsVisible( TBool aVisible );
williamr@4
   864
williamr@4
   865
private:
williamr@4
   866
    CArrayPtr<CAknTab>*     iTabArray;
williamr@4
   867
    TInt                    iActiveTab;
williamr@4
   868
    TRect                   iSpareRect;
williamr@4
   869
williamr@4
   870
    TInt                    iTabFixedWidth;
williamr@4
   871
    TBool                   iLongTabs;
williamr@4
   872
    TInt                    iNumberOfTabsShown;
williamr@4
   873
    TInt                    iFirstShownTab;
williamr@4
   874
williamr@4
   875
    CFbsBitmap*             iTabBitmaps[KTabNumberOfTabBitmaps];
williamr@4
   876
    CFbsBitmap*             iTabMaskBitmaps[KTabNumberOfTabBitmaps];
williamr@4
   877
williamr@4
   878
    TInt                    iBitmapNames[KTabNumberOfTabBitmaps];
williamr@4
   879
    TInt                    iBitmapMaskNames[KTabNumberOfTabBitmaps];
williamr@4
   880
    CAknTabGroupExtension*  iExtension;
williamr@4
   881
williamr@4
   882
    MAknTabObserver*        iTabObserver;
williamr@4
   883
    TBool                   iMirrored;
williamr@4
   884
    };
williamr@4
   885
williamr@4
   886
#endif // AKNTABGRP_H