epoc32/include/mw/eikbtgpc.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  EIKON button group container class definition.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef __EIKBTGPC_H__
williamr@2
    20
#define __EIKBTGPC_H__
williamr@2
    21
williamr@2
    22
#include <coecntrl.h>
williamr@2
    23
#include <eikbtgrp.h>
williamr@2
    24
#include <eikcmobs.h>
williamr@2
    25
#include <lafpublc.h>
williamr@2
    26
#include <uikon.hrh>
williamr@2
    27
williamr@2
    28
#include <akncontrol.h>
williamr@2
    29
williamr@2
    30
class MEikCommandObserver;
williamr@2
    31
class CEikButtonGroupStack;
williamr@2
    32
class CEikCommandButton;
williamr@2
    33
class CEikListBox;
williamr@2
    34
williamr@2
    35
/**
williamr@2
    36
 * The CEikButtonGroupContainer class provides a wrapper around the different button arrays
williamr@2
    37
 * used in pen and no-pen devices. 
williamr@2
    38
 *
williamr@2
    39
 * @lib eikcoctl.lib 
williamr@2
    40
 * @since S60 0.9 
williamr@2
    41
 */
williamr@2
    42
NONSHARABLE_CLASS(CEikButtonGroupContainer) : public CAknControl, public MEikCommandObserver
williamr@2
    43
    {
williamr@2
    44
public:
williamr@2
    45
    /** 
williamr@2
    46
     * Declares an object type for a class, in order to allow the object
williamr@2
    47
     * provider mechanism to locate and provide objects from the class.
williamr@2
    48
     */
williamr@2
    49
    DECLARE_TYPE_ID(0x101F4107)
williamr@2
    50
williamr@2
    51
    /**
williamr@2
    52
     * Describes how the container is being used.
williamr@2
    53
     *
williamr@2
    54
     * The enumeration is used by the system to create the appropriate (UI variant-specific)
williamr@2
    55
     * button group for the specified type.
williamr@2
    56
     */
williamr@2
    57
    enum TUse
williamr@2
    58
        {
williamr@2
    59
        EView          = SLafButtonGroupContainer::EView,         ///< In a view.
williamr@2
    60
        EDialog        = SLafButtonGroupContainer::EDialog,       ///< In a dialog.
williamr@2
    61
        EToolbar       = SLafButtonGroupContainer::EToolbar,      ///< In a toolbar.
williamr@2
    62
        ECba           = SLafButtonGroupContainer::ECba,          ///< In a control button array.
williamr@2
    63
        EDialogButtons = SLafButtonGroupContainer::EDialogButtons ///< In dialog buttons.
williamr@2
    64
        };
williamr@2
    65
        
williamr@2
    66
    /**
williamr@2
    67
     * Describes the orientation of the container.
williamr@2
    68
     */        
williamr@2
    69
    enum TOrientation
williamr@2
    70
        {
williamr@2
    71
        EVertical   = SLafButtonGroupContainer::EVertical,  ///< Buttons are laid out vertically.
williamr@2
    72
        EHorizontal = SLafButtonGroupContainer::EHorizontal ///< Buttons are laid out horizontally.
williamr@2
    73
        };
williamr@2
    74
        
williamr@2
    75
    /**
williamr@2
    76
     * Relative positions of the container and the control which uses it.
williamr@2
    77
     */        
williamr@2
    78
    enum TLocation
williamr@2
    79
        {
williamr@2
    80
        /** The button group is internal to the control which is using it. E.g. dialog buttons. */
williamr@2
    81
        EInternal   = SLafButtonGroupContainer::EInternal, 
williamr@2
    82
        
williamr@2
    83
        /** The button group is external to the control which is using it. E.g. toolbar or cba. */
williamr@2
    84
        EExternal   = SLafButtonGroupContainer::EExternal  
williamr@2
    85
        };
williamr@2
    86
        
williamr@2
    87
    /**
williamr@2
    88
     * Flags for the display of hotkeys.
williamr@2
    89
     */        
williamr@2
    90
    enum THotKeyFlags
williamr@2
    91
        {
williamr@2
    92
        EShowHotKey      = 0x01, ///< Hotkeys for commands should be shown.
williamr@2
    93
        EPlainHotKey     = 0x02  ///< Hotkeys for commands should not be shown.
williamr@2
    94
        };
williamr@2
    95
        
williamr@2
    96
    /** 
williamr@2
    97
     * Additional flags.
williamr@2
    98
     */         
williamr@2
    99
    enum TFlags
williamr@2
   100
        {
williamr@2
   101
        EAddToStack      = 0x01, ///< Not used.
williamr@2
   102
        EDelayActivation = 0x02, ///< If set, the container is not activated during construction.
williamr@2
   103
        EUseMaxSize      = 0x04  ///< Not used.
williamr@2
   104
        };
williamr@2
   105
        
williamr@2
   106
    /**
williamr@2
   107
     * Defines the positions for each command.   
williamr@2
   108
     */   
williamr@2
   109
    enum TCommandPosition
williamr@2
   110
        {
williamr@2
   111
        ELeftSoftkeyPosition    = 0, ///< Position for left softkey.
williamr@2
   112
        ERightSoftkeyPosition   = 2, ///< Position for right softkey.
williamr@2
   113
        EMiddleSoftkeyPosition  = 3  ///< Position for middle softkey.
williamr@2
   114
        };
williamr@2
   115
        
williamr@2
   116
public:
williamr@2
   117
    /**
williamr@2
   118
     * Creates a button group container in its own window.
williamr@2
   119
     *
williamr@2
   120
     * @param aUse The button group's type. 
williamr@2
   121
     * @param aOrientation The button group's orientation. You need specify this 
williamr@2
   122
     *                     only for devices that can layout their buttons either 
williamr@2
   123
     *                     horizontally or vertically.
williamr@2
   124
     * @param aCommandObserver A command observer to be notified of commands on 
williamr@2
   125
     *                         the container.
williamr@2
   126
     * @param aResourceId A resource containing descriptions of buttons in the group. 
williamr@2
   127
     *                    This can be NULL if buttons are to be added dynamically.
williamr@2
   128
     * @param aFlags The button group's flags.
williamr@2
   129
     * @return Button group container object.
williamr@2
   130
     */ 
williamr@2
   131
    IMPORT_C static CEikButtonGroupContainer* NewL(
williamr@2
   132
        TUse aUse,
williamr@2
   133
        TOrientation aOrientation,
williamr@2
   134
        MEikCommandObserver* aCommandObserver,
williamr@2
   135
        TInt aResourceId,
williamr@2
   136
        TUint aFlags = EAddToStack);
williamr@2
   137
williamr@2
   138
    /**
williamr@2
   139
     * Creates a button group container in its parent control's window.
williamr@2
   140
     *
williamr@2
   141
     * @param aUse The button group's type.
williamr@2
   142
     * @param aOrientation The button group's orientation. You need specify this 
williamr@2
   143
     *                     only for devices that can layout their buttons either 
williamr@2
   144
     *                     horizontally or vertically.
williamr@2
   145
     * @param aCommandObserver A command observer to be notified of commands on 
williamr@2
   146
     *                         the container.
williamr@2
   147
     * @param aResourceId A resource containing descriptions of buttons in the group. 
williamr@2
   148
     *                    This can be NULL if buttons are to be added dynamically.
williamr@2
   149
     * @param aParent The control's parent.
williamr@2
   150
     * @param aFlags The button group's flags.
williamr@2
   151
     * @return Button group container object.
williamr@2
   152
     */         
williamr@2
   153
    IMPORT_C static CEikButtonGroupContainer* NewL(
williamr@2
   154
        TUse aUse,
williamr@2
   155
        TOrientation aOrientation,
williamr@2
   156
        MEikCommandObserver* aCommandObserver,
williamr@2
   157
        TInt aResourceId,
williamr@2
   158
        const CCoeControl& aParent,
williamr@2
   159
        TUint aFlags = EAddToStack);
williamr@2
   160
williamr@2
   161
    /**
williamr@2
   162
     * Creates a button group container in given window group.
williamr@2
   163
     *
williamr@2
   164
     * @param aUse The button group's type.
williamr@2
   165
     * @param aOrientation The button group's orientation. You need specify this 
williamr@2
   166
     *                     only for devices that can layout their buttons either 
williamr@2
   167
     *                     horizontally or vertically.
williamr@2
   168
     * @param aCommandObserver A command observer to be notified of commands on 
williamr@2
   169
     *                         the container.
williamr@2
   170
     * @param aResourceId A resource containing descriptions of buttons in the group. 
williamr@2
   171
     *                    This can be NULL if buttons are to be added dynamically.
williamr@2
   172
     * @param aParentWg The parent window group.
williamr@2
   173
     * @param aFlags The button group's flags.
williamr@2
   174
     * @return Button group container object.
williamr@2
   175
     */        
williamr@2
   176
    IMPORT_C static CEikButtonGroupContainer* NewL(
williamr@2
   177
        TUse aUse,
williamr@2
   178
        TOrientation aOrientation,
williamr@2
   179
        MEikCommandObserver* aCommandObserver,
williamr@2
   180
        TInt aResourceId,
williamr@2
   181
        RWindowGroup& aParentWg,
williamr@2
   182
        TUint aFlags = EAddToStack);
williamr@2
   183
williamr@2
   184
    /**
williamr@2
   185
     * Destructor.
williamr@2
   186
     */        
williamr@2
   187
    IMPORT_C ~CEikButtonGroupContainer();
williamr@2
   188
williamr@2
   189
    /**
williamr@2
   190
     * Gets a pointer to an application's currently active CEikButtonGroupContainer (if any).
williamr@2
   191
     *
williamr@2
   192
     * Returns NULL if there are no containers active or none suitable for sharing. 
williamr@2
   193
     * Ownership of the returned pointer is not transferred.
williamr@2
   194
     *
williamr@2
   195
     * @return Pointer to the button group container.
williamr@2
   196
     */    
williamr@2
   197
    IMPORT_C static CEikButtonGroupContainer* Current();
williamr@2
   198
    
williamr@2
   199
public:
williamr@2
   200
    /**
williamr@2
   201
     * Sets a command button's text label and command ID.
williamr@2
   202
     *
williamr@2
   203
     * @param aPosition The position within the button group of the button to change.
williamr@2
   204
     *                  If the position is out of range this function raises a panic.
williamr@2
   205
     * @param aCommandId Command ID the button will send.
williamr@2
   206
     * @param aText Text for the button.
williamr@2
   207
     */
williamr@2
   208
    inline void SetCommandL(
williamr@2
   209
        TInt aPosition, 
williamr@2
   210
        TInt aCommandId, 
williamr@2
   211
        const TDesC& aText);
williamr@2
   212
williamr@2
   213
    /**
williamr@2
   214
     * Sets a command button's bitmap and command ID.
williamr@2
   215
     *
williamr@2
   216
     * @param aPosition The position within the button group of the button to change. 
williamr@2
   217
     *                  If the position is out of range this function raises a panic.
williamr@2
   218
     * @param aCommandId Command ID the button will send.
williamr@2
   219
     * @param aBitmap The bitmap for the button.
williamr@2
   220
     * @param aMask The mask bitmap for aBitmap.
williamr@2
   221
     */    
williamr@2
   222
    inline void SetCommandL(
williamr@2
   223
        TInt aPosition, 
williamr@2
   224
        TInt aCommandId, 
williamr@2
   225
        const CFbsBitmap& aBitmap,
williamr@2
   226
        const CFbsBitmap& aMask);
williamr@2
   227
williamr@2
   228
    /**
williamr@2
   229
     * Sets a command button's bitmap, text and command ID.
williamr@2
   230
     *
williamr@2
   231
     * @param aPosition The position within the button group of the button to change. 
williamr@2
   232
     *                  If the position is out of range, the function raises a panic.
williamr@2
   233
     * @param aCommandId Command ID the button will send.
williamr@2
   234
     * @param aText The text for the button.
williamr@2
   235
     * @param aBitmap The bitmap for the button.
williamr@2
   236
     * @param aMask The mask bitmap for aBitmap.
williamr@2
   237
     */        
williamr@2
   238
    inline void SetCommandL(
williamr@2
   239
        TInt aPosition, 
williamr@2
   240
        TInt aCommandId, 
williamr@2
   241
        const TDesC& aText,
williamr@2
   242
        const CFbsBitmap& aBitmap,
williamr@2
   243
        const CFbsBitmap& aMask);
williamr@2
   244
williamr@2
   245
    /**
williamr@2
   246
     * Sets a command button's bitmap and command ID. The bitmap and its mask are read
williamr@2
   247
     * from a file.
williamr@2
   248
     *
williamr@2
   249
     * @param aPosition The position within the button group of the button to change.
williamr@2
   250
     *                  If the position is out of range, the function raises a panic.
williamr@2
   251
     * @param aCommandId Command ID the button will send.
williamr@2
   252
     * @param aFile A multi-bitmap file, containing mask and bitmap images.
williamr@2
   253
     * @param aBitmapId ID of the bitmap within aFile.
williamr@2
   254
     * @param aMaskId ID of the mask within aFile.
williamr@2
   255
     */        
williamr@2
   256
    inline void SetCommandL(
williamr@2
   257
        TInt aPosition, 
williamr@2
   258
        TInt aCommandId, 
williamr@2
   259
        const TDesC& aFile,
williamr@2
   260
        TInt aBitmapId,
williamr@2
   261
        TInt aMaskId);
williamr@2
   262
williamr@2
   263
    /**
williamr@2
   264
     * Sets a command button's bitmap, text label and command ID. The bitmap and its 
williamr@2
   265
     * mask are read from a file.
williamr@2
   266
     *
williamr@2
   267
     * @param aPosition The position within the button group of the button to change.
williamr@2
   268
     *                  If the position is out of range, the function raises a panic.
williamr@2
   269
     * @param aCommandId Command ID the button will send.
williamr@2
   270
     * @param aText The text for the button.
williamr@2
   271
     * @param aFile A multi-bitmap file, containing mask and bitmap images.
williamr@2
   272
     * @param aBitmapId ID of the bitmap within aFile.
williamr@2
   273
     * @param aMaskId ID of the mask within aFile.
williamr@2
   274
     */        
williamr@2
   275
    inline void SetCommandL(
williamr@2
   276
        TInt aPosition, 
williamr@2
   277
        TInt aCommandId, 
williamr@2
   278
        const TDesC& aText,
williamr@2
   279
        const TDesC& aFile,
williamr@2
   280
        TInt aBitmapId,
williamr@2
   281
        TInt aMaskId);
williamr@2
   282
williamr@2
   283
    /**
williamr@2
   284
     * Sets a command button's bitmap, text label and command ID. The bitmap, mask,
williamr@2
   285
     * text and command ID are all read from resource.
williamr@2
   286
     *
williamr@2
   287
     * @param aPosition The position within the button group of the button to change.
williamr@2
   288
     *                  If the position is out of range, the function raises a panic.
williamr@2
   289
     * @param aResourceId Resource ID specifying the text, bitmaps and command ID.
williamr@2
   290
     */        
williamr@2
   291
    inline void SetCommandL(
williamr@2
   292
        TInt aPosition, 
williamr@2
   293
        TInt aResourceId);
williamr@2
   294
williamr@2
   295
    /**
williamr@2
   296
     * Sets a command button's text. The button to change is identified by its command ID.
williamr@2
   297
     *
williamr@2
   298
     * @param aCommandId Command ID of the button to change.
williamr@2
   299
     * @param aText The text for the button.
williamr@2
   300
     * @leave KErrNotFound The ID cannot be matched to any button.
williamr@2
   301
     */        
williamr@2
   302
    inline void SetCommandL(
williamr@2
   303
        TInt aCommandId, 
williamr@2
   304
        const TDesC& aText);
williamr@2
   305
williamr@2
   306
    /**
williamr@2
   307
     * Sets a command button's bitmap and mask. The button to change is identified 
williamr@2
   308
     * by its command ID.
williamr@2
   309
     *
williamr@2
   310
     * @param aCommandId Command ID of the button to change.
williamr@2
   311
     * @param aBitmap Bitmap for the button.
williamr@2
   312
     * @param aMask Mask bitmap for aBitmap.
williamr@2
   313
     * @leave KErrNotFound The ID cannot be matched to any button.
williamr@2
   314
     */        
williamr@2
   315
    inline void SetCommandL(
williamr@2
   316
        TInt aCommandId, 
williamr@2
   317
        const CFbsBitmap& aBitmap,
williamr@2
   318
        const CFbsBitmap& aMask);
williamr@2
   319
williamr@2
   320
    /**
williamr@2
   321
     * Sets a command button's bitmap, mask and text. The button to change is 
williamr@2
   322
     * identified by its command ID.
williamr@2
   323
     *
williamr@2
   324
     * @param aCommandId Command ID of the button to change.
williamr@2
   325
     * @param aText Text for the button.
williamr@2
   326
     * @param aBitmap Bitmap for the button.
williamr@2
   327
     * @param aMask Mask bitmap for aBitmap.
williamr@2
   328
     */        
williamr@2
   329
    inline void SetCommandL(
williamr@2
   330
        TInt aCommandId, 
williamr@2
   331
        const TDesC& aText,
williamr@2
   332
        const CFbsBitmap& aBitmap,
williamr@2
   333
        const CFbsBitmap& aMask);
williamr@2
   334
williamr@2
   335
    /**
williamr@2
   336
     * Sets a command button's bitmap and mask. The bitmap and mask are read from 
williamr@2
   337
     * a multi bitmap file. The button to change is identified by its command ID.
williamr@2
   338
     *
williamr@2
   339
     * @param aCommandId Command ID of the button to change.
williamr@2
   340
     * @param aFile A multi-bitmap file, containing mask and bitmap images.
williamr@2
   341
     * @param aBitmapId ID of the bitmap within aFile.
williamr@2
   342
     * @param aMaskId ID of the mask within aFile.
williamr@2
   343
     */        
williamr@2
   344
    inline void SetCommandL(
williamr@2
   345
        TInt aCommandId, 
williamr@2
   346
        const TDesC& aFile,
williamr@2
   347
        TInt aBitmapId,
williamr@2
   348
        TInt aMaskId);
williamr@2
   349
williamr@2
   350
    /**
williamr@2
   351
     * Sets a command button's bitmap, mask and text. The bitmap and its mask are read 
williamr@2
   352
     * from a multi bitmap file. The button to change is identified by its command ID.
williamr@2
   353
     *
williamr@2
   354
     * @param aCommandId Command ID of the button to change.
williamr@2
   355
     * @param aText Text for the button.
williamr@2
   356
     * @param aFile  A multi-bitmap file, containing mask and bitmap images.
williamr@2
   357
     * @param aBitmapId ID of the bitmap within aFile.
williamr@2
   358
     * @param aMaskId ID of the mask within aFile.
williamr@2
   359
     */        
williamr@2
   360
    inline void SetCommandL(
williamr@2
   361
        TInt aCommandId, 
williamr@2
   362
        const TDesC& aText,
williamr@2
   363
        const TDesC& aFile,
williamr@2
   364
        TInt aBitmapId,
williamr@2
   365
        TInt aMaskId);
williamr@2
   366
williamr@2
   367
    /**
williamr@2
   368
     * Initialises the group of command buttons from a resource.
williamr@2
   369
     *
williamr@2
   370
     * @param aResourceId ID of the resource structure specifying the command buttons.
williamr@2
   371
     */        
williamr@2
   372
    IMPORT_C void SetCommandSetL(
williamr@2
   373
        TInt aResourceId);   
williamr@2
   374
williamr@2
   375
    /**
williamr@2
   376
     * Adds a command button with a text label and command ID.
williamr@2
   377
     *
williamr@2
   378
     * @param aPosition The position in the button group for the new button.
williamr@2
   379
     * @param aCommandId Command ID for the new button.
williamr@2
   380
     * @param aText Text for the button.          
williamr@2
   381
     */   
williamr@2
   382
    inline void AddCommandL(
williamr@2
   383
        TInt aPosition, 
williamr@2
   384
        TInt aCommandId,
williamr@2
   385
        const TDesC& aText);
williamr@2
   386
williamr@2
   387
    /**
williamr@2
   388
     * Adds a command button with a bitmap label and command ID.
williamr@2
   389
     *
williamr@2
   390
     * @param aPosition The position in the button group for the new button.
williamr@2
   391
     * @param aCommandId Command ID for the new button.
williamr@2
   392
     * @param aBitmap Bitmap for the button.
williamr@2
   393
     * @param aMask Mask bitmap for aBitmap.
williamr@2
   394
     */        
williamr@2
   395
    inline void AddCommandL(
williamr@2
   396
        TInt aPosition, 
williamr@2
   397
        TInt aCommandId,
williamr@2
   398
        const CFbsBitmap& aBitmap,
williamr@2
   399
        const CFbsBitmap& aMask);
williamr@2
   400
williamr@2
   401
    /**
williamr@2
   402
     * Adds a command button with a command ID and a label containing both 
williamr@2
   403
     * a bitmap and text.
williamr@2
   404
     *
williamr@2
   405
     * @param aPosition The position in the button group for the new button.
williamr@2
   406
     * @param aCommandId Command ID for the new button.
williamr@2
   407
     * @param aText Text for the button.
williamr@2
   408
     * @param aBitmap Bitmap for the button.
williamr@2
   409
     * @param aMask Mask bitmap for aBitmap.
williamr@2
   410
     */        
williamr@2
   411
    inline void AddCommandL(
williamr@2
   412
        TInt aPosition, 
williamr@2
   413
        TInt aCommandId,
williamr@2
   414
        const TDesC& aText,
williamr@2
   415
        const CFbsBitmap& aBitmap,
williamr@2
   416
        const CFbsBitmap& aMask);
williamr@2
   417
williamr@2
   418
    /**
williamr@2
   419
     * Adds a command button with a command ID and a bitmap which is read from a file.
williamr@2
   420
     *
williamr@2
   421
     * @param aPosition The position in the button group for the new button.
williamr@2
   422
     * @param aCommandId Command ID for the new button.
williamr@2
   423
     * @param aFile Multi-bitmap file containing the bitmap and mask.
williamr@2
   424
     * @param aBitmapId ID of the bitmap within aFile.
williamr@2
   425
     * @param aMaskId ID of the mask within aFile.
williamr@2
   426
     */        
williamr@2
   427
    inline void AddCommandL(
williamr@2
   428
        TInt aPosition, 
williamr@2
   429
        TInt aCommandId,
williamr@2
   430
        const TDesC& aFile,
williamr@2
   431
        TInt aBitmapId,
williamr@2
   432
        TInt aMaskId);
williamr@2
   433
williamr@2
   434
    /**
williamr@2
   435
     * Adds a command button with a command ID and a label containing both a bitmap 
williamr@2
   436
     * and text. The bitmap and mask are read from file.
williamr@2
   437
     *
williamr@2
   438
     * @param aPosition The position in the button group for the new button.
williamr@2
   439
     * @param aCommandId Command ID for the new button.
williamr@2
   440
     * @param aText Text for the button.
williamr@2
   441
     * @param aFile Multi-bitmap file containing the bitmap and mask.
williamr@2
   442
     * @param aBitmapId ID of the bitmap within aFile.
williamr@2
   443
     * @param aMaskId ID of the mask within aFile.
williamr@2
   444
     */        
williamr@2
   445
    inline void AddCommandL(
williamr@2
   446
        TInt aPosition, 
williamr@2
   447
        TInt aCommandId,
williamr@2
   448
        const TDesC& aText,
williamr@2
   449
        const TDesC& aFile,
williamr@2
   450
        TInt aBitmapId,
williamr@2
   451
        TInt aMaskId);
williamr@2
   452
williamr@2
   453
    /**
williamr@2
   454
     * Pushes a command button with a text label and command ID onto a position's 
williamr@2
   455
     * button stack. This function behaves similarly to SetCommandL() but allows 
williamr@2
   456
     * the previous command button to be retrieved by calling RemoveCommandFromStack().
williamr@2
   457
     *
williamr@2
   458
     * @param aPosition The position in the button group at which to add the command button. 
williamr@2
   459
     * @param aCommandId Command ID the button will send.
williamr@2
   460
     * @param aText Text for the button.
williamr@2
   461
     */        
williamr@2
   462
    inline void AddCommandToStackL(
williamr@2
   463
        TInt aPosition,
williamr@2
   464
        TInt aCommandId,
williamr@2
   465
        const TDesC& aText);
williamr@2
   466
williamr@2
   467
    /**
williamr@2
   468
     * Pushes a command button with a bitmap, mask and command ID onto a position's 
williamr@2
   469
     * button stack. This function behaves similarly to SetCommandL() but allows the 
williamr@2
   470
     * previous command button to be retrieved by calling RemoveCommandFromStack(). 
williamr@2
   471
     *
williamr@2
   472
     * @param aPosition The position in the button group at which to add the command button.
williamr@2
   473
     * @param aCommandId Command ID the button will send.
williamr@2
   474
     * @param aBitmap Bitmap for the button.
williamr@2
   475
     * @param aMask Mask bitmap for aBitmap.
williamr@2
   476
     */        
williamr@2
   477
    inline void AddCommandToStackL(
williamr@2
   478
        TInt aPosition,
williamr@2
   479
        TInt aCommandId,
williamr@2
   480
        const CFbsBitmap& aBitmap,
williamr@2
   481
        const CFbsBitmap& aMask);
williamr@2
   482
williamr@2
   483
    /**
williamr@2
   484
     * Pushes a command button with text, bitmap, mask and a command ID onto a position's
williamr@2
   485
     * button stack. This function behaves similarly to SetCommandL() but allows the 
williamr@2
   486
     * previous command button to be retrieved by calling RemoveCommandFromStack().
williamr@2
   487
     *
williamr@2
   488
     * @param aPosition The position in the button group at which to add the command button.
williamr@2
   489
     * @param aCommandId Command ID the button will send.
williamr@2
   490
     * @param aText Text for the button.
williamr@2
   491
     * @param aBitmap Bitmap for the button.
williamr@2
   492
     * @param aMask Mask bitmap for aBitmap.
williamr@2
   493
     */        
williamr@2
   494
    inline void AddCommandToStackL(
williamr@2
   495
        TInt aPosition,
williamr@2
   496
        TInt aCommandId,
williamr@2
   497
        const TDesC& aText,
williamr@2
   498
        const CFbsBitmap& aBitmap,
williamr@2
   499
        const CFbsBitmap& aMask);
williamr@2
   500
williamr@2
   501
    /**
williamr@2
   502
     * Pushes a command button with a bitmap, mask and command ID onto a position's button 
williamr@2
   503
     * stack. The bitmap and mask are read from a file. This function behaves similarly to 
williamr@2
   504
     * SetCommandL() but allows the previous command button to be retrieved by calling 
williamr@2
   505
     * RemoveCommandFromStack().
williamr@2
   506
     *
williamr@2
   507
     * @param aPosition The position in the button group at which to add the command button.
williamr@2
   508
     * @param aCommandId Command ID the button will send.
williamr@2
   509
     * @param aFile A multi-bitmap file containing mask and bitmap.
williamr@2
   510
     * @param aBitmapId Index into the file of the bitmap.
williamr@2
   511
     * @param aMaskId Index into the file of the bitmap mask.
williamr@2
   512
     */        
williamr@2
   513
    inline void AddCommandToStackL(
williamr@2
   514
        TInt aPosition,
williamr@2
   515
        TInt aCommandId,
williamr@2
   516
        const TDesC& aFile,
williamr@2
   517
        TInt aBitmapId,
williamr@2
   518
        TInt aMaskId);
williamr@2
   519
williamr@2
   520
    /**
williamr@2
   521
     * Pushes a command button with text, bitmap, mask and command button onto a position's 
williamr@2
   522
     * button stack. The bitmap and mask are read from a file. This function behaves similarly
williamr@2
   523
     * to SetCommandL() but allows the previous command button to be retrieved by calling 
williamr@2
   524
     * RemoveCommandFromStack(). 
williamr@2
   525
     *
williamr@2
   526
     * @param aPosition The position in the button group at which to push the command button.
williamr@2
   527
     * @param aCommandId Command ID the button will send.
williamr@2
   528
     * @param aText Text for the button.
williamr@2
   529
     * @param aFile A multi-bitmap file containing mask and bitmap.
williamr@2
   530
     * @param aBitmapId Index into the file of the bitmap.
williamr@2
   531
     * @param aMaskId Index into the file of the bitmap mask.
williamr@2
   532
     */        
williamr@2
   533
    inline void AddCommandToStackL(
williamr@2
   534
        TInt aPosition,
williamr@2
   535
        TInt aCommandId,
williamr@2
   536
        const TDesC& aText,
williamr@2
   537
        const TDesC& aFile,
williamr@2
   538
        TInt aBitmapId,
williamr@2
   539
        TInt aMaskId);
williamr@2
   540
williamr@2
   541
    /**
williamr@2
   542
     * Pushes a command button onto a position's button stack. The text, bitmap, mask and 
williamr@2
   543
     * command ID are all read from resource. This function behaves similarly to 
williamr@2
   544
     * SetCommandL() but allows the previous command button to be retrieved by calling 
williamr@2
   545
     * RemoveCommandFromStack().
williamr@2
   546
     *
williamr@2
   547
     * @param aPosition The position in the button group at which to push the command button.
williamr@2
   548
     * @param aResourceId ID of a resource specifying the text, bitmaps and command ID.
williamr@2
   549
     */        
williamr@2
   550
    inline void AddCommandToStackL(
williamr@2
   551
        TInt aPosition,
williamr@2
   552
        TInt aResourceId);
williamr@2
   553
williamr@2
   554
    /**
williamr@2
   555
     * As with SetCommandL() but for a set of buttons, also allows the previous command 
williamr@2
   556
     * button to be retrieved by calling RemoveCommand().
williamr@2
   557
     *
williamr@2
   558
     * @param aResourceId Resource describing the set of command buttons.
williamr@2
   559
     */        
williamr@2
   560
    IMPORT_C void AddCommandSetToStackL(
williamr@2
   561
        TInt aResourceId);
williamr@2
   562
williamr@2
   563
    /**
williamr@2
   564
     * Removes the command identified by aCommandId, in position aPosition in the group,
williamr@2
   565
     * from the command stack. Automatically retrieves the previous command details. 
williamr@2
   566
     * Commands are added to the stack by calling AddCommandToStackL.
williamr@2
   567
     *
williamr@2
   568
     * @param aPosition The position in the button group from which to remove the 
williamr@2
   569
     *                  command button.
williamr@2
   570
     * @param aCommandId Command ID.
williamr@2
   571
     */        
williamr@2
   572
    IMPORT_C void RemoveCommandFromStack(TInt aPosition, TInt aCommandId);
williamr@2
   573
williamr@2
   574
    /**
williamr@2
   575
     * Sets the default command ID for buttons in this container.
williamr@2
   576
     *
williamr@2
   577
     * @param aCommandId Command to issue if no other is specified.
williamr@2
   578
     */    
williamr@2
   579
    IMPORT_C void SetDefaultCommand(TInt aCommandId); 
williamr@2
   580
williamr@2
   581
    /**
williamr@2
   582
     * Calculates minimum size required to display the buttons defined in the specified
williamr@2
   583
     * resource structure.
williamr@2
   584
     *
williamr@2
   585
     * @param aResourceId The ID of the resource structure describing the button group.
williamr@2
   586
     * @return Minimum size required to display the button group defined in the specified resource structure.
williamr@2
   587
     */    
williamr@2
   588
    IMPORT_C TSize CalcMinimumSizeL(TInt aResourceId) const;    
williamr@2
   589
williamr@2
   590
    /**
williamr@2
   591
     * Places the command in position aPosition in the group on the cleanup stack. Typically 
williamr@2
   592
     * used when a control or view changes the contents of two or more buttons on receipt of 
williamr@2
   593
     * focus. After altering one command with a call to AddCommandToStackL() the push is made 
williamr@2
   594
     * to guarantee the display will be left in a consistent state if the second (and any 
williamr@2
   595
     * subsequent) calls to AddCommandToStackL() fail. Only a single command can be pushed 
williamr@2
   596
     * for each position.
williamr@2
   597
     *
williamr@2
   598
     * @param aPosition Position in the container of the button to push.
williamr@2
   599
     */    
williamr@2
   600
    IMPORT_C void CleanupCommandPushL(TInt aPosition);
williamr@2
   601
williamr@2
   602
    /**
williamr@2
   603
     * Removes a command from the cleanup stack without destroying it.
williamr@2
   604
     */    
williamr@2
   605
    inline void CleanupCommandPop();
williamr@2
   606
williamr@2
   607
    /**
williamr@2
   608
     * Removes one or more commands from the cleanup stack without destroying them.
williamr@2
   609
     *
williamr@2
   610
     * @param aCount Number of commands to pop.
williamr@2
   611
     */    
williamr@2
   612
    IMPORT_C void CleanupCommandPop(TInt aCount);       
williamr@2
   613
williamr@2
   614
    /**
williamr@2
   615
     * Removes a single command which was pushed onto the cleanup stack. It does this by 
williamr@2
   616
     * calling CleanupCommandPushL(), rolling back to the previous details. The command
williamr@2
   617
     * button popped is destroyed.
williamr@2
   618
     */    
williamr@2
   619
    inline void CleanupCommandPopAndDestroy();
williamr@2
   620
williamr@2
   621
    /**
williamr@2
   622
     * Removes one or more commands which were pushed onto the cleanup stack. It does this 
williamr@2
   623
     * by calling CleanupCommandPushL(), rolling back to the previous details. The command 
williamr@2
   624
     * buttons popped are destroyed.
williamr@2
   625
     *
williamr@2
   626
     * @param aCount Number of commands to pop and destroy.
williamr@2
   627
     */    
williamr@2
   628
    inline void CleanupCommandPopAndDestroy(TInt aCount);   
williamr@2
   629
williamr@2
   630
    /**
williamr@2
   631
     * Gets the maximum number of buttons that can be supported by the device.
williamr@2
   632
     *
williamr@2
   633
     * @return The number of command buttons supported.
williamr@2
   634
     */    
williamr@2
   635
    IMPORT_C TInt MaxCommands() const;
williamr@2
   636
williamr@2
   637
    /**
williamr@2
   638
     * Gets the total number of buttons currently present in the group.
williamr@2
   639
     *
williamr@2
   640
     * @return The number of buttons.
williamr@2
   641
     */    
williamr@2
   642
    IMPORT_C TInt ButtonCount() const;
williamr@2
   643
    
williamr@2
   644
    /**
williamr@2
   645
    * Dims (but doesn't draw) the button with id aCommandId if aDimmed is ETrue. If two 
williamr@2
   646
    * buttons have the same id, the button to be dimmed is undefined.
williamr@2
   647
    *
williamr@2
   648
    * @param aCommandId The id for command to be dimmed.
williamr@2
   649
    * @param aDimmed ETrue for dimming.
williamr@2
   650
    */
williamr@2
   651
    IMPORT_C void DimCommand(TInt aCommandId, TBool aDimmed);
williamr@2
   652
    
williamr@2
   653
    /**
williamr@2
   654
    * Returns ETrue if the button with id aCommandId is dimmed. If two buttons have 
williamr@2
   655
    * the same id, the results of this check are undefined.
williamr@2
   656
    *
williamr@2
   657
    * @param aCommandId The id for command to be checked.
williamr@2
   658
    * @return The state of the button.    
williamr@2
   659
    */
williamr@2
   660
    IMPORT_C TBool IsCommandDimmed(TInt aCommandId) const;
williamr@2
   661
    
williamr@2
   662
    /**
williamr@2
   663
    * Sets the the button with id aCommandId to be visible if aVisible is ETrue. If two 
williamr@2
   664
    * buttons have the same id, the button to be altered is undefined.
williamr@2
   665
    *
williamr@2
   666
    * @param aCommandId The id for command to be made visible.
williamr@2
   667
    * @param aVisible EFalse for making button invisible.
williamr@2
   668
    */
williamr@2
   669
    IMPORT_C void MakeCommandVisible(TInt aCommandId, TBool aVisible);
williamr@2
   670
williamr@2
   671
    /**
williamr@2
   672
    * Returns ETrue if the button with id aCommandId is visible. If two buttons have 
williamr@2
   673
    * the same id, the results are undefined.
williamr@2
   674
    *
williamr@2
   675
    * @param aCommandId The id for command to be checked.
williamr@2
   676
    * @return The state of the button.     
williamr@2
   677
    */
williamr@2
   678
    IMPORT_C TBool IsCommandVisible(TInt aCommandId) const;
williamr@2
   679
williamr@2
   680
    /**
williamr@2
   681
    * Animates the button with id aCommandId. If two buttons have the same id, the 
williamr@2
   682
    * button to be animated is undefined.
williamr@2
   683
    *
williamr@2
   684
    * @since S60 3.1
williamr@2
   685
    * @param aCommandId The id for command to be animated.   
williamr@2
   686
    */
williamr@2
   687
    IMPORT_C void AnimateCommand(TInt aCommandId);
williamr@2
   688
    
williamr@2
   689
    /**
williamr@2
   690
    * Dims (but doesn't draw) the button with position aPosition.
williamr@2
   691
    *
williamr@2
   692
    * @since S60 3.1
williamr@2
   693
    * @param aPosition The position for command to be dimmed.
williamr@2
   694
    * @param aDimmed ETrue for dimming.
williamr@2
   695
    */
williamr@2
   696
    IMPORT_C void DimCommandByPosition(TCommandPosition aPosition, TBool aDimmed);
williamr@2
   697
    
williamr@2
   698
    /**
williamr@2
   699
    * Returns ETrue if the button with position aPosition is dimmed.
williamr@2
   700
    *
williamr@2
   701
    * @since S60 3.1
williamr@2
   702
    * @param aPosition The position for command to be checked.
williamr@2
   703
    * @return The state of the button.    
williamr@2
   704
    */
williamr@2
   705
    IMPORT_C TBool IsCommandDimmedByPosition(TCommandPosition aPosition) const;
williamr@2
   706
    
williamr@2
   707
    /**
williamr@2
   708
    * Sets the the button with position aPosition to be visible if aVisible is ETrue.
williamr@2
   709
    *
williamr@2
   710
    * @since S60 3.1
williamr@2
   711
    * @param aPosition The position for command to be made visible.
williamr@2
   712
    * @param aVisible EFalse for making button invisible.
williamr@2
   713
    */
williamr@2
   714
    IMPORT_C void MakeCommandVisibleByPosition(TCommandPosition aPosition, TBool aVisible);
williamr@2
   715
    
williamr@2
   716
    /**
williamr@2
   717
    * Returns ETrue if the button with position aPosition is visible.
williamr@2
   718
    *
williamr@2
   719
    * @since S60 3.1
williamr@2
   720
    * @param aPosition The position for command to be checked.
williamr@2
   721
    * @return The state of the button.     
williamr@2
   722
    */
williamr@2
   723
    IMPORT_C TBool IsCommandVisibleByPosition(TCommandPosition aPosition) const;
williamr@2
   724
    
williamr@2
   725
    /**
williamr@2
   726
    * Animates the button with position aPosition.
williamr@2
   727
    *
williamr@2
   728
    * @since S60 3.1
williamr@2
   729
    * @param aPosition The position for command to be animated.    
williamr@2
   730
    */
williamr@2
   731
    IMPORT_C void AnimateCommandByPosition(TCommandPosition aPosition);
williamr@2
   732
williamr@2
   733
    /**
williamr@2
   734
     * Gets the button group's location. Typically the button group is external to the 
williamr@2
   735
     * view which is using it. In some cases, such as in dialogs with button panels, 
williamr@2
   736
     * the button group is internal to the control which is using it.
williamr@2
   737
     *
williamr@2
   738
     * @return The button group's location.
williamr@2
   739
     */  
williamr@2
   740
    IMPORT_C TLocation Location() const;
williamr@2
   741
    
williamr@2
   742
    /**
williamr@2
   743
     * Gets a pointer to the command button with the specified command Id.
williamr@2
   744
     *
williamr@2
   745
     * @param aCommandId Command ID of the button.
williamr@2
   746
     * @return Pointer to the command button CEikCommandButton, NULL if there 
williamr@2
   747
     *         was no button with Id aCommandId.
williamr@2
   748
     */      
williamr@2
   749
    IMPORT_C CEikCommandButton* CommandButtonOrNull(TInt aCommandId) const;
williamr@2
   750
    
williamr@2
   751
    /**
williamr@2
   752
     * Sets the boundary rectangle for externally-positioned button groups. 
williamr@2
   753
     * For use by EExternal button groups only.
williamr@2
   754
     * 
williamr@2
   755
     * @param aRect The boundary rectangle to use. The button group attaches 
williamr@2
   756
     *              itself to the inside of this rectangle.
williamr@2
   757
     */    
williamr@2
   758
    IMPORT_C void SetBoundingRect(const TRect& aRect);
williamr@2
   759
williamr@2
   760
    /**
williamr@2
   761
     * Subtracts the area occupied by the button group from the specified bounding 
williamr@2
   762
     * rectangle. This method should be used in preference to querying the container's 
williamr@2
   763
     * area at all times. For use by EExternal button groups only.
williamr@2
   764
     * 
williamr@2
   765
     * @param aBoundingRect Rectangle to be modified.
williamr@2
   766
     */        
williamr@2
   767
    IMPORT_C void ReduceRect(TRect& aBoundingRect) const;
williamr@2
   768
williamr@2
   769
    /**
williamr@2
   770
     * Gets a pointer to the control (button) with the specified command ID. 
williamr@2
   771
     * This method is intended to allow access to standard CCoeControl functionality 
williamr@2
   772
     * only. Casting the return value is likely to fail on different devices.
williamr@2
   773
     *
williamr@2
   774
     * @param aCommandId Command ID of the button to get.
williamr@2
   775
     * @return Pointer to a CCoeControl, NULL if there was no button at aCommandId.
williamr@2
   776
     */
williamr@2
   777
    IMPORT_C CCoeControl* ControlOrNull(TInt aCommandId) const;
williamr@2
   778
    
williamr@2
   779
    /**
williamr@2
   780
     * Gets a pointer to the the button with the specified command Id.
williamr@2
   781
     *
williamr@2
   782
     * @param aCommandId Command ID of the button to obtain.
williamr@2
   783
     * @return The button object.
williamr@2
   784
     */    
williamr@2
   785
    IMPORT_C CEikCommandButton* ButtonById(TInt aCommandId) const;
williamr@2
   786
    
williamr@2
   787
    /**
williamr@2
   788
     * Gets the position in the group of the button with the specified command Id.
williamr@2
   789
     * The return value is undefined if two buttons share the same id.
williamr@2
   790
     *
williamr@2
   791
     * @param aCommandId Identifies the command.
williamr@2
   792
     * @return The command's container position.
williamr@2
   793
     */     
williamr@2
   794
    IMPORT_C TInt PositionById(TInt aCommandId) const;
williamr@2
   795
    
williamr@2
   796
    /**
williamr@2
   797
     * Updates a command's hotkey and whether the key is displayed. 
williamr@2
   798
     * This function is only supported by containers being used for dialog buttons.
williamr@2
   799
     *
williamr@2
   800
     * @param aCommandId Identifies the command to update.
williamr@2
   801
     * @param aFlags Whether to display the hotkey.
williamr@2
   802
     * @param aKeyId Hotkey identifier.
williamr@2
   803
     */    
williamr@2
   804
    IMPORT_C void UpdateHotKey(TInt aCommandId, THotKeyFlags aFlags, TInt aKeyId);
williamr@2
   805
    
williamr@2
   806
    /**
williamr@2
   807
     * Changes the command observer for the button at aPos to aCommandObserver. 
williamr@2
   808
     * Panics if an updated observer is already present. This function should be followed 
williamr@2
   809
     * by RemoveCommandObserver() when you need to put back the original observer.
williamr@2
   810
     *
williamr@2
   811
     * @param aPos The button's position.
williamr@2
   812
     * @param aCommandObserver The command observer.
williamr@2
   813
     */    
williamr@2
   814
    IMPORT_C void UpdateCommandObserverL(TInt aPos, MEikCommandObserver& aCommandObserver);
williamr@2
   815
    
williamr@2
   816
    /**
williamr@2
   817
     * Removes the temporary observer for the button at aPos, replacing it with the
williamr@2
   818
     * observer that was present when UpdateCommandObserverL() was called.
williamr@2
   819
     *
williamr@2
   820
     * @param aPos The button's position.
williamr@2
   821
     */    
williamr@2
   822
    IMPORT_C void RemoveCommandObserver(TInt aPos);
williamr@2
   823
    
williamr@2
   824
    /**
williamr@2
   825
     * Checks for existence of updated command observer for the button at aPosition.
williamr@2
   826
     *
williamr@2
   827
     * @since S60 3.2
williamr@2
   828
     * @param aPosition The position for button to be checked.
williamr@2
   829
     * @return ETrue, if updated command observer exists.
williamr@2
   830
     */    
williamr@2
   831
    IMPORT_C TBool UpdatedCommandObserverExists(TCommandPosition aPosition) const;
williamr@2
   832
    
williamr@2
   833
    /**
williamr@2
   834
     * Tests whether the button group has explicitly been instructed to suppress redraws.
williamr@2
   835
     * Some button groups may not activate themselves during construction, in which 
williamr@2
   836
     * case, they need to be activated by the client. This method allows the client 
williamr@2
   837
     * to enquire whether this is necessary.
williamr@2
   838
     *
williamr@2
   839
     * @return ETrue if the button group will suppress redraws, otherwise EFalse.
williamr@2
   840
     */    
williamr@2
   841
    IMPORT_C TBool DelayActivation() const;
williamr@2
   842
    
williamr@2
   843
    /**
williamr@2
   844
     * Returns the container's button group.
williamr@2
   845
     *
williamr@2
   846
     * @return Pointer to the button group object. Ownership is not transferred.
williamr@2
   847
     */    
williamr@2
   848
    inline MEikButtonGroup* ButtonGroup();
williamr@2
   849
    
williamr@2
   850
    /**
williamr@2
   851
     * Returns the button group type.
williamr@2
   852
     *
williamr@2
   853
     * @return The button group type.
williamr@2
   854
     */    
williamr@2
   855
    inline TUse ButtonGroupType();
williamr@2
   856
    
williamr@2
   857
    /**
williamr@2
   858
    * Internal method for setting markable list's MSK observer.
williamr@2
   859
    * This observer is called before default CBA observer if MSK is pressed.
williamr@2
   860
    * Observer is removed by passing NULL as parameter.
williamr@2
   861
    *
williamr@2
   862
    * @since S60 3.1
williamr@2
   863
    * @param aMSKObserverOwner
williamr@2
   864
    * @param aCommandObserver
williamr@2
   865
    */
williamr@2
   866
    void UpdateMSKCommandObserver(
williamr@2
   867
        CEikListBox* aMSKObserverOwner, 
williamr@2
   868
        MEikCommandObserver* aCommandObserver);
williamr@2
   869
    
williamr@2
   870
public: // From CCoeControl.
williamr@2
   871
    /**
williamr@2
   872
     * From CCoeControl.
williamr@2
   873
     * Gets the control's minimum required size.
williamr@2
   874
     *
williamr@2
   875
     * @return The minimum size required by the control.
williamr@2
   876
     */ 
williamr@2
   877
    IMPORT_C TSize MinimumSize();
williamr@2
   878
    
williamr@2
   879
    /**
williamr@2
   880
     * From CCoeControl.
williamr@2
   881
     * Handles key events.
williamr@2
   882
     *
williamr@2
   883
     * @param aKeyEvent The key event. 
williamr@2
   884
     * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown. 
williamr@2
   885
     * @return Indicates whether or not the key event was used by this control. 
williamr@2
   886
     */     
williamr@2
   887
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
williamr@2
   888
    
williamr@2
   889
    /**
williamr@2
   890
     * From CCoeControl.
williamr@2
   891
     * Sets this control as visible or invisible.
williamr@2
   892
     *
williamr@2
   893
     * @param aVisible ETrue to make the control visible, EFalse to make it invisible. 
williamr@2
   894
     */     
williamr@2
   895
    void MakeVisible(TBool aVisible);
williamr@2
   896
    
williamr@2
   897
    /**
williamr@2
   898
     * From CCoeControl.
williamr@2
   899
     * Writes the internal state of the control and its components to aStream.
williamr@2
   900
     * Does nothing in release mode.
williamr@2
   901
     *
williamr@2
   902
     * @param aWriteStream The output stream.
williamr@2
   903
     */     
williamr@2
   904
    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   905
    
williamr@2
   906
public:
williamr@2
   907
    /**
williamr@2
   908
     * Formerly from MTopSetMember<CEikButtonGroupContainer>, now reserved.
williamr@2
   909
     */ 
williamr@2
   910
    IMPORT_C virtual void Reserved_MtsmPosition();
williamr@2
   911
    
williamr@2
   912
    /**
williamr@2
   913
     * Formerly from MTopSetMember<CEikButtonGroupContainer>, now reserved.
williamr@2
   914
     */     
williamr@2
   915
    IMPORT_C virtual void Reserved_MtsmObject();
williamr@2
   916
williamr@2
   917
public: // New functions for enhanced cba support.
williamr@2
   918
    /**
williamr@2
   919
     * Used to offer list of commands for softkeys.
williamr@2
   920
     *
williamr@2
   921
     * @since S60 3.2
williamr@2
   922
     * @param aCommandList A list of command ids to be offered for softkeys.
williamr@2
   923
     */
williamr@2
   924
    IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList);
williamr@2
   925
    
williamr@2
   926
    /**
williamr@2
   927
     * Used to offer list of commands for softkeys.
williamr@2
   928
     *
williamr@2
   929
     * @since S60 3.2
williamr@2
   930
     * @param aResourceId Id for CBA resource that defines enhanced cba buttons.
williamr@2
   931
     */ 
williamr@2
   932
    IMPORT_C void OfferCommandListL(const TInt aResourceId);
williamr@2
   933
williamr@2
   934
    /**
williamr@2
   935
     * Used to check if a certain command have been approved to the current command set
williamr@2
   936
     *
williamr@2
   937
     * @since S60 3.2
williamr@2
   938
     * @param aCommandId The id for command which existence should be checked.
williamr@2
   939
     * @return ETrue if command is in control group, otherwise EFalse.
williamr@2
   940
     */     
williamr@2
   941
    IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const;
williamr@2
   942
    
williamr@2
   943
    /**
williamr@2
   944
     * Replaces command with another.
williamr@2
   945
     *
williamr@2
   946
     * @since S60 3.2 
williamr@2
   947
     * @param aCommandId Id for command that should be replaced.
williamr@2
   948
     * @param aResourceId Resource id for new enhanced cba button.
williamr@2
   949
     */     
williamr@2
   950
    IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId);
williamr@2
   951
williamr@2
   952
private:
williamr@2
   953
    enum TCommandOp {ESet, EAdd, EPush};
williamr@2
   954
    
williamr@2
   955
private:
williamr@2
   956
    class TCmdPos
williamr@2
   957
        {
williamr@2
   958
    public:
williamr@2
   959
        inline TCmdPos();
williamr@2
   960
        inline TCmdPos(TInt aPos, TInt aCmd);
williamr@2
   961
    public:
williamr@2
   962
        TInt iPos;
williamr@2
   963
        TInt iCmd;
williamr@2
   964
        };
williamr@2
   965
        
williamr@2
   966
    class TCmdObserver
williamr@2
   967
        {
williamr@2
   968
    public:
williamr@2
   969
        inline TCmdObserver(TInt aPos, MEikCommandObserver& aObserver);
williamr@2
   970
    public:
williamr@2
   971
        TInt iPos;
williamr@2
   972
        MEikCommandObserver& iObserver;
williamr@2
   973
        };
williamr@2
   974
        
williamr@2
   975
    class CCmdObserverArray : public CArrayFixFlat<TCmdObserver>
williamr@2
   976
        {
williamr@2
   977
    public:
williamr@2
   978
        inline CCmdObserverArray();
williamr@2
   979
        TInt FindIndex(TInt aPos);
williamr@2
   980
        };
williamr@2
   981
        
williamr@2
   982
private:
williamr@2
   983
    CEikButtonGroupContainer(TUse aUse);
williamr@2
   984
    
williamr@2
   985
    void ConstructL(
williamr@2
   986
        TOrientation aOrientation,
williamr@2
   987
        MEikCommandObserver* aCommandObserver,
williamr@2
   988
        TInt aResourceId,
williamr@2
   989
        RWindowGroup* aParentWg,
williamr@2
   990
        TUint aFlags);
williamr@2
   991
        
williamr@2
   992
    IMPORT_C void DoSetCommandL(
williamr@2
   993
        TInt aPosition,
williamr@2
   994
        TInt aCommandId,
williamr@2
   995
        const TDesC* aText,
williamr@2
   996
        const CFbsBitmap* aBitmap,
williamr@2
   997
        const CFbsBitmap* aMask,
williamr@2
   998
        TCommandOp aOp);
williamr@2
   999
        
williamr@2
  1000
    IMPORT_C void DoSetCommandL(
williamr@2
  1001
        TInt aPosition,
williamr@2
  1002
        TInt aCommandId,
williamr@2
  1003
        const TDesC* aText,
williamr@2
  1004
        const TDesC& aFile,
williamr@2
  1005
        TInt aBitmapId,
williamr@2
  1006
        TInt aMaskId,
williamr@2
  1007
        TCommandOp aOp);
williamr@2
  1008
        
williamr@2
  1009
    IMPORT_C void DoSetCommandL(
williamr@2
  1010
        TInt aCommandId,
williamr@2
  1011
        const TDesC* aText,
williamr@2
  1012
        const CFbsBitmap* aBitmap,
williamr@2
  1013
        const CFbsBitmap* aMask,
williamr@2
  1014
        TCommandOp aOp);
williamr@2
  1015
        
williamr@2
  1016
    IMPORT_C void DoSetCommandL(
williamr@2
  1017
        TInt aCommandId,
williamr@2
  1018
        const TDesC* aText,
williamr@2
  1019
        const TDesC& aFile,
williamr@2
  1020
        TInt aBitmapId,
williamr@2
  1021
        TInt aMaskId,
williamr@2
  1022
        TCommandOp aOp);
williamr@2
  1023
        
williamr@2
  1024
    IMPORT_C void DoSetCommandL(
williamr@2
  1025
        TInt aPosition,
williamr@2
  1026
        TInt aResourceId,
williamr@2
  1027
        TCommandOp aOp);
williamr@2
  1028
    
williamr@2
  1029
    inline CCoeControl* ButtonGroupAsControl() const;
williamr@2
  1030
    void UpdateRect();
williamr@2
  1031
    static void CleanupCommandDestroy(TAny* aPtr);
williamr@2
  1032
    TCmdPos DoCleanupCommandPop();
williamr@2
  1033
    void DoCleanupCommandPopAndDestroy();
williamr@2
  1034
williamr@2
  1035
private: // from CCoeControl
williamr@2
  1036
    TInt CountComponentControls() const;
williamr@2
  1037
    CCoeControl* ComponentControl(TInt aIndex) const;
williamr@2
  1038
    void SizeChanged();
williamr@2
  1039
williamr@2
  1040
private: // from MEikCommandObserver
williamr@2
  1041
    void ProcessCommandL(TInt aCommandId);
williamr@2
  1042
    CCoeControl* CreateCustomCommandControlL(TInt aControlType);
williamr@2
  1043
williamr@2
  1044
private:
williamr@2
  1045
    MEikButtonGroup* iButtonGroup;
williamr@2
  1046
    TUse iUse;
williamr@2
  1047
    CArrayFix<TCmdPos>* iCommandsCleanup;
williamr@2
  1048
    MEikCommandObserver* iCommandObserver;
williamr@2
  1049
    CCmdObserverArray* iObserverArray;
williamr@2
  1050
    TDblQueLink iBtLink;
williamr@2
  1051
    CEikListBox* iMSKObserverOwner;
williamr@2
  1052
    TInt iSpare;
williamr@2
  1053
williamr@2
  1054
private:
williamr@2
  1055
    friend class CCmdObserverArray;
williamr@2
  1056
    friend class CEikButtonGroupStack;
williamr@2
  1057
    };
williamr@2
  1058
williamr@2
  1059
williamr@2
  1060
// Inline function implementations.
williamr@2
  1061
williamr@2
  1062
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1063
    TInt aPosition,
williamr@2
  1064
    TInt aCommandId,
williamr@2
  1065
    const TDesC& aText)
williamr@2
  1066
    {
williamr@2
  1067
    DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, ESet);
williamr@2
  1068
    }
williamr@2
  1069
williamr@2
  1070
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1071
    TInt aPosition,
williamr@2
  1072
    TInt aCommandId,
williamr@2
  1073
    const CFbsBitmap& aBitmap,
williamr@2
  1074
    const CFbsBitmap& aMask)
williamr@2
  1075
    {
williamr@2
  1076
    DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, ESet);
williamr@2
  1077
    }
williamr@2
  1078
williamr@2
  1079
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1080
    TInt aPosition,
williamr@2
  1081
    TInt aCommandId,
williamr@2
  1082
    const TDesC& aText,
williamr@2
  1083
    const CFbsBitmap& aBitmap,
williamr@2
  1084
    const CFbsBitmap& aMask)
williamr@2
  1085
    {
williamr@2
  1086
    DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, ESet);
williamr@2
  1087
    }
williamr@2
  1088
williamr@2
  1089
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1090
    TInt aPosition,
williamr@2
  1091
    TInt aCommandId,
williamr@2
  1092
    const TDesC& aFile,
williamr@2
  1093
    TInt aBitmapId,
williamr@2
  1094
    TInt aMaskId)
williamr@2
  1095
    {
williamr@2
  1096
    DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, ESet);
williamr@2
  1097
    }
williamr@2
  1098
williamr@2
  1099
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1100
    TInt aPosition,
williamr@2
  1101
    TInt aCommandId,
williamr@2
  1102
    const TDesC& aText,
williamr@2
  1103
    const TDesC& aFile,
williamr@2
  1104
    TInt aBitmapId,
williamr@2
  1105
    TInt aMaskId)
williamr@2
  1106
    {
williamr@2
  1107
    DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, ESet);
williamr@2
  1108
    }
williamr@2
  1109
williamr@2
  1110
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1111
    TInt aPosition,
williamr@2
  1112
    TInt aResourceId)
williamr@2
  1113
    {
williamr@2
  1114
    DoSetCommandL(aPosition, aResourceId, ESet);
williamr@2
  1115
    }
williamr@2
  1116
williamr@2
  1117
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1118
    TInt aCommandId,
williamr@2
  1119
    const TDesC& aText)
williamr@2
  1120
    {
williamr@2
  1121
    DoSetCommandL(aCommandId, &aText, NULL, NULL, ESet);
williamr@2
  1122
    }
williamr@2
  1123
williamr@2
  1124
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1125
    TInt aCommandId,
williamr@2
  1126
    const CFbsBitmap& aBitmap,
williamr@2
  1127
    const CFbsBitmap& aMask)
williamr@2
  1128
    {
williamr@2
  1129
    DoSetCommandL(aCommandId, NULL, &aBitmap, &aMask, ESet);
williamr@2
  1130
    }
williamr@2
  1131
williamr@2
  1132
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1133
    TInt aCommandId,
williamr@2
  1134
    const TDesC& aText,
williamr@2
  1135
    const CFbsBitmap& aBitmap,
williamr@2
  1136
    const CFbsBitmap& aMask)
williamr@2
  1137
    {
williamr@2
  1138
    DoSetCommandL(aCommandId, &aText, &aBitmap, &aMask, ESet);
williamr@2
  1139
    }
williamr@2
  1140
williamr@2
  1141
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1142
    TInt aCommandId,
williamr@2
  1143
    const TDesC& aFile,
williamr@2
  1144
    TInt aBitmapId,
williamr@2
  1145
    TInt aMaskId)
williamr@2
  1146
    {
williamr@2
  1147
    DoSetCommandL(aCommandId, NULL, aFile, aBitmapId, aMaskId, ESet);
williamr@2
  1148
    }
williamr@2
  1149
williamr@2
  1150
inline void CEikButtonGroupContainer::SetCommandL(
williamr@2
  1151
    TInt aCommandId,
williamr@2
  1152
    const TDesC& aText,
williamr@2
  1153
    const TDesC& aFile,
williamr@2
  1154
    TInt aBitmapId,
williamr@2
  1155
    TInt aMaskId)
williamr@2
  1156
    {
williamr@2
  1157
    DoSetCommandL(aCommandId, &aText, aFile, aBitmapId, aMaskId, ESet);
williamr@2
  1158
    }
williamr@2
  1159
williamr@2
  1160
inline void CEikButtonGroupContainer::AddCommandL(
williamr@2
  1161
    TInt aPosition,
williamr@2
  1162
    TInt aCommandId,
williamr@2
  1163
    const TDesC& aText)
williamr@2
  1164
    {
williamr@2
  1165
    DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, EAdd);
williamr@2
  1166
    }
williamr@2
  1167
williamr@2
  1168
inline void CEikButtonGroupContainer::AddCommandL(
williamr@2
  1169
    TInt aPosition,
williamr@2
  1170
    TInt aCommandId,
williamr@2
  1171
    const CFbsBitmap& aBitmap,
williamr@2
  1172
    const CFbsBitmap& aMask)
williamr@2
  1173
    {
williamr@2
  1174
    DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, EAdd);
williamr@2
  1175
    }
williamr@2
  1176
williamr@2
  1177
inline void CEikButtonGroupContainer::AddCommandL(
williamr@2
  1178
    TInt aPosition,
williamr@2
  1179
    TInt aCommandId,
williamr@2
  1180
    const TDesC& aText,
williamr@2
  1181
    const CFbsBitmap& aBitmap,
williamr@2
  1182
    const CFbsBitmap& aMask)
williamr@2
  1183
    {
williamr@2
  1184
    DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, EAdd);
williamr@2
  1185
    }
williamr@2
  1186
williamr@2
  1187
inline void CEikButtonGroupContainer::AddCommandL(
williamr@2
  1188
    TInt aPosition,
williamr@2
  1189
    TInt aCommandId,
williamr@2
  1190
    const TDesC& aFile,
williamr@2
  1191
    TInt aBitmapId,
williamr@2
  1192
    TInt aMaskId)
williamr@2
  1193
    {
williamr@2
  1194
    DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, EAdd);
williamr@2
  1195
    }
williamr@2
  1196
williamr@2
  1197
inline void CEikButtonGroupContainer::AddCommandL(
williamr@2
  1198
    TInt aPosition,
williamr@2
  1199
    TInt aCommandId,
williamr@2
  1200
    const TDesC& aText,
williamr@2
  1201
    const TDesC& aFile,
williamr@2
  1202
    TInt aBitmapId,
williamr@2
  1203
    TInt aMaskId)
williamr@2
  1204
    {
williamr@2
  1205
    DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, EAdd);
williamr@2
  1206
    }
williamr@2
  1207
williamr@2
  1208
inline void CEikButtonGroupContainer::AddCommandToStackL(
williamr@2
  1209
    TInt aPosition,
williamr@2
  1210
    TInt aCommandId,
williamr@2
  1211
    const TDesC& aText)
williamr@2
  1212
    {
williamr@2
  1213
    DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, EPush);
williamr@2
  1214
    }
williamr@2
  1215
williamr@2
  1216
inline void CEikButtonGroupContainer::AddCommandToStackL(
williamr@2
  1217
    TInt aPosition,
williamr@2
  1218
    TInt aCommandId,
williamr@2
  1219
    const CFbsBitmap& aBitmap,
williamr@2
  1220
    const CFbsBitmap& aMask)
williamr@2
  1221
    {
williamr@2
  1222
    DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, EPush);
williamr@2
  1223
    }
williamr@2
  1224
williamr@2
  1225
inline void CEikButtonGroupContainer::AddCommandToStackL(
williamr@2
  1226
    TInt aPosition,
williamr@2
  1227
    TInt aCommandId,
williamr@2
  1228
    const TDesC& aText,
williamr@2
  1229
    const CFbsBitmap& aBitmap,
williamr@2
  1230
    const CFbsBitmap& aMask)
williamr@2
  1231
    {
williamr@2
  1232
    DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, EPush);
williamr@2
  1233
    }
williamr@2
  1234
williamr@2
  1235
inline void CEikButtonGroupContainer::AddCommandToStackL(
williamr@2
  1236
    TInt aPosition,
williamr@2
  1237
    TInt aCommandId,
williamr@2
  1238
    const TDesC& aFile,
williamr@2
  1239
    TInt aBitmapId,
williamr@2
  1240
    TInt aMaskId)
williamr@2
  1241
    {
williamr@2
  1242
    DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, EPush);
williamr@2
  1243
    }
williamr@2
  1244
williamr@2
  1245
inline void CEikButtonGroupContainer::AddCommandToStackL(
williamr@2
  1246
    TInt aPosition,
williamr@2
  1247
    TInt aCommandId,
williamr@2
  1248
    const TDesC& aText,
williamr@2
  1249
    const TDesC& aFile,
williamr@2
  1250
    TInt aBitmapId,
williamr@2
  1251
    TInt aMaskId)
williamr@2
  1252
    {
williamr@2
  1253
    DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, EPush);
williamr@2
  1254
    }
williamr@2
  1255
williamr@2
  1256
inline void CEikButtonGroupContainer::AddCommandToStackL(
williamr@2
  1257
    TInt aPosition,
williamr@2
  1258
    TInt aResourceId)
williamr@2
  1259
    {
williamr@2
  1260
    DoSetCommandL(aPosition, aResourceId, EPush);
williamr@2
  1261
    }
williamr@2
  1262
williamr@2
  1263
inline void CEikButtonGroupContainer::CleanupCommandPop()
williamr@2
  1264
    {
williamr@2
  1265
    CleanupCommandPop(1);
williamr@2
  1266
    }
williamr@2
  1267
williamr@2
  1268
inline void CEikButtonGroupContainer::CleanupCommandPopAndDestroy()
williamr@2
  1269
    {
williamr@2
  1270
    CleanupStack::PopAndDestroy();
williamr@2
  1271
    }
williamr@2
  1272
williamr@2
  1273
inline void CEikButtonGroupContainer::CleanupCommandPopAndDestroy(TInt aCount)
williamr@2
  1274
    {
williamr@2
  1275
    CleanupStack::PopAndDestroy(aCount);
williamr@2
  1276
    }
williamr@2
  1277
williamr@2
  1278
inline MEikButtonGroup* CEikButtonGroupContainer::ButtonGroup()
williamr@2
  1279
    {
williamr@2
  1280
    return iButtonGroup;
williamr@2
  1281
    }
williamr@2
  1282
williamr@2
  1283
inline CEikButtonGroupContainer::TUse CEikButtonGroupContainer::ButtonGroupType()
williamr@2
  1284
    {
williamr@2
  1285
    return iUse;
williamr@2
  1286
    }
williamr@2
  1287
williamr@2
  1288
#endif // __EIKBTGPC_H__