epoc32/include/mw/aknbutton.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) 2005-2008 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:  Button component.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef __AKNBUTTON_H__
williamr@2
    21
#define __AKNBUTTON_H__
williamr@2
    22
williamr@2
    23
//  INCLUDES
williamr@4
    24
#include <AknControl.h>
williamr@4
    25
#include <AknIconUtils.h>
williamr@4
    26
#include <AknUtils.h>
williamr@2
    27
williamr@2
    28
// FORWARD DECLARATIONS
williamr@2
    29
class CGulIcon;
williamr@2
    30
class CAknButton;
williamr@2
    31
class CAknButtonExtension; 
williamr@2
    32
class CAknInfoPopupNoteController;
williamr@2
    33
class CAknButtonStateExtension;
williamr@2
    34
class CAknPictographInterface;
williamr@2
    35
class CAknsFrameBackgroundControlContext;
williamr@2
    36
class CAknResourceProvider;
williamr@2
    37
williamr@2
    38
// CLASS DECLARATION
williamr@2
    39
williamr@2
    40
/**
williamr@2
    41
*  Class which represents one of the button states. 
williamr@2
    42
*
williamr@2
    43
*  @lib eikcoctl.lib
williamr@2
    44
*  @since Series 60 3.1
williamr@2
    45
*/
williamr@2
    46
class CAknButtonState : public CBase
williamr@2
    47
    {           
williamr@2
    48
    public: // Constructors and destructors
williamr@2
    49
williamr@2
    50
        /**
williamr@2
    51
         * Destructor.
williamr@2
    52
         */
williamr@2
    53
        IMPORT_C ~CAknButtonState();
williamr@2
    54
williamr@2
    55
    protected: // Constructors and destructors
williamr@2
    56
williamr@2
    57
        /**
williamr@2
    58
         * Constructor.
williamr@2
    59
         *
williamr@2
    60
         * @param aFlags The flags for the button state
williamr@2
    61
         */
williamr@2
    62
        IMPORT_C CAknButtonState( const TInt aFlags );
williamr@2
    63
williamr@2
    64
        /**
williamr@2
    65
         * Symbian 2nd phase constructor.
williamr@2
    66
         *
williamr@2
    67
         * @param aIcon The icon for the normal state. Takes ownership.
williamr@2
    68
         * @param aDimmedIcon The icon for the dimmed state. Takes ownership.
williamr@2
    69
         * @param aPressedIcon The icon for the pressed down. Takes ownership.
williamr@2
    70
         * @param aHoverIcon The icon for the hover state. Takes ownership.
williamr@2
    71
         * @param aText The text inside the button.
williamr@2
    72
         * @param aHelpText The text for the tooltip.
williamr@2
    73
         */
williamr@2
    74
        IMPORT_C void ConstructL( CGulIcon* aIcon,
williamr@2
    75
                                  CGulIcon* aDimmedIcon, 
williamr@2
    76
                                  CGulIcon* aPressedIcon,
williamr@2
    77
                                  CGulIcon* aHoverIcon,
williamr@2
    78
                                  const TDesC& aText, 
williamr@2
    79
                                  const TDesC& aHelpText );
williamr@2
    80
williamr@2
    81
        /**
williamr@2
    82
         * Symbian 2nd phase constructor.
williamr@2
    83
         *
williamr@2
    84
         * @param aFilePath The path to the file which contains icons.
williamr@2
    85
         * @param aBmpId The bitmap ID for the normal state icon.
williamr@2
    86
         * @param aMaskId The mask ID for the normal state icon.
williamr@2
    87
         * @param aDimmedBmpId The bitmap ID for the dimmed state icon.
williamr@2
    88
         * @param aDimmedMaskId The mask ID for the dimmed state icon.
williamr@2
    89
         * @param aPressedBmpId The bitmap ID for the pressed down state.
williamr@2
    90
         * @param aPressedMaskId The mask ID for the pressed down state.
williamr@2
    91
         * @param aHoverBmpId The bitmap ID for the hover state icon.
williamr@2
    92
         * @param aHoverMaskId The mask ID for the hover state icon.
williamr@2
    93
         * @param aText The text inside the button.
williamr@2
    94
         * @param aHelpText The text for the tooltip.
williamr@2
    95
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
    96
         *          specific icon.
williamr@2
    97
         * @param aDimmedId Item ID of the dimmed masked bitmap to be created
williamr@2
    98
         *          for skin specific icon.
williamr@2
    99
         * @param aPressedId Item ID of the pressed masked bitmap to be created
williamr@2
   100
         *          for skin specific icon.
williamr@2
   101
         * @param aHoverId Item ID of the masked hover bitmap to be created
williamr@2
   102
         *          for skin specific icon.
williamr@2
   103
         */
williamr@2
   104
        IMPORT_C void ConstructL( const TDesC& aFilePath, 
williamr@2
   105
                                  const TInt aBmpId, 
williamr@2
   106
                                  const TInt aMaskId,
williamr@2
   107
                                  const TInt aDimmedBmpId, 
williamr@2
   108
                                  const TInt aDimmedMaskId,
williamr@2
   109
                                  const TInt aPressedBmpId, 
williamr@2
   110
                                  const TInt aPressedMaskId,
williamr@2
   111
                                  const TInt aHoverBmpId,
williamr@2
   112
                                  const TInt aHoverMaskId,
williamr@2
   113
                                  const TDesC& aText, 
williamr@2
   114
                                  const TDesC& aHelpText,
williamr@2
   115
                                  const TAknsItemID& aId = KAknsIIDNone, 
williamr@2
   116
                                  const TAknsItemID& aDimmedId = KAknsIIDNone, 
williamr@2
   117
                                  const TAknsItemID& aPressedId = KAknsIIDNone,
williamr@2
   118
                                  const TAknsItemID& aHoverId = KAknsIIDNone );
williamr@2
   119
williamr@2
   120
    public: // New functions
williamr@2
   121
williamr@2
   122
        /**
williamr@2
   123
         * Provides the icon for the normal state.
williamr@2
   124
         *
williamr@2
   125
         * @return The icon for the normal state.
williamr@2
   126
         */
williamr@2
   127
        IMPORT_C const CGulIcon* Icon() const;
williamr@2
   128
williamr@2
   129
        /**
williamr@2
   130
         * Provides the icon for the dimmed state.
williamr@2
   131
         *
williamr@2
   132
         * @return The icon for the dimmed state.
williamr@2
   133
         */
williamr@2
   134
        IMPORT_C const CGulIcon* DimmedIcon() const;
williamr@2
   135
williamr@2
   136
        /**
williamr@2
   137
         * Provides the icon for the pressed down (not released) state.
williamr@2
   138
         *
williamr@2
   139
         * @return The icon for the pressed down (not released) state.
williamr@2
   140
         */
williamr@2
   141
        IMPORT_C const CGulIcon* PressedIcon() const;
williamr@2
   142
        
williamr@2
   143
        /**
williamr@2
   144
         * Provides the icon for the hover state.
williamr@2
   145
         *
williamr@2
   146
         * @return The icon for the hover state.
williamr@2
   147
         */
williamr@2
   148
        IMPORT_C const CGulIcon* HoverIcon() const;
williamr@2
   149
williamr@2
   150
        /**
williamr@2
   151
         * Provides the text inside the button.
williamr@2
   152
         *
williamr@2
   153
         * @return The button text.
williamr@2
   154
         */
williamr@2
   155
        IMPORT_C const TDesC& Text() const;
williamr@2
   156
williamr@2
   157
        /**
williamr@2
   158
         * Provides the text inside the help note.
williamr@2
   159
         *
williamr@2
   160
         * @return The tooltip text.
williamr@2
   161
         */
williamr@2
   162
        IMPORT_C const TDesC& HelpText() const;
williamr@2
   163
williamr@2
   164
        /**
williamr@2
   165
         * Provides the flags for the state.
williamr@2
   166
         *
williamr@2
   167
         * @return The state flags.
williamr@2
   168
         */
williamr@2
   169
        IMPORT_C TInt Flags() const;
williamr@2
   170
williamr@2
   171
        /**
williamr@2
   172
         * Sets the icon for the normal state. Takes ownership.
williamr@2
   173
         *
williamr@2
   174
         * @param aIcon The icon for the normal state.
williamr@2
   175
         */
williamr@2
   176
        IMPORT_C void SetIcon( CGulIcon* aIcon );
williamr@2
   177
williamr@2
   178
        /**
williamr@2
   179
         * Sets the icon for the dimmed state. Takes ownership.
williamr@2
   180
         *
williamr@2
   181
         * @param aDimmedIcon The icon for the dimmed state.
williamr@2
   182
         */
williamr@2
   183
        IMPORT_C void SetDimmedIcon( CGulIcon* aDimmedIcon );
williamr@2
   184
williamr@2
   185
        /**
williamr@2
   186
         * Sets the icon for the pressed down state. Takes ownership.
williamr@2
   187
         *
williamr@2
   188
         * @param aPressedIcon The icon for the pressed down state.
williamr@2
   189
         */
williamr@2
   190
        IMPORT_C void SetPressedIcon( CGulIcon* aPressedIcon );
williamr@2
   191
williamr@2
   192
        /**
williamr@2
   193
         * Sets the icon for the hover state. Takes ownership.
williamr@2
   194
         *
williamr@2
   195
         * @param aHoverIcon The icon for the hover state.
williamr@2
   196
         */
williamr@2
   197
        IMPORT_C void SetHoverIcon( CGulIcon* aHoverIcon );
williamr@2
   198
williamr@2
   199
        /**
williamr@2
   200
         * Sets the text inside the button.
williamr@2
   201
         *
williamr@2
   202
         * @param aText The text inside the button.
williamr@2
   203
         */
williamr@2
   204
        IMPORT_C void SetTextL( const TDesC& aText );
williamr@2
   205
williamr@2
   206
        /**
williamr@2
   207
         * Sets the text inside the help note.
williamr@2
   208
         *
williamr@2
   209
         * @param aHelpText The text inside the tooltip.
williamr@2
   210
         */
williamr@2
   211
        IMPORT_C void SetHelpTextL( const TDesC& aHelpText );
williamr@2
   212
williamr@2
   213
        /**
williamr@2
   214
         * Sets the flags for the state.
williamr@2
   215
         *
williamr@2
   216
         * @param aFlags The flags for the state.
williamr@2
   217
         */
williamr@2
   218
        IMPORT_C void SetFlags( const TInt aFlags );
williamr@2
   219
        
williamr@2
   220
        /**
williamr@2
   221
         * Sets the icon for the normal state
williamr@2
   222
         *
williamr@2
   223
         * @param aFlags The flags for the state.
williamr@2
   224
         */
williamr@2
   225
        void UpdateIconL( const TDesC& aFilePath, 
williamr@2
   226
                          const TInt aBmpId, 
williamr@2
   227
                          const TInt aMaskId,
williamr@2
   228
                          const TInt aDimmedBmpId, 
williamr@2
   229
                          const TInt aDimmedMaskId,
williamr@2
   230
                          const TInt aPressedBmpId, 
williamr@2
   231
                          const TInt aPressedMaskId,
williamr@2
   232
                          const TInt aHoverBmpId,
williamr@2
   233
                          const TInt aHoverMaskId,
williamr@2
   234
                          const TAknsItemID& aId = KAknsIIDNone, 
williamr@2
   235
                          const TAknsItemID& aDimmedId = KAknsIIDNone, 
williamr@2
   236
                          const TAknsItemID& aPressedId = KAknsIIDNone,
williamr@2
   237
                          const TAknsItemID& aHoverId = KAknsIIDNone );
williamr@2
   238
        
williamr@2
   239
        
williamr@2
   240
        
williamr@2
   241
    protected: // New functions
williamr@2
   242
williamr@2
   243
        /**
williamr@2
   244
         * Constructs controls from a resource file.
williamr@2
   245
         * @param aReader The resource reader with which to access the
williamr@2
   246
         *          control's resource values.
williamr@2
   247
         */
williamr@2
   248
        IMPORT_C virtual void ConstructFromResourceL( TResourceReader& aReader );
williamr@2
   249
williamr@2
   250
        /**
williamr@2
   251
         * Updates the size of icons. Called from CAknButton::SizeChanged() 
williamr@2
   252
         * function.
williamr@2
   253
         *
williamr@2
   254
         * @param aRect The new rectangle for the icons.
williamr@2
   255
         * @param aScaleMode The scale mode which was set for the button.
williamr@2
   256
         */
williamr@2
   257
        IMPORT_C virtual void SizeChanged( const TRect& aRect, 
williamr@2
   258
                                           TScaleMode aScaleMode );
williamr@2
   259
williamr@2
   260
        /**
williamr@2
   261
         * @return ETrue if the button has valid text (not empty and not space).
williamr@2
   262
         */
williamr@2
   263
        IMPORT_C TBool HasText() const;
williamr@2
   264
williamr@2
   265
        /**
williamr@2
   266
         * @return ETrue if the button has valid tooltip text (not empty and 
williamr@2
   267
         *          not space).
williamr@2
   268
         */
williamr@2
   269
        IMPORT_C TBool HasHelp() const;
williamr@2
   270
        
williamr@2
   271
        /**
williamr@2
   272
        * Handles changes in state's environment.
williamr@2
   273
        *
williamr@2
   274
        * @since S60 3.2.
williamr@2
   275
        * @param aType Resource change's type.
williamr@2
   276
        */
williamr@2
   277
        void HandleResourceChange( TInt aType );
williamr@2
   278
        
williamr@2
   279
        /**
williamr@2
   280
        * Sets default scaling mode.
williamr@2
   281
        *
williamr@2
   282
        * @since S60 3.2
williamr@2
   283
        * @param aScaleMode Scaling mode.
williamr@2
   284
        */
williamr@2
   285
        void SetIconScaleMode( const TScaleMode aScaleMode );
williamr@2
   286
williamr@2
   287
    private: // new functions
williamr@2
   288
williamr@2
   289
        /**
williamr@2
   290
         * Creates one icon based on the specified file path and IDs.
williamr@2
   291
         *
williamr@2
   292
         * @param aIcon The icon object which is created and returned. 
williamr@2
   293
         *      Will be deleted if it is not NULL on entry.
williamr@2
   294
         * @param aFilePath The path to the file which contains icons.
williamr@2
   295
         * @param aBmpId The bitmap ID for the icon.
williamr@2
   296
         * @param aMaskId The mask ID for the icon.
williamr@2
   297
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
   298
         *      specific icon.
williamr@2
   299
         */
williamr@2
   300
        void CreateButtonIconL( CGulIcon*& aIcon, const TDesC& aFilePath, 
williamr@2
   301
                                TInt aBmpId, TInt aMaskId, 
williamr@2
   302
                                const TAknsItemID& aId = KAknsIIDNone ) const;
williamr@2
   303
                                
williamr@2
   304
        /**
williamr@2
   305
         * Loads one icon based on the specified file path and IDs. If the icon
williamr@2
   306
         * is already loaded it is deleted and replaced with a reloaded copy.
williamr@2
   307
         *
williamr@2
   308
         * @since S60 3.2
williamr@2
   309
         * @param aIcon The icon object which is created and returned. 
williamr@2
   310
         *      Will be deleted if it is not NULL on entry.
williamr@2
   311
         * @param aFilePath The path to the file which contains icons.
williamr@2
   312
         * @param aBmpId The bitmap ID for the icon.
williamr@2
   313
         * @param aMaskId The mask ID for the icon.
williamr@2
   314
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
   315
         *      specific icon.
williamr@2
   316
         */
williamr@2
   317
        void LoadButtonIcon( CGulIcon*& aIcon ) const;
williamr@2
   318
                                
williamr@2
   319
        /**
williamr@2
   320
         * Replaces the given icon with a new one. If the original icon had its
williamr@2
   321
         * size set then the new icon is scaled to that size.
williamr@2
   322
         *
williamr@2
   323
         * @since S60 3.2
williamr@2
   324
         */
williamr@2
   325
        void ReplaceIcon( CGulIcon*& aIcon, CGulIcon* aNewIcon );
williamr@2
   326
                          
williamr@2
   327
        /**
williamr@2
   328
        * Scales all icons.
williamr@2
   329
        *
williamr@2
   330
        * @since S60 3.2
williamr@2
   331
        * @param aSize New icon size.
williamr@2
   332
        * @param aScaleMode Scaling mode.
williamr@2
   333
        * @return KErrNone or an error code.
williamr@2
   334
        */
williamr@2
   335
        TInt ScaleIcons( const TSize& aSize, TScaleMode aScaleMode );
williamr@2
   336
williamr@2
   337
        /**
williamr@2
   338
         * @return The extension object.
williamr@2
   339
         */
williamr@2
   340
        CAknButtonStateExtension* Extension() const;
williamr@2
   341
williamr@2
   342
        /**
williamr@2
   343
         * @return The scalemode of the ButtonState
williamr@2
   344
         */
williamr@2
   345
        TScaleMode ScaleMode() const;
williamr@2
   346
        
williamr@2
   347
        /**
williamr@2
   348
         * @param aDimmedIconCreatedByButton ETrue, if the dimmed icon of the state is 
williamr@2
   349
         * created by owning Button
williamr@2
   350
         */
williamr@2
   351
        void SetGeneratedDimmedIcon( TBool aDimmedIconCreatedByButton );
williamr@2
   352
williamr@2
   353
        friend class CAknButton;
williamr@2
   354
williamr@2
   355
    protected: // data
williamr@2
   356
        CGulIcon*   iIcon;                      // bitmaps for normal state
williamr@2
   357
        CGulIcon*   iDimmedIcon;                // bitmaps for dimmed icon
williamr@2
   358
        CGulIcon*   iPressedIcon;               // bitmaps for pressed but not activated state
williamr@2
   359
        CGulIcon*   iHoverIcon;                 // bitmaps for hover icon
williamr@2
   360
        HBufC*      iText;                      // text for normal state
williamr@2
   361
        HBufC*      iHelpText;                  // text which is shown as a help
williamr@2
   362
        TInt        iFlags;                     // flags for the state
williamr@2
   363
        CAknButtonStateExtension* iExtension;   // for future extensions
williamr@2
   364
    };
williamr@2
   365
williamr@2
   366
williamr@2
   367
// CLASS DECLARATION
williamr@2
   368
williamr@2
   369
/**
williamr@2
   370
*  Generic button class.
williamr@2
   371
*
williamr@2
   372
*  @lib eikcoctl.lib
williamr@2
   373
*  @since Series 60 3.1
williamr@2
   374
*/
williamr@2
   375
class CAknButton : public CAknControl
williamr@2
   376
    {
williamr@2
   377
    public: // Enumerations
williamr@2
   378
williamr@2
   379
        enum TAlignment
williamr@2
   380
            {
williamr@2
   381
            ECenter, /* align center vertically or horizontally */
williamr@2
   382
            ETop, /* align to top vertically */
williamr@2
   383
            EBottom, /* align to bottom vertically */
williamr@2
   384
            ERight, /* align to right horizontally */
williamr@2
   385
            ELeft /* align to left horixontally */
williamr@2
   386
            };
williamr@2
   387
williamr@2
   388
        enum TTooltipPosition
williamr@2
   389
            {
williamr@2
   390
            EPositionTop = 1, /* Tool tip alignment vertically to top */
williamr@2
   391
            EPositionBottom, /* Tool tip alignment vertically to bottom */
williamr@2
   392
            EPositionLeft, /* Tool tip alignment horizontally to left */
williamr@2
   393
            EPositionRight /* Tool tip alignment horizontally to right */
williamr@2
   394
            };
williamr@2
   395
            
williamr@2
   396
        enum TTextAndIconAlignment
williamr@2
   397
            {
williamr@2
   398
            EIconBeforeText, /* Icon and text side by side Icon first */
williamr@2
   399
            EIconAfterText,  /* Icon and text side by side Text first */
williamr@2
   400
            EIconUnderText,  /* Icon and text one upon the other Icon under the text */
williamr@2
   401
            EIconOverText,   /* Icon and text one upon the other Icon over the text */
williamr@2
   402
            EOverlay         /* Icon and text overlaid */
williamr@2
   403
            };            
williamr@2
   404
williamr@2
   405
        enum TButtonEvent
williamr@2
   406
            {
williamr@2
   407
            ELongPressEvent = 100, /* Observer event for long press event */
williamr@2
   408
            ELongPressEndedEvent   /* Observer event for long press ended event */
williamr@2
   409
            };
williamr@2
   410
williamr@2
   411
    public: // Constructors and destructors
williamr@2
   412
    
williamr@2
   413
        /**
williamr@2
   414
         * Two-phased constructor.
williamr@2
   415
         * Constructs an empty button.
williamr@2
   416
         */
williamr@2
   417
        IMPORT_C static CAknButton* NewL();
williamr@2
   418
        
williamr@2
   419
        /**
williamr@2
   420
         * Two-phased constructor. Constructs an empty button.
williamr@2
   421
         */
williamr@2
   422
        IMPORT_C static CAknButton* NewLC();
williamr@2
   423
        
williamr@2
   424
        /**
williamr@2
   425
         * Two-phased constructor. Constructs the button from resources.
williamr@2
   426
         *
williamr@2
   427
         * @param aReader is the resource reader with which to access 
williamr@2
   428
         *      the control's resource values.
williamr@2
   429
         */
williamr@2
   430
        IMPORT_C static CAknButton* NewL( TResourceReader& aReader );
williamr@2
   431
        
williamr@2
   432
        /**
williamr@2
   433
         * Two-phased constructor. Constructs the button from resources.
williamr@2
   434
         *
williamr@2
   435
         * @param aReader is the resource reader with which to access 
williamr@2
   436
         *      the control's resource values. 
williamr@2
   437
         */
williamr@2
   438
        IMPORT_C static CAknButton* NewLC( TResourceReader& aReader ); 
williamr@2
   439
        
williamr@2
   440
        /**
williamr@2
   441
         * Two-phased constructor. Constructs the button from resources.
williamr@2
   442
         * 
williamr@2
   443
         * @param aResourceId is the ID for this component's resource.
williamr@2
   444
         */
williamr@2
   445
        IMPORT_C static CAknButton* NewL( const TInt aResourceId );
williamr@2
   446
        
williamr@2
   447
        /**
williamr@2
   448
         * Two-phased constructor. Constructs the button from resources. 
williamr@2
   449
         * 
williamr@2
   450
         * @param aResourceId is the ID for this component's resource.
williamr@2
   451
         */
williamr@2
   452
        IMPORT_C static CAknButton* NewLC( const TInt aResourceId );
williamr@2
   453
williamr@2
   454
        /**
williamr@2
   455
         * Two-phased constructor. Constructs one state button.
williamr@2
   456
         *
williamr@2
   457
         * @param aIcon The icon for the normal state. Takes ownership.
williamr@2
   458
         * @param aDimmedIcon The icon for the dimmed state. Takes ownership.
williamr@2
   459
         * @param aPressedIcon The icon for the pressed down. Takes ownership.
williamr@2
   460
         * @param aHoverIcon The icon for the hover state. Takes ownership.
williamr@2
   461
         * @param aText The text inside the button.
williamr@2
   462
         * @param aHelpText The text for the tooltip.
williamr@2
   463
         * @param aButtonFlags The flags for the button.
williamr@2
   464
         * @param aStateFlags The flags for the first state.
williamr@2
   465
         */
williamr@2
   466
        IMPORT_C static CAknButton* NewL( CGulIcon* aIcon, 
williamr@2
   467
                                          CGulIcon* aDimmedIcon,
williamr@2
   468
                                          CGulIcon* aPressedIcon,
williamr@2
   469
                                          CGulIcon* aHoverIcon,
williamr@2
   470
                                          const TDesC& aText, 
williamr@2
   471
                                          const TDesC& aHelpText, 
williamr@2
   472
                                          const TInt aButtonFlags,
williamr@2
   473
                                          const TInt aStateFlags );
williamr@2
   474
williamr@2
   475
        /**
williamr@2
   476
         * Two-phased constructor. Constructs one state button.
williamr@2
   477
         *
williamr@2
   478
         * @param aIcon The icon for the normal state. Takes ownership.
williamr@2
   479
         * @param aDimmedIcon The icon for the dimmed state. Takes ownership.
williamr@2
   480
         * @param aPressedIcon The icon for the pressed down. Takes ownership.
williamr@2
   481
         * @param aHoverIcon The icon for the hover state. Takes ownership.
williamr@2
   482
         * @param aText The text inside the button.
williamr@2
   483
         * @param aHelpText The text for the tooltip.
williamr@2
   484
         * @param aButtonFlags The flags for the button.
williamr@2
   485
         * @param aStateFlags The flags for the first state.
williamr@2
   486
         */
williamr@2
   487
        IMPORT_C static CAknButton* NewLC( CGulIcon* aIcon, 
williamr@2
   488
                                           CGulIcon* aDimmedIcon,
williamr@2
   489
                                           CGulIcon* aPressedIcon,
williamr@2
   490
                                           CGulIcon* aHoverIcon,
williamr@2
   491
                                           const TDesC& aText, 
williamr@2
   492
                                           const TDesC& aHelpText, 
williamr@2
   493
                                           const TInt aFlags,
williamr@2
   494
                                           const TInt aStateFlags );
williamr@2
   495
williamr@2
   496
        /**
williamr@2
   497
         * Two-phased constructor. Constructs one state button.
williamr@2
   498
         *
williamr@2
   499
         * @param aFilePath The path to the file which contains icons.
williamr@2
   500
         * @param aBmpId The bitmap ID for the normal state icon.
williamr@2
   501
         * @param aMaskId The mask ID for the normal state icon.
williamr@2
   502
         * @param aDimmedBmpId The bitmap ID for the dimmed state icon.
williamr@2
   503
         * @param aDimmedMaskId The mask ID for the dimmed state icon.
williamr@2
   504
         * @param aPressedBmpId The bitmap ID for the pressed down state.
williamr@2
   505
         * @param aPressedMaskId The mask ID for the pressed down state.
williamr@2
   506
         * @param aHoverBmpId The bitmap ID for the hover state.
williamr@2
   507
         * @param aHoverMaskId The mask ID for the hover state.
williamr@2
   508
         * @param aText The text inside the button.
williamr@2
   509
         * @param aHelpText The text for the tooltip.
williamr@2
   510
         * @param aButtonFlags The flags for the button.
williamr@2
   511
         * @param aStateFlags The flags for the first state.
williamr@2
   512
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
   513
         *      specific icon.
williamr@2
   514
         * @param aDimmedId Item ID of the dimmed masked bitmap to be created 
williamr@2
   515
         *      for skin specific icon.
williamr@2
   516
         * @param aPressedId Item ID of the pressed masked bitmap to be created 
williamr@2
   517
         *      for skin specific icon.
williamr@2
   518
         * @param aHoverId Item ID of the masked hover bitmap to be created
williamr@2
   519
         *      for skin specific icon.
williamr@2
   520
         */
williamr@2
   521
        IMPORT_C static CAknButton* NewL( const TDesC& aFilePath, 
williamr@2
   522
                                          const TInt aBmpId, 
williamr@2
   523
                                          const TInt aMaskId,
williamr@2
   524
                                          const TInt aDimmedBmpId, 
williamr@2
   525
                                          const TInt aDimmedMaskId,
williamr@2
   526
                                          const TInt aPressedBmpId, 
williamr@2
   527
                                          const TInt aPressedMaskId,
williamr@2
   528
                                          const TInt aHoverBmpId,
williamr@2
   529
                                          const TInt aHoverMaskId,
williamr@2
   530
                                          const TDesC& aText, 
williamr@2
   531
                                          const TDesC& aHelpText, 
williamr@2
   532
                                          const TInt aButtonFlags, 
williamr@2
   533
                                          const TInt aStateFlags,
williamr@2
   534
                                          const TAknsItemID& aId = KAknsIIDNone, 
williamr@2
   535
                                          const TAknsItemID& aDimmedId = KAknsIIDNone, 
williamr@2
   536
                                          const TAknsItemID& aPressedId = KAknsIIDNone,
williamr@2
   537
                                          const TAknsItemID& aHoverId = KAknsIIDNone );
williamr@2
   538
williamr@2
   539
        /**
williamr@2
   540
         * Two-phased constructor. Constructs one state button.
williamr@2
   541
         *
williamr@2
   542
         * @param aFilePath The path to the file which contains icons.
williamr@2
   543
         * @param aBmpId The bitmap ID for the normal state icon.
williamr@2
   544
         * @param aMaskId The mask ID for the normal state icon.
williamr@2
   545
         * @param aDimmedBmpId The bitmap ID for the dimmed state icon.
williamr@2
   546
         * @param aDimmedMaskId The mask ID for the dimmed state icon.
williamr@2
   547
         * @param aPressedBmpId The bitmap ID for the pressed down state.
williamr@2
   548
         * @param aPressedMaskId The mask ID for the pressed down state.
williamr@2
   549
         * @param aHoverBmpId The bitmap ID for the hover state.
williamr@2
   550
         * @param aHoverMaskId The mask ID for the hover state.
williamr@2
   551
         * @param aText The text inside the button.
williamr@2
   552
         * @param aHelpText The text for the tooltip.
williamr@2
   553
         * @param aButtonFlags The flags for the button.
williamr@2
   554
         * @param aStateFlags The flags for the first state.
williamr@2
   555
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
   556
         *      specific icon.
williamr@2
   557
         * @param aDimmedId Item ID of the dimmed masked bitmap to be created 
williamr@2
   558
         *      for skin specific icon.
williamr@2
   559
         * @param aPressedId Item ID of the pressed masked bitmap to be created 
williamr@2
   560
         *      for skin specific icon.
williamr@2
   561
         * @param aHoverId Item ID of the hover state masked bitmap to be
williamr@2
   562
         *      created for skin specific icon.
williamr@2
   563
         */
williamr@2
   564
        IMPORT_C static CAknButton* NewLC( const TDesC& aFilePath, 
williamr@2
   565
                                           const TInt aBmpId, 
williamr@2
   566
                                           const TInt aMaskId,
williamr@2
   567
                                           const TInt aDimmedBmpId, 
williamr@2
   568
                                           const TInt aDimmedMaskId,
williamr@2
   569
                                           const TInt aPressedBmpId, 
williamr@2
   570
                                           const TInt aPressedMaskId, 
williamr@2
   571
                                           const TInt aHoverBmpId,
williamr@2
   572
                                           const TInt aHoverMaskId,
williamr@2
   573
                                           const TDesC& aText, 
williamr@2
   574
                                           const TDesC& aHelpText, 
williamr@2
   575
                                           const TInt aButtonFlags, 
williamr@2
   576
                                           const TInt aStateFlags,
williamr@2
   577
                                           const TAknsItemID& aId = KAknsIIDNone, 
williamr@2
   578
                                           const TAknsItemID& aDimmedId = KAknsIIDNone, 
williamr@2
   579
                                           const TAknsItemID& aPressedId = KAknsIIDNone,
williamr@2
   580
                                           const TAknsItemID& aHoverId = KAknsIIDNone );
williamr@2
   581
williamr@2
   582
        /**
williamr@2
   583
         * Destructor.
williamr@2
   584
         */
williamr@2
   585
        IMPORT_C virtual ~CAknButton();
williamr@2
   586
williamr@2
   587
    public: // Functions from base class
williamr@2
   588
williamr@2
   589
        /**
williamr@2
   590
         * Sets control as ready to be drawn.
williamr@2
   591
         */
williamr@2
   592
        IMPORT_C void ActivateL();
williamr@2
   593
williamr@2
   594
        /**
williamr@2
   595
         * Constructs controls from a resource file.
williamr@2
   596
         *
williamr@2
   597
         * @param aReader The resource reader, with which to access the 
williamr@2
   598
         *      control's resource values.
williamr@2
   599
         */
williamr@2
   600
        IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
williamr@2
   601
williamr@2
   602
        /**
williamr@2
   603
         * Handles a change to the control's resources.
williamr@2
   604
         *
williamr@2
   605
         * @param aType is a message UID value.
williamr@2
   606
         */
williamr@2
   607
        IMPORT_C void HandleResourceChange( TInt aType );
williamr@2
   608
williamr@2
   609
        /**
williamr@2
   610
         * Returns the control's minimum required size. It does not include the
williamr@2
   611
         * size of the highlight. However, it includes current margins.
williamr@2
   612
         * Use HighlightRect() function to get highlight rectangle for the 
williamr@2
   613
         * focused button.
williamr@2
   614
         *
williamr@2
   615
         * @return The minimum size required by the control.
williamr@2
   616
         */
williamr@2
   617
        IMPORT_C TSize MinimumSize();
williamr@2
   618
williamr@2
   619
        /**
williamr@2
   620
         * Sets button dimmed. Does not redraw the button. Note: This function
williamr@2
   621
         * does not affect the flag set with function CCoeControl::SetDimmed(),
williamr@2
   622
         * since button needs to get pointer events, even if it is dimmed.
williamr@2
   623
         * The value of the flag can be enquired using CAknButotn::IsDimmed().
williamr@2
   624
         *
williamr@2
   625
         * @param aDimmed is ETrue to dim the button, EFalse to set the button 
williamr@2
   626
         *      as not dimmed.
williamr@2
   627
         */
williamr@2
   628
        IMPORT_C void SetDimmed( TBool aDimmed );
williamr@2
   629
williamr@2
   630
        /**
williamr@2
   631
         * Handles key events.
williamr@2
   632
         *
williamr@2
   633
         * @param aKeyEvent The key event.
williamr@2
   634
         * @param aType The type of key event: EEventKey, EEventKeyUp or 
williamr@2
   635
         *      EEventKeyDown.
williamr@2
   636
         */
williamr@2
   637
        IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
williamr@2
   638
                                              TEventCode aType );
williamr@2
   639
        
williamr@2
   640
        /**
williamr@2
   641
         * Sets this control as visible or invisible.
williamr@2
   642
         *
williamr@2
   643
         * @param aVisible ETrue to make the control visible, EFalse to make 
williamr@2
   644
         *      it invisible.
williamr@2
   645
         */
williamr@2
   646
        IMPORT_C void MakeVisible( TBool aVisible );
williamr@2
   647
williamr@2
   648
        /**
williamr@2
   649
         * This function is called by the dialog framework immediately before 
williamr@2
   650
         * it removes keyboard focus from a control within a dialog.
williamr@2
   651
         * Currently has empty implementation.
williamr@2
   652
         */
williamr@2
   653
        IMPORT_C void PrepareForFocusLossL();
williamr@2
   654
williamr@2
   655
        /**
williamr@2
   656
         * Prepares the control for gaining focus.
williamr@2
   657
         * Must be used before calling SetFocus() function in case when help 
williamr@2
   658
         * note should be shown.
williamr@2
   659
         */
williamr@2
   660
        IMPORT_C void PrepareForFocusGainL(); 
williamr@2
   661
williamr@2
   662
        /**
williamr@2
   663
         * Handles pointer events.
williamr@2
   664
         *
williamr@2
   665
         * @param aPointerEvent The pointer event.
williamr@2
   666
         */
williamr@2
   667
        IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@2
   668
williamr@2
   669
        /**
williamr@2
   670
         * Responds to changes in the position of a control.
williamr@2
   671
         */
williamr@2
   672
        IMPORT_C virtual void PositionChanged();  
williamr@2
   673
williamr@2
   674
    public: // New functions
williamr@2
   675
williamr@2
   676
        /**
williamr@2
   677
         * Constructs controls from a resource file.
williamr@2
   678
         *
williamr@2
   679
         * @param aResourceId The ID for this component's resource.
williamr@2
   680
         */
williamr@2
   681
        IMPORT_C void ConstructFromResourceL( const TInt aResourceId );
williamr@2
   682
williamr@2
   683
        /**
williamr@2
   684
         * Sets button state.
williamr@2
   685
         *
williamr@2
   686
         * @param aStateIndex The index for the state, starts from 0.
williamr@2
   687
         * @param aDrawNow ETrue to redraw the button.
williamr@2
   688
         */
williamr@2
   689
        IMPORT_C virtual void SetCurrentState( const TInt aStateIndex, 
williamr@2
   690
                                               const TBool aDrawNow );
williamr@2
   691
williamr@2
   692
        /**
williamr@2
   693
         * Adds one more state for the button to the end of state array.
williamr@2
   694
         *
williamr@2
   695
         * @param aIcon The icon object containing a bitmap and a mask (if 
williamr@2
   696
         *      there is one) for the button.
williamr@2
   697
         * @param aDimmedIcon The icon object containing a bitmap and a mask 
williamr@2
   698
         *      (if there is one) for the dimmed case.
williamr@2
   699
         * @param aPressedIcon The icon object containing a bitmap and a mask
williamr@2
   700
         *      (if there is one) for the case when button is pressed.
williamr@2
   701
         * @param aHoverIcon The icon object containingg a bitmap and a mask
williamr@2
   702
         *      for the case when the pointer is hovering over the button.
williamr@2
   703
         * @param aText is the text.
williamr@2
   704
         * @param aHelpText is the text for the tooltip.
williamr@2
   705
         * @param aStateFlags The flags for the state.
williamr@2
   706
         */
williamr@2
   707
        IMPORT_C virtual void AddStateL( CGulIcon* aIcon, 
williamr@2
   708
                                         CGulIcon* aDimmedIcon, 
williamr@2
   709
                                         CGulIcon* aPressedIcon,
williamr@2
   710
                                         CGulIcon* aHoverIcon,
williamr@2
   711
                                         const TDesC& aText, 
williamr@2
   712
                                         const TDesC& aHelpText, 
williamr@2
   713
                                         const TInt aStateFlags );
williamr@2
   714
williamr@2
   715
        /**
williamr@2
   716
         * Adds one more state for the button.
williamr@2
   717
         *
williamr@2
   718
         * @param aFilePath The path to the file which contains icons.
williamr@2
   719
         * @param aBmpId The bitmap ID for the normal state icon.
williamr@2
   720
         * @param aMaskId The mask ID for the normal state icon.
williamr@2
   721
         * @param aDimmedBmpId The bitmap ID for the dimmed state icon.
williamr@2
   722
         * @param aDimmedMaskId The mask ID for the dimmed state icon.
williamr@2
   723
         * @param aPressedBmpId The bitmap ID for the pressed down state.
williamr@2
   724
         * @param aPressedMaskId The mask ID for the pressed down state.
williamr@2
   725
         * @param aHoverBmpId The bitmap ID for the hover state.
williamr@2
   726
         * @param aHoverMaskId The mask ID for the hover state.
williamr@2
   727
         * @param aHoverId Item ID of the hover state masked bitmap to be
williamr@2
   728
         *      created for skin specific icon.
williamr@2
   729
         * @param aText is the text.
williamr@2
   730
         * @param aHelpText is the text for the tooltip.
williamr@2
   731
         * @param aStateFlags The flags for the state.
williamr@2
   732
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
   733
         *      specific icon. Use KAknsIIDNone when it is not needed.
williamr@2
   734
         * @param aDimmedId Item ID of the dimmed masked bitmap to be created 
williamr@2
   735
         *      for skin specific icon. Use KAknsIIDNone when it is not needed.
williamr@2
   736
         * @param aPressedId Item ID of the pressed masked bitmap to be created 
williamr@2
   737
         *      for skin specific icon. Use KAknsIIDNone when it is not needed.
williamr@2
   738
         * @param aHoverId Item ID of the hover state masked bitmap to be
williamr@2
   739
         *      created for skin specific icon.
williamr@2
   740
         */
williamr@2
   741
        IMPORT_C virtual void AddStateL( const TDesC& aFilePath, 
williamr@2
   742
                                         const TInt aBmpId, 
williamr@2
   743
                                         const TInt aMaskId,
williamr@2
   744
                                         const TInt aDimmedBmpId, 
williamr@2
   745
                                         const TInt aDimmedMaskId,
williamr@2
   746
                                         const TInt aPressedBmpId, 
williamr@2
   747
                                         const TInt aPressedMaskId, 
williamr@2
   748
                                         const TInt aHoverBmpId,
williamr@2
   749
                                         const TInt aHoverMaskId,
williamr@2
   750
                                         const TDesC& aText,
williamr@2
   751
                                         const TDesC& aHelpText,
williamr@2
   752
                                         const TInt aStateFlags,
williamr@2
   753
                                         const TAknsItemID& aId, 
williamr@2
   754
                                         const TAknsItemID& aDimmedId, 
williamr@2
   755
                                         const TAknsItemID& aPressedId,
williamr@2
   756
                                         const TAknsItemID& aHoverId );
williamr@2
   757
        
williamr@2
   758
        /**
williamr@2
   759
         * Adds one more state for the button to the end of state array.
williamr@2
   760
         *
williamr@2
   761
         * @param  aIcon         The icon object containing a bitmap and
williamr@2
   762
         *                       a mask (if there is one) for the button.
williamr@2
   763
         * @param  aDimmedIcon   The icon object containing a bitmap and a mask 
williamr@2
   764
         *                       (if there is one) for the dimmed case.
williamr@2
   765
         * @param  aPressedIcon  The icon object containing a bitmap and a mask
williamr@2
   766
         *                       (if there is one) for the case when
williamr@2
   767
         *                       button is pressed.
williamr@2
   768
         * @param  aHoverIcon    The icon object containingg a bitmap and
williamr@2
   769
         *                       a mask for the case when the pointer is
williamr@2
   770
         *                       hovering over the button.
williamr@2
   771
         * @param  aText         is the text.
williamr@2
   772
         * @param  aHelpText     is the text for the tooltip.
williamr@2
   773
         * @param  aStateFlags   The flags for the state.
williamr@2
   774
         * @param  aCommandId    Command to be attached with the state.
williamr@2
   775
         */
williamr@2
   776
        void AddStateL( CGulIcon* aIcon, 
williamr@2
   777
                        CGulIcon* aDimmedIcon, 
williamr@2
   778
                        CGulIcon* aPressedIcon,
williamr@2
   779
                        CGulIcon* aHoverIcon,
williamr@2
   780
                        const TDesC& aText, 
williamr@2
   781
                        const TDesC& aHelpText, 
williamr@2
   782
                        const TInt aStateFlags,
williamr@2
   783
                        const TInt aCommandId );
williamr@2
   784
williamr@2
   785
        /**
williamr@2
   786
         * Sets the button flags.
williamr@2
   787
         *
williamr@2
   788
         * @param aFlags which can be combination of: KAknButtonTextLeft, 
williamr@2
   789
         *      KAknButtonSizeFitText, KAknButtonNoFrame, KAknButtonKeyRepeat,
williamr@2
   790
         *      KAknButtonReportOnKeyDown, KAknButtonNoFramePressEvent,
williamr@2
   791
         *      KAknButtonRequestExitOnButtonUpEvent, KAknButtonReportOnLongPress.
williamr@2
   792
         */
williamr@2
   793
        IMPORT_C void SetButtonFlags( const TInt aFlags );
williamr@2
   794
williamr@2
   795
        /** 
williamr@2
   796
         * Sets specified frame IDs. Can be used when default frame is not 
williamr@2
   797
         * suitable. Use KAknsIIDNone value in case when some frame or center
williamr@2
   798
         * drawing is not needed or KAknsIIDDefault when the default button
williamr@2
   799
         * frame should be used.
williamr@2
   800
         *
williamr@2
   801
         * @param aFrameId The item ID of the entire frame.
williamr@2
   802
         * @param aCenterId The item ID of the center part of the frame.
williamr@2
   803
         * @param aLatchedFrameId The item ID of the entire frame for button 
williamr@2
   804
         *      in latched state.
williamr@2
   805
         * @param aLatchedCenterId The item ID of the center part of the 
williamr@2
   806
         *      frame for button in latched state.
williamr@2
   807
         * @param aDimmedFrameId The item ID of the entire frame for a button
williamr@2
   808
         *      in dimmed state.
williamr@2
   809
         * @param aDimmedCenterId The item ID of the center part of the frame
williamr@2
   810
         *      for a button in dimmed state.
williamr@2
   811
         * @param aPressedFrameId The item ID of the entire frame for a 
williamr@2
   812
         *      button in pressed state.
williamr@2
   813
         * @param aPressedCenterId is the item ID of the center part of the 
williamr@2
   814
         *      frame for a button in pressed state.
williamr@2
   815
         * @param aLatchedDimmedFrameId The item ID of the entire frame for 
williamr@2
   816
         *      a button in latched and dimmed state.
williamr@2
   817
         * @param aLatchedDimmedCenterId The item ID of the center part of 
williamr@2
   818
         *      the frame for a button in latched and dimmed state.
williamr@2
   819
         */
williamr@2
   820
        IMPORT_C void SetFrameAndCenterIds( const TAknsItemID& aFrameId, 
williamr@2
   821
                                            const TAknsItemID& aCenterId,
williamr@2
   822
                                            const TAknsItemID& aLatchedFrameId, 
williamr@2
   823
                                            const TAknsItemID& aLatchedCenterId,
williamr@2
   824
                                            const TAknsItemID& aDimmedFrameId, 
williamr@2
   825
                                            const TAknsItemID& aDimmedCenterId,
williamr@2
   826
                                            const TAknsItemID& aPressedFrameId, 
williamr@2
   827
                                            const TAknsItemID& aPressedCenterId,
williamr@2
   828
                                            const TAknsItemID& aLatchedDimmedFrameId, 
williamr@2
   829
                                            const TAknsItemID& aLatchedDimmedCenterId );
williamr@2
   830
williamr@2
   831
        /** 
williamr@2
   832
         * Sets specified background IDs. Can be used when default frame is not
williamr@2
   833
         * suitable and the backgound is composed of only single image instead
williamr@2
   834
         * of frame and center. SetFrameAndCenterIds() function can also be used
williamr@2
   835
         * for this purpose by giving the same backround ID for both frame and
williamr@2
   836
         * center. This allows also some of the states to be composed of frames
williamr@2
   837
         * and the others from single backgound images. Use KAknsIIDNone value
williamr@2
   838
         * in case when some backgound drawing is not needed or KAknsIIDDefault
williamr@2
   839
         * when the default button frame should be used.
williamr@2
   840
         *
williamr@2
   841
         * @param aBackgroundId The item ID of the entire frame.
williamr@2
   842
         * @param aLatchedBackgroundId The item ID of the background for the
williamr@2
   843
         *      button in latched state.
williamr@2
   844
         * @param aDimmedBackgroundId The item ID of the background for the
williamr@2
   845
         *      button in dimmed state.
williamr@2
   846
         * @param aPressedBackgroundId The item ID of the background for the 
williamr@2
   847
         *      button in pressed state.
williamr@2
   848
         * @param aLatchedDimmedBackgroundId The item ID of the background for 
williamr@2
   849
         *      the button in latched and dimmed state.
williamr@2
   850
         */
williamr@2
   851
        IMPORT_C void SetBackgroundIds( const TAknsItemID& aBackgroundId, 
williamr@2
   852
                                        const TAknsItemID& aLatchedBackgroundId, 
williamr@2
   853
                                        const TAknsItemID& aDimmedBackgroundId, 
williamr@2
   854
                                        const TAknsItemID& aPressedBackgroundId, 
williamr@2
   855
                                        const TAknsItemID& aLatchedDimmedBackgroundId );
williamr@2
   856
williamr@2
   857
        /**
williamr@2
   858
         * Sets some specific text font.
williamr@2
   859
         *
williamr@2
   860
         * @param aFont The font, which should be used for the text inside the 
williamr@2
   861
         *      text button.
williamr@2
   862
         */
williamr@2
   863
        IMPORT_C void SetTextFont( const CFont* aFont );
williamr@2
   864
williamr@2
   865
        /**
williamr@2
   866
         * Sets the color table and color index for the button text. It will be
williamr@2
   867
         * used on button drawing, if color of the text shouldn't be taken from
williamr@2
   868
         * text layout.
williamr@2
   869
         *
williamr@2
   870
         * @param aTextColorTableId Id for the color table 
williamr@2
   871
         * @param aTextColorIndex Index of the color inside color table.
williamr@2
   872
         */
williamr@2
   873
        IMPORT_C void SetTextColorIds( const TAknsItemID& aTextColorTableId, 
williamr@2
   874
                                       const TInt aTextColorIndex );
williamr@2
   875
williamr@2
   876
        /**
williamr@2
   877
         * Sets the horizontal alignment for the text inside the button. It
williamr@2
   878
         * will be used, if alignment shouldn't be taken from text layout. By
williamr@2
   879
         * default it will be centered.
williamr@2
   880
         *
williamr@2
   881
         * @param aHorizontalAlignment The horizontal alignment for the text.
williamr@2
   882
         */
williamr@2
   883
        IMPORT_C void SetTextHorizontalAlignment( 
williamr@2
   884
            const CGraphicsContext::TTextAlign aHorizontalAlignment );
williamr@2
   885
williamr@2
   886
        /**
williamr@2
   887
         * Sets the vertical alignment for the text inside the button. It will 
williamr@2
   888
         * be used if alignment shouldn't be taken from text layout. By default 
williamr@2
   889
         * it will be centered.
williamr@2
   890
         *
williamr@2
   891
         * @param aVerticalAlignment The vertical alignment for the text.
williamr@2
   892
         */
williamr@2
   893
        IMPORT_C void SetTextVerticalAlignment( 
williamr@2
   894
            const CAknButton::TAlignment aVerticalAlignment );
williamr@2
   895
williamr@2
   896
        /**
williamr@2
   897
         * Sets the icon and text alignment for a button having both
williamr@2
   898
         *
williamr@2
   899
         * @param aAlignment. TTextAndIconAlignment
williamr@2
   900
         */
williamr@2
   901
        IMPORT_C void SetTextAndIconAlignment( 
williamr@2
   902
            const CAknButton::TTextAndIconAlignment aAlignment );
williamr@2
   903
williamr@2
   904
        /**
williamr@2
   905
         * Sets the text underline style for the text inside the button. By
williamr@2
   906
         * default no underline is used.
williamr@2
   907
         *
williamr@2
   908
         * @param aUnderlineStyle The style of underline.
williamr@2
   909
         */
williamr@2
   910
        IMPORT_C void SetTextUnderlineStyle( TFontUnderline aUnderlineStyle );
williamr@2
   911
williamr@2
   912
        /**
williamr@2
   913
         * Sets the scale mode for the icon inside the button. 
williamr@2
   914
         * The default is EAspectRatioNotPreserved.
williamr@2
   915
         *
williamr@2
   916
         * @param aScaleMode The scale mode.
williamr@2
   917
         */
williamr@2
   918
        IMPORT_C void SetIconScaleMode( const TScaleMode aScaleMode );
williamr@2
   919
williamr@2
   920
        /**
williamr@2
   921
         * Sets the horizontal alignment for the icon inside the button.
williamr@2
   922
         * By default it will be centered.
williamr@2
   923
         *
williamr@2
   924
         * @param aHorizontalAlignment The horizontal alignment for the icon.
williamr@2
   925
         */
williamr@2
   926
        IMPORT_C void SetIconHorizontalAlignment( 
williamr@2
   927
            const CAknButton::TAlignment aHorizontalAlignment );
williamr@2
   928
williamr@2
   929
        /**
williamr@2
   930
         * Sets the vertical alignment for the icon inside the button.
williamr@2
   931
         * By default it will be centered.
williamr@2
   932
         *
williamr@2
   933
         * @param aVerticalAlignment The vertical alignment for the icon.
williamr@2
   934
         */
williamr@2
   935
        IMPORT_C void SetIconVerticalAlignment( 
williamr@2
   936
            const CAknButton::TAlignment aVerticalAlignment );
williamr@2
   937
            
williamr@2
   938
        /**
williamr@2
   939
         * Sets the delay before the help text is shown and also specifies the 
williamr@2
   940
         * time for how long help text is visible.
williamr@2
   941
         *
williamr@2
   942
         * @param aBeforeTimeout The delay in milliseconds before text help note 
williamr@2
   943
         *      is shown. The default is 150 milliseconds.
williamr@2
   944
         * @param aInViewTimeout The interval in milliseconds during which help 
williamr@2
   945
         *      text note is shown. The default is 3000 milliseconds.
williamr@2
   946
         */
williamr@2
   947
        IMPORT_C void SetHelpNoteTimeouts( const TInt aBeforeTimeout, 
williamr@2
   948
                                           const TInt aInViewTimeout );
williamr@2
   949
williamr@2
   950
        /**
williamr@2
   951
         * Sets the interval for key repeat.
williamr@2
   952
         *
williamr@2
   953
         * @param aKeyRepeatDelay The initial delay, after which the key repeat is
williamr@2
   954
                started. The default is 500 milliseconds.
williamr@2
   955
         * @param aKeyRepeatInterval The interval in milliseconds, in which key
williamr@2
   956
         *      repeat events should be reported. The default is 500 milliseconds.
williamr@2
   957
         */
williamr@2
   958
        IMPORT_C void SetKeyRepeatInterval( const TInt aKeyRepeatDelay, 
williamr@2
   959
                                            const TInt aKeyRepeatInterval );
williamr@2
   960
        
williamr@2
   961
        /**
williamr@2
   962
         * Sets the interval for long press. When KAknButtonReportOnLongPress
williamr@2
   963
         * flag is set for the button, button will notify observer with 
williamr@2
   964
         * KAknButtonLongPressEvent as the event type, after button has been
williamr@2
   965
         * pressed for the specified time.
williamr@2
   966
         * 
williamr@2
   967
         * @param aLongPressInterval The time interval in milliseconds, after
williamr@2
   968
         *      which the long press event should be reported. The default
williamr@2
   969
         *      value is 800 milliseconds.
williamr@2
   970
         */
williamr@2
   971
        IMPORT_C void SetLongPressInterval( const TInt aLongPressInterval );
williamr@2
   972
williamr@2
   973
        /**
williamr@2
   974
         * Returns the index of the button state.
williamr@2
   975
         */
williamr@2
   976
        IMPORT_C TInt StateIndex() const;
williamr@2
   977
williamr@2
   978
        /**
williamr@2
   979
         * Enables pictograph drawing in the button text.
williamr@2
   980
         * Only effective in Japanese variant.
williamr@2
   981
         * By default, it is disabled.
williamr@2
   982
         *
williamr@2
   983
         * @param aInterface Used pictograph interface owned by the caller.
williamr@2
   984
         */
williamr@2
   985
        IMPORT_C void EnablePictographsL( CAknPictographInterface& aInterface );
williamr@2
   986
williamr@2
   987
        /**
williamr@2
   988
         * Disables pictograph drawing in the button text.
williamr@2
   989
         * Only effective in Japanese variant.
williamr@2
   990
         * By default, it is disabled.
williamr@2
   991
         */
williamr@2
   992
        IMPORT_C void DisablePictographs();
williamr@2
   993
williamr@2
   994
        /**
williamr@2
   995
         * It will change the default highlight rectangle around 
williamr@2
   996
         * the focused button.
williamr@2
   997
         *
williamr@2
   998
         * @param aRect The highlight rectangle.
williamr@2
   999
         */
williamr@2
  1000
        IMPORT_C void SetHighlightRect( const TRect& aRect );
williamr@2
  1001
williamr@2
  1002
        /**
williamr@2
  1003
         * Gets the highlight rectangle around the button.
williamr@2
  1004
         *
williamr@2
  1005
         * @return The higlight rectangle around the button.
williamr@2
  1006
         */
williamr@2
  1007
        IMPORT_C TRect HighlightRect() const;
williamr@2
  1008
williamr@2
  1009
        /**
williamr@2
  1010
         * Sets the tooltip position.
williamr@2
  1011
         *
williamr@2
  1012
         * @param aPosition The position of the tooltip.
williamr@2
  1013
         */
williamr@2
  1014
        IMPORT_C void SetTooltipPosition( const TTooltipPosition aPosition );
williamr@2
  1015
williamr@2
  1016
        /**
williamr@2
  1017
         * Sets whether button should send an EEventRequestExit event to command
williamr@2
  1018
         * observer on button up event.
williamr@2
  1019
         *
williamr@2
  1020
         * @param aRequestExit ETrue if button should request exit.
williamr@2
  1021
         */
williamr@2
  1022
        IMPORT_C void SetRequestExit( const TBool aRequestExit );
williamr@2
  1023
williamr@2
  1024
        /**
williamr@2
  1025
         * Tests if the control is dimmed. This function overrides the function
williamr@2
  1026
         * declared in CCoeControl, and returns the value which is set and unset
williamr@2
  1027
         * using CAknButton::SetDimmed().
williamr@2
  1028
         *
williamr@2
  1029
         * @return ETrue if the control is dimmed, EFalse if it is not dimmed.
williamr@2
  1030
         */
williamr@2
  1031
        IMPORT_C TBool IsDimmed() const;
williamr@2
  1032
williamr@2
  1033
        /**
williamr@2
  1034
         * Sets the help text for dimmed button.
williamr@2
  1035
         *
williamr@2
  1036
         * @param aHelpText The text inside the tooltip.
williamr@2
  1037
         */
williamr@2
  1038
        IMPORT_C void SetDimmedHelpTextL( const TDesC& aHelpText );
williamr@2
  1039
williamr@2
  1040
        /**
williamr@2
  1041
         * Check if point is within buttons visible area, when
williamr@2
  1042
         * KAknButtonHitTest flag is enabled
williamr@2
  1043
         *
williamr@2
  1044
         * @param aPoint Location to check.
williamr@2
  1045
         * @param aCheckHitArea if need to check the hit area for fixed 
williamr@2
  1046
         *        toolbar button
williamr@2
  1047
         */
williamr@2
  1048
        TBool HitAreaContainsL( const TPoint& aPoint, TBool aCheckHitArea ) const; 
williamr@2
  1049
        
williamr@2
  1050
        /**
williamr@2
  1051
         * Returns the current state of the button.
williamr@2
  1052
         *
williamr@2
  1053
         * @return the current state of the button
williamr@2
  1054
         */
williamr@2
  1055
        IMPORT_C CAknButtonState* State() const;
williamr@2
  1056
williamr@2
  1057
        /**
williamr@2
  1058
         * Returns the state of the button under specified index.
williamr@2
  1059
         *
williamr@2
  1060
         * @param aStateIndex The index for the state.
williamr@2
  1061
         * @return the state of the button.
williamr@2
  1062
         */
williamr@2
  1063
        IMPORT_C CAknButtonState* State( const TInt aStateIndex ) const;
williamr@2
  1064
williamr@2
  1065
        /**
williamr@2
  1066
         * Returns the flags of button. The flags are defined in eikon.hrh.
williamr@2
  1067
         * @return Button flags.
williamr@2
  1068
         * @since S60 3.2
williamr@2
  1069
         */
williamr@2
  1070
        IMPORT_C TInt ButtonFlags() const;
williamr@2
  1071
williamr@2
  1072
        /**
williamr@2
  1073
        * Sets button's margins. These define the free area inside the button
williamr@2
  1074
        * where content is placed. Note that calling this function overrides
williamr@2
  1075
        * default margins that are scaled automatically depending on the 
williamr@2
  1076
        * current screen layout. If this function is called then the caller
williamr@2
  1077
        * is responsible for updating margins whenever the layout changes.
williamr@2
  1078
        *
williamr@2
  1079
        * @since S60 3.2
williamr@2
  1080
        * @param aMargins New marginals.
williamr@2
  1081
        */
williamr@2
  1082
        IMPORT_C void SetMargins( const TMargins8& aMargins );
williamr@2
  1083
        
williamr@2
  1084
        /**
williamr@2
  1085
        * Sets icon size for the button. Calling this function overrides the
williamr@2
  1086
        * default size that is scaled automatically depending on the current
williamr@2
  1087
        * screen layout. If this function is called then the caller is
williamr@2
  1088
        * responsible for updating icon size whenever the layout changes.
williamr@2
  1089
        *
williamr@2
  1090
        * @since S60 3.2
williamr@2
  1091
        * @param aSize New icon size.
williamr@2
  1092
        * @return KErrNone if the operation succeeded, otherwise an error code.
williamr@2
  1093
        */
williamr@2
  1094
        IMPORT_C TInt SetIconSize( const TSize& aSize );
williamr@2
  1095
williamr@2
  1096
        /**
williamr@2
  1097
        * Checks if the button uses default margins.
williamr@2
  1098
        *
williamr@2
  1099
        * @since S60 3.2
williamr@2
  1100
        *
williamr@2
  1101
        * @return ETrue if default margins are used.
williamr@2
  1102
        */
williamr@2
  1103
        TBool UsesDefaultMargins() const;  
williamr@2
  1104
williamr@2
  1105
        /**
williamr@2
  1106
         * Sets tooltip to hide or show itself when background faded.
williamr@2
  1107
         *
williamr@2
  1108
         * @since S60 3.2
williamr@2
  1109
         * @param aHide should be ETrue if hiding, EFalse if showing
williamr@2
  1110
         */
williamr@2
  1111
        void HideTooltipWhenAppFaded( TBool aHide ); 
williamr@2
  1112
williamr@2
  1113
williamr@2
  1114
        /**
williamr@2
  1115
         */
williamr@2
  1116
        void CheckHitArea();
williamr@2
  1117
        
williamr@2
  1118
        /**
williamr@2
  1119
         * Resets button to unpressed state.
williamr@2
  1120
         *
williamr@2
  1121
         * @since S60 5.0
williamr@2
  1122
         */
williamr@2
  1123
        IMPORT_C void ResetState();
williamr@2
  1124
        
williamr@2
  1125
        /**
williamr@2
  1126
        * Sets button to use additional masks during drawing. Calling this
williamr@2
  1127
        * method forces button to bypass the normal drawing routine i.e. 
williamr@2
  1128
        * method DrawMaskedL is executed instead of Draw.
williamr@2
  1129
        *
williamr@2
  1130
        * @since S60 5.0
williamr@2
  1131
        * @param aMaskedDraw ETrue to use additional mask.
williamr@2
  1132
        */
williamr@2
  1133
        void UseMaskedDraw( TBool aMaskedDraw );
williamr@2
  1134
williamr@2
  1135
        /**
williamr@2
  1136
        * Registers resource provider.
williamr@2
  1137
        * @param aProvider New resource provider.
williamr@2
  1138
        */
williamr@2
  1139
        void RegisterResourceProvider( CAknResourceProvider* aProvider );
williamr@2
  1140
williamr@2
  1141
        /**
williamr@2
  1142
        * Unregisters resource provider.
williamr@2
  1143
        */
williamr@2
  1144
        void UnregisterResourceProvider();
williamr@2
  1145
        
williamr@2
  1146
        CAknsFrameBackgroundControlContext* BgContext();
williamr@2
  1147
        
williamr@2
  1148
        /**
williamr@2
  1149
        * Removes the currently active state from the button,
williamr@2
  1150
        * and sets the current state to the previous one.
williamr@2
  1151
        */
williamr@2
  1152
        void RemoveCurrentState();
williamr@2
  1153
williamr@2
  1154
        /**
williamr@2
  1155
        * Returns the button touchable area.
williamr@2
  1156
        *
williamr@2
  1157
        * @since S60 5.0
williamr@2
  1158
        * @return Button touch area
williamr@2
  1159
        */
williamr@2
  1160
        TRect TouchArea() const;
williamr@2
  1161
williamr@2
  1162
    protected: // Constructors
williamr@2
  1163
williamr@2
  1164
        /**
williamr@2
  1165
         * C++ constructor for the one state button.
williamr@2
  1166
         *
williamr@2
  1167
         * @param aFlags The flags for the button
williamr@2
  1168
         */
williamr@2
  1169
        IMPORT_C CAknButton( const TInt aFlags );
williamr@2
  1170
williamr@2
  1171
        /**
williamr@2
  1172
         * Symbian 2nd phase constructor.
williamr@2
  1173
         */
williamr@2
  1174
        IMPORT_C void ConstructL();
williamr@2
  1175
williamr@2
  1176
        /**
williamr@2
  1177
         * Symbian 2nd phase constructor.
williamr@2
  1178
         *
williamr@2
  1179
         * @param aIcon The icon for the normal state. Takes ownership.
williamr@2
  1180
         * @param aDimmedIcon The icon for the dimmed state. Takes ownership.
williamr@2
  1181
         * @param aPressedIcon The icon for the pressed down. Takes ownership.
williamr@2
  1182
         * @param aHoverIcon The icon for the hover state.
williamr@2
  1183
         * @param aText The text inside the button.
williamr@2
  1184
         * @param aHelpText The text for the tooltip.
williamr@2
  1185
         * @param aStateFlags The flags for the first state.
williamr@2
  1186
         */
williamr@2
  1187
        IMPORT_C void ConstructL( CGulIcon* aIcon, 
williamr@2
  1188
                                  CGulIcon* aDimmedIcon, 
williamr@2
  1189
                                  CGulIcon* aPressedIcon,
williamr@2
  1190
                                  CGulIcon* aHoverIcon,
williamr@2
  1191
                                  const TDesC& aText, 
williamr@2
  1192
                                  const TDesC& aHelpText, 
williamr@2
  1193
                                  const TInt aStateFlags );
williamr@2
  1194
williamr@2
  1195
        /**
williamr@2
  1196
         * Symbian 2nd phase constructor.
williamr@2
  1197
         *
williamr@2
  1198
         * @param aFilePath The path to the file which contains icons.
williamr@2
  1199
         * @param aBmpId The bitmap ID for the normal state icon.
williamr@2
  1200
         * @param aMaskId The mask ID for the normal state icon.
williamr@2
  1201
         * @param aDimmedBmpId The bitmap ID for the dimmed state icon.
williamr@2
  1202
         * @param aDimmedMaskId The mask ID for the dimmed state icon.
williamr@2
  1203
         * @param aPressedBmpId The bitmap ID for the pressed down state.
williamr@2
  1204
         * @param aPressedMaskId The mask ID for the pressed down state.
williamr@2
  1205
         * @param aHoverBmpId The bitmap ID for the hover state icon.
williamr@2
  1206
         * @param aHoverMaskId The mask ID for the hover state icon.
williamr@2
  1207
         * @param aText The text inside the button.
williamr@2
  1208
         * @param aHelpText The text for the tooltip.
williamr@2
  1209
         * @param aStateFlags The flags for the first state.
williamr@2
  1210
         * @param aId Item ID of the masked bitmap to be created for skin 
williamr@2
  1211
         *      specific icon.
williamr@2
  1212
         * @param aDimmedId Item ID of the dimmed masked bitmap to be created 
williamr@2
  1213
         *      for skin specific icon.
williamr@2
  1214
         * @param aPressedId Item ID of the pressed masked bitmap to be created 
williamr@2
  1215
         *      for skin specific icon.
williamr@2
  1216
         * @param aHoverId Item ID of the masked hover bitmap to be created
williamr@2
  1217
         *      for skin specific icon.
williamr@2
  1218
         */
williamr@2
  1219
        IMPORT_C void ConstructL( const TDesC& aFilePath, 
williamr@2
  1220
                                  const TInt aBmpId, 
williamr@2
  1221
                                  const TInt aMaskId,
williamr@2
  1222
                                  const TInt aDimmedBmpId, 
williamr@2
  1223
                                  const TInt aDimmedMaskId,
williamr@2
  1224
                                  const TInt aPressedBmpId, 
williamr@2
  1225
                                  const TInt aPressedMaskId, 
williamr@2
  1226
                                  const TInt aHoverBmpId,
williamr@2
  1227
                                  const TInt aHoverMaskId,
williamr@2
  1228
                                  const TDesC& aText, 
williamr@2
  1229
                                  const TDesC& aHelpText, 
williamr@2
  1230
                                  const TInt aStateFlags,
williamr@2
  1231
                                  const TAknsItemID& aId = KAknsIIDNone, 
williamr@2
  1232
                                  const TAknsItemID& aDimmedId = KAknsIIDNone, 
williamr@2
  1233
                                  const TAknsItemID& aPressedId = KAknsIIDNone,
williamr@2
  1234
                                  const TAknsItemID& aHoverId = KAknsIIDNone );
williamr@2
  1235
williamr@2
  1236
    protected: // Functions from base class
williamr@2
  1237
williamr@2
  1238
        /**
williamr@2
  1239
         * Responds to size changes to sets the size and position of the 
williamr@2
  1240
         * contents of this control.
williamr@2
  1241
         */
williamr@2
  1242
        IMPORT_C void SizeChanged();
williamr@2
  1243
williamr@2
  1244
        /**
williamr@2
  1245
         * This function is called whenever a control gains or loses focus.
williamr@2
  1246
         *
williamr@2
  1247
         * @param aDrawNow Contains the value that was passed to it by SetFocus().
williamr@2
  1248
         */
williamr@2
  1249
        IMPORT_C void FocusChanged( TDrawNow aDrawNow );
williamr@2
  1250
williamr@2
  1251
        /**
williamr@2
  1252
         * For future extensions
williamr@2
  1253
         * 
williamr@2
  1254
         * @param aInterface The ID for the extension interface.
williamr@2
  1255
         */
williamr@2
  1256
        IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
  1257
williamr@2
  1258
    protected: // New functions
williamr@2
  1259
williamr@2
  1260
        /**
williamr@2
  1261
         * Changes the state of the button to the next one.
williamr@2
  1262
         *
williamr@2
  1263
         * @return the current state index
williamr@2
  1264
         */
williamr@2
  1265
        IMPORT_C TInt ChangeState( TBool aDrawNow );
williamr@2
  1266
williamr@2
  1267
        /**
williamr@2
  1268
         * Returns the text, which will be displayed inside the button 
williamr@2
  1269
         * for the current state.
williamr@2
  1270
         */
williamr@2
  1271
        IMPORT_C const TDesC&  GetCurrentText() const;
williamr@2
  1272
williamr@2
  1273
        /**
williamr@2
  1274
         * Returns icon for the current state.
williamr@2
  1275
         */
williamr@2
  1276
        IMPORT_C const CGulIcon* GetCurrentIcon() const;
williamr@2
  1277
williamr@2
  1278
        /**
williamr@2
  1279
         * Shows help text for a certain period of time.
williamr@2
  1280
         */
williamr@2
  1281
        IMPORT_C void ShowHelpL();
williamr@2
  1282
williamr@2
  1283
        /**
williamr@2
  1284
         * Hides help text after certain interval.
williamr@2
  1285
         */
williamr@2
  1286
        IMPORT_C void HideHelp();
williamr@2
  1287
williamr@2
  1288
williamr@2
  1289
   private: // Functions from base class
williamr@2
  1290
williamr@2
  1291
        /**
williamr@2
  1292
         * From CCoeControl. Draws the control. Called by window server.
williamr@2
  1293
         */
williamr@2
  1294
        IMPORT_C void Draw( const TRect& aRect ) const;  
williamr@2
  1295
williamr@2
  1296
    private: // New functions
williamr@2
  1297
williamr@2
  1298
        /**
williamr@2
  1299
         * Continues drawing of the button which has only text.
williamr@2
  1300
         */
williamr@2
  1301
        void DrawTextButton( CWindowGc& aGc ) const;
williamr@2
  1302
williamr@2
  1303
        /**
williamr@2
  1304
         * Continues drawing of the button which has only an icon in it.
williamr@2
  1305
         */
williamr@2
  1306
        void DrawIconButton( CWindowGc& aGc ) const;
williamr@2
  1307
williamr@2
  1308
        /**
williamr@2
  1309
         * Continues drawing of the button which has both text and icon.
williamr@2
  1310
         */
williamr@2
  1311
        void DrawTextAndIconButton( CWindowGc& aGc ) const;
williamr@2
  1312
        
williamr@2
  1313
        /**
williamr@2
  1314
         * Starts the long press timer.
williamr@2
  1315
         */
williamr@2
  1316
        void StartLongPressTimerL();
williamr@2
  1317
williamr@2
  1318
        /**
williamr@2
  1319
         * Stops the long press timer.
williamr@2
  1320
         */
williamr@2
  1321
        void StopLongPressTimer();
williamr@2
  1322
williamr@2
  1323
        /**
williamr@2
  1324
         * Starts the timer for the key repeat.
williamr@2
  1325
         */
williamr@2
  1326
        void StartKeyRepeatTimerL();
williamr@2
  1327
williamr@2
  1328
        /**
williamr@2
  1329
         * Stops the key repeat timer.
williamr@2
  1330
         */
williamr@2
  1331
        void StopKeyRepeatTimer();
williamr@2
  1332
williamr@2
  1333
        /**
williamr@2
  1334
         * Called after timeout is over.
williamr@2
  1335
         */
williamr@2
  1336
        static TInt ReportKeyRepeatL( TAny* aThis );
williamr@2
  1337
williamr@2
  1338
        /**
williamr@2
  1339
         * Asserts that extension class object exists.
williamr@2
  1340
         *
williamr@2
  1341
         * @return Extension object.
williamr@2
  1342
         */
williamr@2
  1343
        CAknButtonExtension* Extension() const;
williamr@2
  1344
williamr@2
  1345
        /**
williamr@2
  1346
         * Updates tooltip position.
williamr@2
  1347
         */
williamr@2
  1348
        void UpdateTooltipPosition();
williamr@2
  1349
williamr@2
  1350
        /**
williamr@2
  1351
         * Checks whether toolbar should send an EEventRequestExit event to
williamr@2
  1352
         * command observe on button up event.
williamr@2
  1353
         *
williamr@2
  1354
         * @return ETrue if event should be sent, EFalse otherwise.
williamr@2
  1355
         */
williamr@2
  1356
        TBool RequestExit() const;
williamr@2
  1357
williamr@2
  1358
        /**
williamr@2
  1359
         * Gets the rectangele reserved for button content excluding frame.
williamr@2
  1360
         *
williamr@2
  1361
         * @return Content rectangle.
williamr@2
  1362
         */
williamr@2
  1363
        TRect ContentRect() const;
williamr@2
  1364
williamr@2
  1365
        /**
williamr@2
  1366
         * Checks whether button needs redrawing when it is pressed or released.
williamr@2
  1367
         *
williamr@2
  1368
         * @return ETrue, if redraw is needed, othewise EFalse.
williamr@2
  1369
         */
williamr@2
  1370
        TBool NeedsRedrawWhenPressed() const;
williamr@2
  1371
williamr@2
  1372
        /**
williamr@2
  1373
         * Returns the ID of specified skin item.
williamr@2
  1374
         */
williamr@2
  1375
        TAknsItemID SkinIID( const TInt aIndex ) const;
williamr@2
  1376
        
williamr@2
  1377
        /**
williamr@2
  1378
        * Calculates default margins.
williamr@2
  1379
        */
williamr@2
  1380
        void CalculateDefaultMargins();
williamr@2
  1381
        
williamr@2
  1382
        /**
williamr@2
  1383
        * Scales all icons.
williamr@2
  1384
        *
williamr@2
  1385
        * @return KErrNone or an error code.
williamr@2
  1386
        */
williamr@2
  1387
        TInt ScaleIcons();
williamr@2
  1388
        
williamr@2
  1389
        /**
williamr@2
  1390
        * Gets the correct text color.
williamr@2
  1391
        *
williamr@2
  1392
        * @return Text color.
williamr@2
  1393
        */
williamr@2
  1394
        TRgb TextColor() const;
williamr@2
  1395
williamr@2
  1396
        /**
williamr@2
  1397
        * Generates the pressed down bitmaps
williamr@2
  1398
        * if flag KAknButtonPressedDownFrame is set and button has no frame
williamr@2
  1399
        */
williamr@2
  1400
        void CreatePressedDownFrameL();
williamr@2
  1401
        
williamr@2
  1402
        /**
williamr@2
  1403
         * Calculates color's luminance. 
williamr@2
  1404
         */
williamr@2
  1405
        TInt CalculateLuminance( const TRgb& aColor ) const; 
williamr@2
  1406
williamr@2
  1407
        /**
williamr@2
  1408
         * Converts outline color, if fill color is too similar to outline color
williamr@2
  1409
         * 
williamr@2
  1410
         * @aFillColor fill color
williamr@2
  1411
         * @aOutlineColor outline color
williamr@2
  1412
         */
williamr@2
  1413
        void ConvertColorsForOutlineEffect( TRgb& aFillColor, TRgb& aOutlineColor ) const; 
williamr@2
  1414
williamr@2
  1415
        /**
williamr@2
  1416
         * Gets text colors 
williamr@2
  1417
         * 
williamr@2
  1418
         * @aPenColor pen color
williamr@2
  1419
         * @aBrushColor brush color 
williamr@2
  1420
         */
williamr@2
  1421
        void GetTextColors( TRgb& aPenColor, TRgb& aBrushColor ) const; 
williamr@2
  1422
        
williamr@2
  1423
        /**
williamr@2
  1424
         * Sets new state index 
williamr@2
  1425
         * 
williamr@2
  1426
         * @param aNewIndex New state index
williamr@2
  1427
         */
williamr@2
  1428
        void SetStateIndexL( TInt aNewIndex );
williamr@2
  1429
williamr@2
  1430
    protected: // Data
williamr@2
  1431
williamr@2
  1432
        // array to keep states
williamr@2
  1433
        CArrayPtrFlat<CAknButtonState>* iStates;
williamr@2
  1434
williamr@2
  1435
        // button flags
williamr@2
  1436
        TInt iFlags;
williamr@2
  1437
williamr@2
  1438
        // current button state index
williamr@2
  1439
        TInt iStateIndex;
williamr@2
  1440
williamr@2
  1441
        // flag to define whether the button is pressed
williamr@2
  1442
        TBool iButtonPressed;
williamr@2
  1443
williamr@2
  1444
        // number of drag events, needed to distinguish when it is outside 
williamr@2
  1445
        // the button.
williamr@2
  1446
        TInt iNumberOfDragEvents; 
williamr@2
  1447
williamr@2
  1448
        // Flag which shows whether key down event was reported before key up 
williamr@2
  1449
        // event was sent to the button, because some controls consume key down 
williamr@2
  1450
        // but don't consume key up events which might cause of button state 
williamr@2
  1451
        // when it is not expected
williamr@2
  1452
        TBool iKeyDownReported;
williamr@2
  1453
williamr@2
  1454
        // Background control context for button's frame
williamr@2
  1455
        CAknsFrameBackgroundControlContext* iBgContext;
williamr@2
  1456
williamr@2
  1457
        // Customized highlight rectangular around the button if the default one
williamr@2
  1458
        // won't be used
williamr@2
  1459
        TRect iHighlightRect;
williamr@2
  1460
williamr@2
  1461
        // text button specific data  
williamr@2
  1462
        const CFont*                    iFont;                // font for the text inside the button
williamr@2
  1463
        TAlignment                      iVerticalAlignment;   // vertical alignment for the text. Centered by default
williamr@2
  1464
        CGraphicsContext::TTextAlign    iHorizontalAlignment; // horizontal alignment for the text. Centered by default
williamr@2
  1465
        TAknsItemID                     iTextColorTableId;    // id for the color table 
williamr@2
  1466
        TInt                            iTextColorIndex;      // index of the color in color table
williamr@2
  1467
williamr@2
  1468
        // icon button specific data
williamr@2
  1469
        TScaleMode  iScaleMode; // scale mode for the icon, by default it is EAspectRatioNotPreserved
williamr@2
  1470
williamr@2
  1471
        // tooltip specific data
williamr@2
  1472
        TInt        iHelpNoteWaitInterval;         // interval in milliseconds between the time when the button got focused and the help text is shown
williamr@2
  1473
        TInt        iHelpNoteInViewInterval;       // interval during which help text is shown in milliseconds
williamr@2
  1474
        CAknInfoPopupNoteController* iHelpNote;    // component to show help text
williamr@2
  1475
        HBufC*      iDimmedHelpText;               // help text in case if the button is dimmed, not used currently
williamr@2
  1476
        TBool       iShowHelp;                     // flag which specifies whether help note should be shown 
williamr@2
  1477
williamr@2
  1478
        // Key repeat handling
williamr@2
  1479
        CPeriodic* iKeyRepeatTimer; // timer to report key repeats
williamr@2
  1480
        TInt iKeyRepeatDelay;       // initial delay for key repeats
williamr@2
  1481
        TInt iKeyRepeatInterval;    // time interval for key repeats
williamr@2
  1482
    
williamr@2
  1483
    private:
williamr@2
  1484
        CAknButtonExtension* iExtension;
williamr@2
  1485
williamr@2
  1486
    };
williamr@2
  1487
williamr@2
  1488
williamr@2
  1489
#endif // __AKNBUTTON_H__
williamr@2
  1490
williamr@2
  1491
// End of File