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