epoc32/include/mw/eikmenup.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined(__EIKMENUP_H__)
williamr@2
    20
#define __EIKMENUP_H__
williamr@2
    21
williamr@2
    22
#if !defined(__EIKBCTRL_H__)
williamr@2
    23
#include <eikbctrl.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined(__EIKDEF_H__)
williamr@2
    27
#include <eikdef.h>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
#if !defined(__EIKSBOBS_H__)
williamr@2
    31
#include <eiksbobs.h> // for TEikScrollEvent
williamr@2
    32
#endif
williamr@2
    33
williamr@2
    34
#include <bidi.h>
williamr@2
    35
williamr@2
    36
// FORWARD DECLARATIONS
williamr@2
    37
class MEikMenuObserver;
williamr@2
    38
class CEikHotKeyTable;
williamr@2
    39
class CEikMenuPaneTitle;
williamr@2
    40
class CEikButtonBase;
williamr@2
    41
class CEikScrollBarFrame;
williamr@2
    42
class CEikScrollBar;
williamr@2
    43
class TEikScrollBarModel;
williamr@2
    44
class CGulIcon;
williamr@2
    45
class CEikMenuPaneExtension ;
williamr@2
    46
williamr@2
    47
// CONSTANTS
williamr@2
    48
const TInt KScaleableTextSeparator = 0x0001;
williamr@2
    49
williamr@2
    50
/**
williamr@2
    51
  * A helper class for extending CEikMenuPaneItem without breaking binary 
williamr@2
    52
  * compability.
williamr@2
    53
  */
williamr@2
    54
class CExtendedItemData : public CBase
williamr@2
    55
    {
williamr@2
    56
    
williamr@2
    57
public:
williamr@2
    58
    
williamr@2
    59
    /**
williamr@2
    60
     * Destructor.
williamr@2
    61
     */
williamr@2
    62
    ~CExtendedItemData();
williamr@2
    63
    
williamr@2
    64
public:
williamr@2
    65
    
williamr@2
    66
    /** Two packaked bitmaps: bitmap icon and mask for it. */
williamr@2
    67
    CGulIcon* iIcon;
williamr@2
    68
    
williamr@2
    69
    /** Scalable text buffer. */
williamr@2
    70
    HBufC* iScaleableText;    
williamr@2
    71
    };
williamr@2
    72
williamr@2
    73
williamr@2
    74
/**
williamr@2
    75
 * The @c CEikMenuPaneItem class encapsulates the data needed to define a menu
williamr@2
    76
 * pane item and provides some of the functionality required to display the 
williamr@2
    77
 * item.
williamr@2
    78
 *
williamr@2
    79
 * @since ER5U
williamr@2
    80
 */
williamr@2
    81
class CEikMenuPaneItem : public CBase
williamr@2
    82
    {
williamr@2
    83
    
williamr@2
    84
public:
williamr@2
    85
    
williamr@2
    86
    /** Struct to menu pane item. */
williamr@2
    87
    struct SData
williamr@2
    88
        {
williamr@2
    89
        
williamr@2
    90
        /** Nominal text length.*/
williamr@2
    91
        enum { ENominalTextLength=40 };
williamr@2
    92
        
williamr@2
    93
        /** 
williamr@2
    94
         * ID of the command to issue when the menu item using this @c SData is 
williamr@2
    95
         * selected.
williamr@2
    96
         */
williamr@2
    97
        TInt iCommandId;
williamr@2
    98
        
williamr@2
    99
        /** Resource ID of a menu pane to cascade from this item. */
williamr@2
   100
        TInt iCascadeId;
williamr@2
   101
        
williamr@2
   102
        /** 
williamr@2
   103
         * Flags used internally by @c CEikMenuPane and accessible through 
williamr@2
   104
         * functions such as @c CEikMenuPane::SetItemDimmed().
williamr@2
   105
         */
williamr@2
   106
        TInt iFlags;
williamr@2
   107
        
williamr@2
   108
        /** The text buffer displayed in the main area of the menu item. */
williamr@2
   109
        TBuf<ENominalTextLength> iText; // less than this actually stored
williamr@2
   110
        
williamr@2
   111
        /** 
williamr@2
   112
         * Additional descriptive text about the item. This is used by @c 
williamr@2
   113
         * CEikMenuPane to display hotkey names.
williamr@2
   114
         */
williamr@2
   115
        TBuf<1> iExtraText;
williamr@2
   116
        };
williamr@2
   117
        
williamr@2
   118
public:
williamr@2
   119
williamr@2
   120
    /**
williamr@2
   121
     * C++ default constructor.
williamr@2
   122
     */
williamr@2
   123
    IMPORT_C CEikMenuPaneItem();
williamr@2
   124
    
williamr@2
   125
    /**
williamr@2
   126
     * Destructor.
williamr@2
   127
     */
williamr@2
   128
    IMPORT_C ~CEikMenuPaneItem();
williamr@2
   129
    
williamr@2
   130
    /**
williamr@2
   131
     * Sets a menu item icon. This replaces any icon already set for the menu
williamr@2
   132
     * item.
williamr@2
   133
     *
williamr@2
   134
     * @param aIcon Menu item icon consisting of a picture bitmap and a mask 
williamr@2
   135
     *        bitmap.
williamr@2
   136
     */
williamr@2
   137
    IMPORT_C void SetIcon(CGulIcon* aIcon);
williamr@2
   138
    
williamr@2
   139
    /**
williamr@2
   140
     * Draws the menu item icon.
williamr@2
   141
     * 
williamr@2
   142
     * @param aGc Graphics context to which the icon is drawn.
williamr@2
   143
     * @param aRect Rectangle in which the icon is drawn. 
williamr@2
   144
     * @param aDimmed If @c ETrue the icon is drawn dimmed. 
williamr@2
   145
     * @param aBitmapSpaceRequired Length of one side of the square required to 
williamr@2
   146
     *        contain the bitmap.
williamr@2
   147
     */
williamr@2
   148
    IMPORT_C void DrawItemIcon(CWindowGc& aGc, 
williamr@2
   149
                               TRect aRect, 
williamr@2
   150
                               TBool aDimmed, 
williamr@2
   151
                               TInt aBitmapSpaceRequired) const;
williamr@2
   152
    
williamr@2
   153
    /**
williamr@2
   154
     * Construct an icon from bitmaps. 
williamr@2
   155
     * 
williamr@2
   156
     * Constructs a new icon for the menu item, taking ownership of the picture
williamr@2
   157
     * bitmap aBitmap and the mask bitmap aMask unless the bitmaps are 
williamr@2
   158
     * externally owned.
williamr@2
   159
     * 
williamr@2
   160
     * @param aBitmap Picture bitmap.
williamr@2
   161
     * @param aMask Mask bitmap.
williamr@2
   162
     */
williamr@2
   163
    IMPORT_C void CreateIconL(CFbsBitmap* aBitmap, 
williamr@2
   164
                              CFbsBitmap* aMask);
williamr@2
   165
    
williamr@2
   166
    /**
williamr@2
   167
     * Gets a pointer to the menu item's icon picture bitmap. This does not 
williamr@2
   168
     * imply transfer of ownership.
williamr@2
   169
     * 
williamr@2
   170
     * @return Picture bitmap.
williamr@2
   171
     */
williamr@2
   172
    IMPORT_C CFbsBitmap* IconBitmap() const;
williamr@2
   173
    
williamr@2
   174
    /**
williamr@2
   175
     * Gets a pointer to the menu item's icon mask bitmap. This does not imply
williamr@2
   176
     * transfer of ownership.
williamr@2
   177
     * 
williamr@2
   178
     * @return Mask bitmap.
williamr@2
   179
     */
williamr@2
   180
    IMPORT_C CFbsBitmap* IconMask() const;
williamr@2
   181
    
williamr@2
   182
    /**
williamr@2
   183
     * Sets icon bitmap ownership.
williamr@2
   184
     * Sets the menu item's icon bitmaps as externally owned if @c 
williamr@2
   185
     * aOwnedExternally is @c ETrue.
williamr@2
   186
     * 
williamr@2
   187
     * @param aOwnedExternally If @c ETrue bitmaps are set as externally owned. 
williamr@2
   188
     *        @c If EFalse bitmaps are set as not being externally owned. 
williamr@2
   189
     */
williamr@2
   190
    IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
williamr@2
   191
    
williamr@2
   192
    /**
williamr@2
   193
     * Sets the picture bitmap. Transfers ownership unless the bitmaps are 
williamr@2
   194
     * already owned externally.
williamr@2
   195
     * 
williamr@2
   196
     * @param aBitmap Picture bitmap.
williamr@2
   197
     */
williamr@2
   198
    IMPORT_C void SetIconBitmapL(CFbsBitmap* aBitmap);
williamr@2
   199
    
williamr@2
   200
    /**
williamr@2
   201
     * Sets the mask bitmap. Transfers ownership unless the bitmaps are already
williamr@2
   202
     * owned externally.
williamr@2
   203
     * 
williamr@2
   204
     * @param aMask Mask bitmap.
williamr@2
   205
     */
williamr@2
   206
    IMPORT_C void SetIconMaskL(CFbsBitmap* aMask);
williamr@2
   207
    
williamr@2
   208
    /**
williamr@2
   209
     * Returns scaleable text. If there isn't scaleable text available then
williamr@2
   210
     * this method returns @c iData.iText.
williamr@2
   211
     * 
williamr@2
   212
     * @return Pointer to TPtrC object that contains scaleable text.
williamr@2
   213
     */
williamr@2
   214
    IMPORT_C TPtrC ScaleableText() const;
williamr@2
   215
    
williamr@2
   216
    /**
williamr@2
   217
     * Sets scaleable text. @c iData.iText is set to first text version.
williamr@2
   218
     * 
williamr@2
   219
     * @param aText Scalable text.
williamr@2
   220
     */
williamr@2
   221
    IMPORT_C void SetScaleableTextL(const TDesC& aText);
williamr@2
   222
williamr@2
   223
private:
williamr@2
   224
    inline void CreateExtendedDataBlock();
williamr@2
   225
    inline TBool IsScaleableText(const TDesC& aText) const;
williamr@2
   226
    TPtrC GetNominalText(const TDesC& aText);
williamr@2
   227
williamr@2
   228
public:
williamr@2
   229
williamr@2
   230
    /** The y position of the menu pane item. */
williamr@2
   231
    TInt iPos;
williamr@2
   232
    
williamr@2
   233
    /** The menu pane item's hotkey text. */
williamr@2
   234
    TInt iHotKeyCode;
williamr@2
   235
    
williamr@2
   236
    /** Information from an SData struct. */
williamr@2
   237
    SData  iData;
williamr@2
   238
williamr@2
   239
private:
williamr@2
   240
    CExtendedItemData* iExtendedData;
williamr@2
   241
    };
williamr@2
   242
williamr@2
   243
williamr@2
   244
inline void CEikMenuPaneItem::CreateExtendedDataBlock()
williamr@2
   245
    {
williamr@2
   246
    if (!iExtendedData)
williamr@2
   247
        {
williamr@2
   248
        TRAPD(err, ( iExtendedData = new (ELeave) CExtendedItemData() ) );
williamr@2
   249
        }
williamr@2
   250
    }
williamr@2
   251
williamr@2
   252
williamr@2
   253
inline TBool CEikMenuPaneItem::IsScaleableText(const TDesC& aText) const
williamr@2
   254
    {
williamr@2
   255
    return (aText.Locate(TChar(KScaleableTextSeparator)) == KErrNotFound ? EFalse : ETrue);
williamr@2
   256
    }
williamr@2
   257
williamr@2
   258
williamr@2
   259
/**
williamr@2
   260
 * Menu panes are opened by activating the menu title 
williamr@2
   261
 * @c (CEikMenuPaneTitle / MENU_TITLE) which is displayed in the menu bar @c 
williamr@2
   262
 * (CEikMenuBar / MENU_BAR). They can also be cascaded from a menu item @c
williamr@2
   263
 * (CEikMenuPaneItem / MENU_ITEM) or launched by a menu button @c 
williamr@2
   264
 * (CEikMenuButton). 
williamr@2
   265
 *
williamr@2
   266
 * Menu panes may be defined using a @c MENU_PANE resource.
williamr@2
   267
 */
williamr@2
   268
class CEikMenuPane : public CEikBorderedControl
williamr@2
   269
    {
williamr@2
   270
private:
williamr@2
   271
    enum {ENothingSelected=-1};
williamr@2
   272
    class CMenuScroller;
williamr@2
   273
    friend class CMenuScroller;
williamr@2
   274
    friend class CEikMenuPaneExtension;
williamr@2
   275
public:
williamr@2
   276
    
williamr@2
   277
    /** The text to be displayed for a hotkey. */
williamr@2
   278
    typedef TBuf<20> THotKeyDisplayText;
williamr@2
   279
    
williamr@2
   280
public:
williamr@2
   281
williamr@2
   282
    /**
williamr@2
   283
     * This class provides a constructor to create an array of menu pane items
williamr@2
   284
     * and a destructor to destroy an array of menu pane items.
williamr@2
   285
     */
williamr@2
   286
    class CItemArray:public CArrayPtrFlat<CEikMenuPaneItem>
williamr@2
   287
        {
williamr@2
   288
        
williamr@2
   289
    public:
williamr@2
   290
        
williamr@2
   291
        /**
williamr@2
   292
         * C++ default constructor that creates a flat array of menu pane 
williamr@2
   293
         * items.
williamr@2
   294
         */
williamr@2
   295
        IMPORT_C CItemArray();
williamr@2
   296
        
williamr@2
   297
        /**
williamr@2
   298
         * Destructor.
williamr@2
   299
         */
williamr@2
   300
        IMPORT_C ~CItemArray();
williamr@2
   301
        
williamr@2
   302
        /**
williamr@2
   303
         * Appends @c CEikMenuPaneItem class object to array.
williamr@2
   304
         *
williamr@2
   305
         * @param aMenuItem The menu item to add.
williamr@2
   306
         */        
williamr@2
   307
        IMPORT_C void AddItemL(CEikMenuPaneItem* aMenuItem);
williamr@2
   308
        };
williamr@2
   309
williamr@2
   310
public:
williamr@2
   311
williamr@2
   312
    /**
williamr@2
   313
     * Destructor.
williamr@2
   314
     */
williamr@2
   315
    IMPORT_C ~CEikMenuPane();
williamr@2
   316
    
williamr@2
   317
    /**
williamr@2
   318
     * C++ default constructor. Constructs a menu pane object with the 
williamr@2
   319
     * specified observer.
williamr@2
   320
     * 
williamr@2
   321
     * @param aMenuObserver Menu observer.
williamr@2
   322
     */
williamr@2
   323
    IMPORT_C CEikMenuPane(MEikMenuObserver* aMenuObserver);
williamr@2
   324
williamr@2
   325
    /**
williamr@2
   326
     * Handles 2nd base construction. Completes construction of a menu pane object. 
williamr@2
   327
     * 
williamr@2
   328
     * @param aOwner Menu pane owner ( for cascade menu ).
williamr@2
   329
     * @param aEditMenuObserver Observer for the edit menu. In default this is 
williamr@2
   330
     *        @c NULL.
williamr@2
   331
     */
williamr@2
   332
    IMPORT_C void ConstructL(CEikMenuPane* aOwner, 
williamr@2
   333
                             MEikMenuObserver* aEditMenuObserver = NULL);
williamr@2
   334
    
williamr@2
   335
    /**
williamr@2
   336
     * Destroys the menu pane's item array.
williamr@2
   337
     */
williamr@2
   338
    IMPORT_C void Reset();
williamr@2
   339
    
williamr@2
   340
public: // framework
williamr@2
   341
williamr@2
   342
    /**
williamr@2
   343
     * From @c CcoeControl.
williamr@2
   344
     *
williamr@2
   345
     * Handles key events offered to the menu by the control environment and 
williamr@2
   346
     * provides an appropriate implementation of @c 
williamr@2
   347
     * CCoeControl::OfferKeyEventL(). 
williamr@2
   348
     * 
williamr@2
   349
     * @param aKeyEvent The key event. 
williamr@2
   350
     * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c 
williamr@2
   351
     *        EEventKeyDown.
williamr@2
   352
     */
williamr@2
   353
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   354
                                         TEventCode aType);
williamr@2
   355
    
williamr@2
   356
    /**
williamr@2
   357
     * From @c CcoeControl.
williamr@2
   358
     *
williamr@2
   359
     * Handles a pointer event on the menu.
williamr@2
   360
     * 
williamr@2
   361
     * @param aPointerEvent The pointer event to handle.
williamr@2
   362
     */
williamr@2
   363
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   364
    
williamr@2
   365
    /**
williamr@2
   366
     * From @c CcoeControl.
williamr@2
   367
     *
williamr@2
   368
     * Gets the list of logical colours employed in the drawing of the control, 
williamr@2
   369
     * paired with an explanation of how they are used. Appends the list into 
williamr@2
   370
     * @c aColorUseList.
williamr@2
   371
     * 
williamr@2
   372
     * @since 005u
williamr@2
   373
     * @param aColorUseList The list of colours paired with explanations.
williamr@2
   374
     */
williamr@2
   375
    IMPORT_C virtual void GetColorUseListL(
williamr@2
   376
        CArrayFix<TCoeColorUse>& aColorUseList) const; 
williamr@2
   377
    
williamr@2
   378
    /**
williamr@2
   379
     * From @c CcoeControl.
williamr@2
   380
     *
williamr@2
   381
     * Handles a change to the menu's resources which are shared across the
williamr@2
   382
     * environment. For example, colours or fonts.
williamr@2
   383
     * 
williamr@2
   384
     * @since 005u
williamr@2
   385
     * @param aType The type of resource that has changed.
williamr@2
   386
     */
williamr@2
   387
    IMPORT_C virtual void HandleResourceChange(TInt aType);         // not available before Release 005u
williamr@2
   388
williamr@2
   389
private: // from base class
williamr@2
   390
williamr@2
   391
    /**
williamr@2
   392
     * Not implemented.
williamr@2
   393
     * 
williamr@2
   394
     * @param Not used.
williamr@2
   395
     * @return NULL
williamr@2
   396
     */
williamr@2
   397
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   398
    
williamr@2
   399
public: // from MCoeInputObserver
williamr@2
   400
    
williamr@2
   401
    /**
williamr@2
   402
     * From @c CCoeControl.
williamr@2
   403
     *
williamr@2
   404
     * Gets the list box’s input capabilities as set through the list box flags.
williamr@2
   405
     *
williamr@2
   406
     * @return List box input capabilities.
williamr@2
   407
     */
williamr@2
   408
    IMPORT_C TCoeInputCapabilities InputCapabilities() const;
williamr@2
   409
    
williamr@2
   410
protected: // from base class
williamr@2
   411
    
williamr@2
   412
    /** 
williamr@2
   413
     * From @c CCoeControl
williamr@2
   414
     * 
williamr@2
   415
     * Draw a control called by window server. 
williamr@2
   416
     *
williamr@2
   417
     * All controls, except blank controls, should implement this function. The
williamr@2
   418
     * default implementation draws a blank control. This function is used for
williamr@2
   419
     * window server-initiated redrawing of controls, and for some 
williamr@2
   420
     * application-initiated drawing. It should be implemented by each control,
williamr@2
   421
     * but  is only called from within @c CCoeControl's member functions, and 
williamr@2
   422
     * not from the derived class. For this reason it is a private member 
williamr@2
   423
     * function of @c CCoeControl.
williamr@2
   424
     *
williamr@2
   425
     * The rectangle aRect indicates the region of the control that needs to be
williamr@2
   426
     * redrawn. The implementation of @c Draw() must always draw to every pixel 
williamr@2
   427
     * within this rectangle.
williamr@2
   428
     *
williamr@2
   429
     * @param aRect The region of the control to be redrawn. 
williamr@2
   430
     *        Co-ordinates are relative to the control's origin (top left 
williamr@2
   431
     *        corner). Optional, not used currently.
williamr@2
   432
     */
williamr@2
   433
    IMPORT_C void Draw(const TRect& aRect) const;
williamr@2
   434
    
williamr@2
   435
    /**
williamr@2
   436
     * From @c CCoeControl.
williamr@2
   437
     *
williamr@2
   438
     * Takes any action required when the menu pane gains or loses focus, 
williamr@2
   439
     * to change its appearance for example.
williamr@2
   440
     * 
williamr@2
   441
     * @param aDrawNow If @c EDrawNow the menu pane is redrawn. If @c 
williamr@2
   442
     *        ENoDrawNow the menu pane is not redrawn.
williamr@2
   443
     */
williamr@2
   444
    IMPORT_C void FocusChanged(TDrawNow aDrawNow);
williamr@2
   445
    
williamr@2
   446
    /**
williamr@2
   447
     * From @c CCoeControl.
williamr@2
   448
     *
williamr@2
   449
     * Constructs the menu pane using the specified resource reader.
williamr@2
   450
     * Fills the menu item array with the list of menu items provided by the
williamr@2
   451
     * resource file.
williamr@2
   452
     * 
williamr@2
   453
     * @param aReader The resource reader to use.
williamr@2
   454
     * @leave KErrNoMemory Memory allocation failure earlier construction.     
williamr@2
   455
     */
williamr@2
   456
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   457
    
williamr@2
   458
public: // new functions
williamr@2
   459
williamr@2
   460
    /**
williamr@2
   461
     * Adds a menu item dynamically by creating a new menu item, setting its 
williamr@2
   462
     * data to @c aMenuItem and appending it to the pane's menu item array. 
williamr@2
   463
     * Updates the menu's scroll bar to take account of the new item.
williamr@2
   464
     * 
williamr@2
   465
     * @param aMenuItem The menu item to add.
williamr@2
   466
     *        NOTICE that @c SData is a structure so all fields in it should be
williamr@2
   467
     *        set to avoid any unexpected behaviour.
williamr@2
   468
     */
williamr@2
   469
    IMPORT_C void AddMenuItemL(const CEikMenuPaneItem::SData& aMenuItem);
williamr@2
   470
    
williamr@2
   471
    /**
williamr@2
   472
     * Adds a menu item dynamically by creating a new menu item, setting its 
williamr@2
   473
     * data to @c aMenuItem and inserting it into the pane's menu item array. 
williamr@2
   474
     * Updates the menu's scroll bar to take account of the new item.
williamr@2
   475
     * 
williamr@2
   476
     * @param aMenuItem The menu item to add. NOTICE that @c SData is a 
williamr@2
   477
     *        structure so all fields in it should be set to avoid any 
williamr@2
   478
     *        unexpected behaviour.
williamr@2
   479
     * @param aPreviousId The id of the item after which the new item should be
williamr@2
   480
     *        added.
williamr@2
   481
     */
williamr@2
   482
    IMPORT_C void AddMenuItemL(const CEikMenuPaneItem::SData& aMenuItem, 
williamr@2
   483
                               TInt aPreviousId);
williamr@2
   484
    
williamr@2
   485
    /**
williamr@2
   486
     * Adds menu items dynamically by creating new menu items from resource 
williamr@2
   487
     * and inserts them into the pane's menu item array. 
williamr@2
   488
     * 
williamr@2
   489
     * @param aResourceId The ID of the resource for the menu item.
williamr@2
   490
     * @param aPreviousId The ID of the previous menu item, after which this 
williamr@2
   491
     *        newly created item should be added.
williamr@2
   492
     * @param aAddSeperator Shouldn't be used as separator is not not supported
williamr@2
   493
     *        anymore.
williamr@2
   494
     */
williamr@2
   495
    IMPORT_C void AddMenuItemsL(TInt aResourceId, 
williamr@2
   496
                                TInt aPreviousId = 0,
williamr@2
   497
                                TBool aAddSeperator = EFalse);
williamr@2
   498
    
williamr@2
   499
    /**
williamr@2
   500
     * Deletes the specified item in the menu pane.
williamr@2
   501
     * 
williamr@2
   502
     * @param aCommandId The ID for the item to be deleted.
williamr@2
   503
     */
williamr@2
   504
    IMPORT_C void DeleteMenuItem(TInt aCommandId);
williamr@2
   505
    
williamr@2
   506
    /**
williamr@2
   507
     * Deletes the items between specified items.
williamr@2
   508
     * 
williamr@2
   509
     * @param aStartIndex The index of the item after which items should be 
williamr@2
   510
     *        deleted.
williamr@2
   511
     * @param aEndIndex The index of the item up to which items should be 
williamr@2
   512
     *        deleted.
williamr@2
   513
     */
williamr@2
   514
    IMPORT_C void DeleteBetweenMenuItems(TInt aStartIndex, 
williamr@2
   515
                                         TInt aEndIndex);
williamr@2
   516
    
williamr@2
   517
    /**
williamr@2
   518
     * Gets a reference to the data in the specified menu item.
williamr@2
   519
     * 
williamr@2
   520
     * @param aCommandId The command ID of the menu item for which data is 
williamr@2
   521
     *        obtained.
williamr@2
   522
     * @return Reference to struct that contains command id.
williamr@2
   523
     */
williamr@2
   524
    IMPORT_C CEikMenuPaneItem::SData& ItemData(TInt aCommandId);
williamr@2
   525
    
williamr@2
   526
    /**
williamr@2
   527
     * Gets a pointer to the specified menu item. Also gets the position of the
williamr@2
   528
     * item within the menu pane. Panics if there are no menu items in the menu
williamr@2
   529
     * pane. Panics if the menu pane id does not identify any menu pane item in
williamr@2
   530
     * the array.
williamr@2
   531
     * 
williamr@2
   532
     * @param aCommandId The ID of the menu item for which a pointer is 
williamr@2
   533
     *        returned. 
williamr@2
   534
     * @param aPos On return, the position of the menu item with an ID of 
williamr@2
   535
     *        aCommandId.
williamr@2
   536
     * @return A pointer to the menu item.
williamr@2
   537
     * @panic EEikPanicNoSuchMenuItem Panics if there are no menu items in the
williamr@2
   538
     *                                menu pane or if the menu pane id does not
williamr@2
   539
     *                                identify any menu pane item in the array.
williamr@2
   540
     */
williamr@2
   541
    IMPORT_C CEikMenuPaneItem* ItemAndPos(TInt aCommandId,TInt& aPos);
williamr@2
   542
    
williamr@2
   543
    /**
williamr@2
   544
     * Displays the menu pane with the corner identified by @c aTargetType in 
williamr@2
   545
     * the position specified by @c aTargetPos. This function uses @c 
williamr@2
   546
     * aMinTitleWidth to calculate the area required to display the menu pane,
williamr@2
   547
     * taking into account whether the menu is a cascading menu or popup menu.
williamr@2
   548
     * 
williamr@2
   549
     * @param aHotKeyTable Optional hotkey table. 
williamr@2
   550
     * @param aTargetPos Position of the corner of the menu pane identified by 
williamr@2
   551
     *        @c aTargetType. 
williamr@2
   552
     * @param aMenuPaneTitle The menu pane's title.
williamr@2
   553
     * @param aMinWidth Minimum width of the menu's title.
williamr@2
   554
     * @param aTargetType The corner of the menu pane to which @c aTargetPos 
williamr@2
   555
     *        relates. The default is the top left corner. Possible: @c 
williamr@2
   556
     *        EPopupTargetTopLeft, @c EPopupTargetTopRight, 
williamr@2
   557
     *        @cEPopupTargetBottomLeft, @c EPopupTargetBottomRight.
williamr@2
   558
     */
williamr@2
   559
    IMPORT_C void StartDisplayingMenuPane(
williamr@2
   560
            const CEikHotKeyTable* aHotKeyTable,                               
williamr@2
   561
            const TPoint& aTargetPos, 
williamr@2
   562
            const CEikMenuPaneTitle* aMenuPaneTitle,
williamr@2
   563
            TInt aMinWidth,  
williamr@2
   564
            TPopupTargetPosType aTargetType = EPopupTargetTopLeft);
williamr@2
   565
            
williamr@2
   566
    /**
williamr@2
   567
     * Sets the text in a menu item.
williamr@2
   568
     * 
williamr@2
   569
     * @param aCommandId The command (as defined in an .hrh file) associated
williamr@2
   570
     *        with this menu item. This identifies the menu item whose text is
williamr@2
   571
     *        to be set. 
williamr@2
   572
     * @param aDes New item text.
williamr@2
   573
     */                                      
williamr@2
   574
    IMPORT_C void SetItemTextL(TInt aCommandId,
williamr@2
   575
                               const TDesC& aDes);
williamr@2
   576
    
williamr@2
   577
    /**
williamr@2
   578
     * Sets the text in a menu item from resource.
williamr@2
   579
     *
williamr@2
   580
     * @param aCommandId The command (as defined in an .hrh file) associated 
williamr@2
   581
     *        with this menu item. This identifies the menu item whose text is
williamr@2
   582
     *        to be set. 
williamr@2
   583
     * @param aRid The resource ID of the menu item text. 
williamr@2
   584
     */
williamr@2
   585
    IMPORT_C void SetItemTextL(TInt aCommandId,
williamr@2
   586
                               TInt aRid);
williamr@2
   587
                               
williamr@2
   588
    /**
williamr@2
   589
     * Dims (greys out) or undims a menu item. Dimming indicates that user 
williamr@2
   590
     * input is not accepted.
williamr@2
   591
     * 
williamr@2
   592
     * @param aCommandId The command (as defined in an .hrh file) associated
williamr@2
   593
     *        with this menu item. This identifies the menu item whose text is
williamr@2
   594
     *        to be dimmed or un-dimmed. 
williamr@2
   595
     * @param aDimmed @c ETrue to dim this menu item. @c EFalse to un-dim this
williamr@2
   596
     *        menu item.
williamr@2
   597
     */
williamr@2
   598
    IMPORT_C void SetItemDimmed(TInt aCommandId,
williamr@2
   599
                                TBool aDimmed);
williamr@2
   600
                                
williamr@2
   601
    /**
williamr@2
   602
     * Sets the item to be indicated or not. It should be used to change the
williamr@2
   603
     * state of radio buttons or check box items. It has real effect only 
williamr@2
   604
     * starting from S60 v3.0.
williamr@2
   605
     * 
williamr@2
   606
     * @param aCommandId The command (as defined in an .hrh file) associated 
williamr@2
   607
     *        with this menu item. This identifies the menu item for which the 
williamr@2
   608
     *        state is set or unset. 
williamr@2
   609
     * @param aButtonState should be @c EEikMenuItemSymbolOn or @c
williamr@2
   610
     *        EEikMenuItemSymbolIndeterminate
williamr@2
   611
     */                           
williamr@2
   612
    IMPORT_C void SetItemButtonState(TInt aCommandId,
williamr@2
   613
                                     TInt aButtonState);
williamr@2
   614
    
williamr@2
   615
    /**
williamr@2
   616
     * Sets the selected menu item.
williamr@2
   617
     * 
williamr@2
   618
     * @param aSelectedItem The index of the item to get selected
williamr@2
   619
     */                                
williamr@2
   620
    IMPORT_C void SetSelectedItem(TInt aSelectedItem);
williamr@2
   621
    
williamr@2
   622
    /**
williamr@2
   623
     * Gets the position of the selected menu item.
williamr@2
   624
     * 
williamr@2
   625
     * @return The position of the selected menu item.
williamr@2
   626
     */
williamr@2
   627
    IMPORT_C TInt SelectedItem() const;
williamr@2
   628
    
williamr@2
   629
    /**
williamr@2
   630
     * Closes and destroys any current cascade menu and takes focus back. Does
williamr@2
   631
     * nothing if no cascade menu exists.
williamr@2
   632
     */
williamr@2
   633
    IMPORT_C void CloseCascadeMenu();
williamr@2
   634
    
williamr@2
   635
    /**
williamr@2
   636
     * Sets the array containing the list of menu items for the current menu 
williamr@2
   637
     * pane.
williamr@2
   638
     * 
williamr@2
   639
     * @param aItemArray The menu item array for the menu pane.
williamr@2
   640
     */
williamr@2
   641
    IMPORT_C void SetItemArray(CItemArray* aItemArray);
williamr@2
   642
    
williamr@2
   643
    /**
williamr@2
   644
     * Set menu item array ownership.
williamr@2
   645
     * 
williamr@2
   646
     * @param aOwnedExternally If @c ETrue the menu pane's menu item array is 
williamr@2
   647
     *        set as externally owned. If @c EFalse the menu pane's menu item 
williamr@2
   648
     *        array is set as not externally owned.
williamr@2
   649
     */
williamr@2
   650
    IMPORT_C void SetItemArrayOwnedExternally(TBool aOwnedExternally);
williamr@2
   651
    
williamr@2
   652
    /**
williamr@2
   653
     * Sets the specified button to launch the menu pane. Doesn't have any 
williamr@2
   654
     * effect in current implementation.
williamr@2
   655
     * 
williamr@2
   656
     * @param aButton The button to set as launching the menu.
williamr@2
   657
     */
williamr@2
   658
    IMPORT_C void SetLaunchingButton(CEikButtonBase* aButton);
williamr@2
   659
    
williamr@2
   660
    /**
williamr@2
   661
     * Moves the menu pane highlight to a newly selected menu item identified
williamr@2
   662
     * by @c aNewSelectedItem. Scrolls the menu to show the new selected item
williamr@2
   663
     * if necessary and redraws only the newly selected item and the currently
williamr@2
   664
     * selected item if possible.
williamr@2
   665
     * 
williamr@2
   666
     * @param aNewSelectedItem The newly selected menu item index.
williamr@2
   667
     */
williamr@2
   668
    IMPORT_C void MoveHighlightTo(TInt aNewSelectedItem);
williamr@2
   669
    
williamr@2
   670
    /**
williamr@2
   671
     * Gets the number of menu items within the menu pane.
williamr@2
   672
     *
williamr@2
   673
     * @return Number of menu items within menu pane.
williamr@2
   674
     */
williamr@2
   675
    IMPORT_C TInt NumberOfItemsInPane() const;
williamr@2
   676
    
williamr@2
   677
    /**
williamr@2
   678
     * Closes the menu pane.
williamr@2
   679
     */
williamr@2
   680
    IMPORT_C void Close();
williamr@2
   681
    
williamr@2
   682
    /**
williamr@2
   683
     * From @ CCoeControl
williamr@2
   684
     *
williamr@2
   685
     * Handles key events offered to the menu by the control environment.
williamr@2
   686
     * 
williamr@2
   687
     * @since Platform 004.
williamr@2
   688
     * @param aKeyEvent The key event.
williamr@2
   689
     * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c
williamr@2
   690
     *        EEventKeyDown. 
williamr@2
   691
     * @param aConsumeAllKeys If @c ETrue this function returns @c 
williamr@2
   692
     *        EKeyWasConsumed regardless of whether it was used. If @c EFalse
williamr@2
   693
     *        the key event is consumed if possible and either @c 
williamr@2
   694
     *        EKeyWasConsumed or @c EKeyWasNotConsumed is returned as 
williamr@2
   695
     *        appropriate.
williamr@2
   696
     */
williamr@2
   697
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   698
                                         TEventCode aType,
williamr@2
   699
                                         TBool aConsumeAllKeys); // not available before Platform 004
williamr@2
   700
    
williamr@2
   701
    /**
williamr@2
   702
     * Sets whether the scroll bar occupies the left side of the menu pane.
williamr@2
   703
     * 
williamr@2
   704
     * @param aOnLeft If @c ETrue the scroll bar will occupy the left side of
williamr@2
   705
     *        the menu pane.
williamr@2
   706
     */                                     
williamr@2
   707
    IMPORT_C void SetScrollBarOnLeft(TBool aOnLeft);
williamr@2
   708
    
williamr@2
   709
    /**
williamr@2
   710
     * Sets whether the menu pane uses an arrow head scroll bar.
williamr@2
   711
     * 
williamr@2
   712
     * @param aArrowHead If @c ETrue the menu pane uses an arrow head scroll 
williamr@2
   713
     *        bar.
williamr@2
   714
     */
williamr@2
   715
    IMPORT_C void SetArrowHeadScrollBar(TBool aArrowHead);
williamr@2
   716
    
williamr@2
   717
// new for AVKON
williamr@2
   718
    
williamr@2
   719
    /**
williamr@2
   720
     * Moves highlight to the next item or to the first one if last item is 
williamr@2
   721
     * selected. 
williamr@2
   722
     */
williamr@2
   723
    IMPORT_C void NavigateToNextItem();
williamr@2
   724
    
williamr@2
   725
    /**
williamr@2
   726
     * Inserts the menu item to the specified position.
williamr@2
   727
     * 
williamr@2
   728
     * @param aMenuItem The menu item to add. NOTICE @c SData is the structure
williamr@2
   729
     *        and all fileds should be initialized.
williamr@2
   730
     * @param aPosition The position of newly created item in the array.
williamr@2
   731
     */
williamr@2
   732
    IMPORT_C void InsertMenuItemL(const CEikMenuPaneItem::SData& aMenuItem, 
williamr@2
   733
                                  TInt aPosition);
williamr@2
   734
    
williamr@2
   735
    /**
williamr@2
   736
     * Checks whether menu pane contains the menu item and returns position of
williamr@2
   737
     * it if the item is found.
williamr@2
   738
     * 
williamr@2
   739
     * @param[in] aCommandId The command ID of the item to be searched for.
williamr@2
   740
     * @param[out] aPosition On return contains position of the item.
williamr@2
   741
     * @return @c ETrue if item was found. Otherwise @c EFalse.
williamr@2
   742
     */
williamr@2
   743
    IMPORT_C TBool MenuItemExists(TInt aCommandId, 
williamr@2
   744
                                  TInt& aPosition);
williamr@2
   745
    
williamr@2
   746
    /**
williamr@2
   747
     * Checks whether the menu pane is a cascade menu or a main menu. 
williamr@2
   748
     *
williamr@2
   749
     * @return @c ETrue if the menu pane is cascade menu and @c EFalse if the
williamr@2
   750
     *         menu pane is the main menu.
williamr@2
   751
     */
williamr@2
   752
    IMPORT_C TBool IsCascadeMenuPane() const;
williamr@2
   753
    
williamr@2
   754
    /**
williamr@2
   755
     * Enables or disables text scrolling functionality. It is disabled by 
williamr@2
   756
     * default.
williamr@2
   757
     * 
williamr@2
   758
     * @param aEnable @c ETrue to enable text scrolling functionality.
williamr@2
   759
     */
williamr@2
   760
    IMPORT_C void EnableMarqueeL(const TBool aEnable); 
williamr@2
   761
williamr@2
   762
    /**
williamr@2
   763
     * Report that selection was done for the currently highlighted item.
williamr@2
   764
     */
williamr@2
   765
    void ActivateCurrentItemL();
williamr@2
   766
    
williamr@2
   767
    /**
williamr@2
   768
     * Closes cascade menu if there is one and it is active.
williamr@2
   769
     */
williamr@2
   770
    TBool CancelActiveMenuPane();
williamr@2
   771
    
williamr@2
   772
    /**
williamr@2
   773
     * Deletes dimmed items from the menu item array.
williamr@2
   774
     */
williamr@2
   775
    void FilterDimmedItems();
williamr@2
   776
    
williamr@2
   777
    /**
williamr@2
   778
     * Not implemented.
williamr@2
   779
     *
williamr@2
   780
     * @param aWidth Not used.
williamr@2
   781
     */
williamr@2
   782
    void ClipMenuItems(TInt aWidth);
williamr@2
   783
    
williamr@2
   784
    /**
williamr@2
   785
     * Gets the menu pane for the cascade menu.
williamr@2
   786
     *
williamr@2
   787
     * @return The menu pane for the cascade menu.
williamr@2
   788
     */
williamr@2
   789
    IMPORT_C CEikMenuPane* CascadeMenuPane();
williamr@2
   790
    
williamr@2
   791
    /**
williamr@2
   792
     * Gets a reference to the data in the specified menu item.
williamr@2
   793
     * 
williamr@2
   794
     * @since S60 3.1
williamr@2
   795
     * @param aItemIndex The index of the item in the items array.
williamr@2
   796
     * @return The menu item's data.
williamr@2
   797
     * @leave  KErrArgument Wrong @aItemIndex.
williamr@2
   798
     */
williamr@2
   799
    IMPORT_C CEikMenuPaneItem::SData& ItemDataByIndexL(TInt aItemIndex);
williamr@2
   800
    
williamr@2
   801
    /**
williamr@2
   802
     * Checks if the position of the menu was set from outside.
williamr@2
   803
     *
williamr@2
   804
     * @since S60 3.1
williamr@2
   805
     * @return @c ETrue in case when position of the menu was set from outside.
williamr@2
   806
     */
williamr@2
   807
    TBool IsPositionToBeForced() const;
williamr@2
   808
    
williamr@2
   809
    /**
williamr@2
   810
     * Creates and enables a special characters row to be used in the edit 
williamr@2
   811
     * menu.
williamr@2
   812
     *
williamr@2
   813
     * @since S60 3.1 
williamr@2
   814
     * @param aSpecialChars Buffer that holds the selected characters after 
williamr@2
   815
     *                      user has selected them.
williamr@2
   816
     */
williamr@2
   817
    IMPORT_C void ConstructMenuSctRowL( TDes& aSpecialChars );
williamr@2
   818
williamr@2
   819
    /**
williamr@2
   820
     * Returns the command id of the specified menu item. The function panics
williamr@2
   821
     * if aIndex doesn't exist or is out of range.
williamr@2
   822
     * @param aIndex The index of the menu item for which the command ID is returned.
williamr@2
   823
     * @since 3.1
williamr@2
   824
     */
williamr@2
   825
    IMPORT_C TInt MenuItemCommandId( TInt aIndex ) const;
williamr@2
   826
williamr@2
   827
    
williamr@2
   828
    /**
williamr@2
   829
     * Creates and enables a special characters row to be used in the edit menu.
williamr@2
   830
     * The special character row is constructed from the given special character table.
williamr@2
   831
     *
williamr@2
   832
     * @param aSpecialChars Buffer that holds the selected characters after 
williamr@2
   833
     * user has selected them.
williamr@2
   834
     * @param aResourceId The special character table resource id to define the 
williamr@2
   835
     * characters in the row.
williamr@2
   836
     *
williamr@2
   837
     * @since S60 3.1
williamr@2
   838
     */
williamr@2
   839
    IMPORT_C void ConstructMenuSctRowL( TDes& aSpecialChars, TInt aResourceId );
williamr@2
   840
williamr@2
   841
    /**
williamr@2
   842
     * Creates and enables a special characters row to be used in the edit menu.
williamr@2
   843
     * The special character row is constructed from the given special character dialog.
williamr@2
   844
     *
williamr@2
   845
     * @param aSpecialChars Buffer that holds the selected characters after 
williamr@2
   846
     * user has selected them.
williamr@2
   847
     * @param aResourceId The special character dialog  resource id that contains a special character table
williamr@2
   848
     *
williamr@2
   849
     * @since S60 3.2
williamr@2
   850
     */
williamr@2
   851
    IMPORT_C void ConstructMenuSctRowFromDialogL( TDes& aSpecialChars, TInt aResourceId );
williamr@2
   852
williamr@2
   853
    /**
williamr@2
   854
     * Creates and enables a special characters row to be used in the edit menu.
williamr@2
   855
     * The special character row is constructed from the given special character dialog.
williamr@2
   856
     *
williamr@2
   857
     * @param aCharCase the charcase used by menu sct
williamr@2
   858
     * @param aSpecialChars Buffer that holds the selected characters after
williamr@2
   859
     * user has selected them.
williamr@2
   860
     * @param aResourceId The special character dialog  resource id that contains a special character table
williamr@2
   861
     *
williamr@2
   862
     * @since S60 3.2
williamr@2
   863
     */
williamr@2
   864
    IMPORT_C void ConstructMenuSctRowFromDialogL( TInt aCharCase, TDes& aSpecialChars, TInt aResourceId );
williamr@2
   865
williamr@2
   866
private:
williamr@2
   867
    enum { EInvalidCurrentSize=0x01, EBackgroundFaded=0x02 };
williamr@2
   868
    
williamr@2
   869
private: // new functions
williamr@2
   870
    TRect CalculateSizeAndPosition() ;
williamr@2
   871
    enum THighlightType {ENoHighlight,EDrawHighlight,ERemoveHighlight};
williamr@2
   872
    void DrawItem(CWindowGc& aGc,TInt aItem, THighlightType aHighlight) const;
williamr@2
   873
    void FindHotKeyDisplayText(TDes& aDes,const CEikMenuPaneItem& aItem) const;
williamr@2
   874
    void ReportSelectionMadeL( TBool aAbortTransition = ETrue );
williamr@2
   875
    void ReportCanceled();
williamr@2
   876
    void GiveVisualFeedback();
williamr@2
   877
    void LaunchCascadeMenuL(TInt aCascadeMenuId);
williamr@2
   878
    void DoLaunchCascadeMenuL(TInt aCascadeMenuId);
williamr@2
   879
    void TryLaunchCascadeMenuL(const CEikMenuPaneItem& aItem);
williamr@2
   880
    void PrepareGcForDrawingItems(CGraphicsContext& aGc) const;
williamr@2
   881
    TBool ItemArrayOwnedExternally() const;
williamr@2
   882
    TBool IsHotKeyL(const TInt modifiers,const TInt aCode);
williamr@2
   883
    TBool MoveToItemL(TInt aCode, TInt aModifiers);
williamr@2
   884
    void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
williamr@2
   885
    void CreateScrollBarFrame();
williamr@2
   886
    void UpdateScrollBar();
williamr@2
   887
    void DoUpdateScrollBarL();
williamr@2
   888
    void UpdateScrollBarThumbs();
williamr@2
   889
    static TInt UpdateScrollBarCallBackL(TAny* aObj);
williamr@2
   890
    TRect ViewRect() const;
williamr@2
   891
//    TInt NumberOfItemsThatFitInView() const;
williamr@2
   892
    TInt TotalItemHeight() const;
williamr@2
   893
    void ScrollToMakeItemVisible(TInt aItemIndex);
williamr@2
   894
    void Scroll(TInt aAmount);
williamr@2
   895
    TBool CheckCreateScroller();
williamr@2
   896
    void CheckCreateScrollerL();
williamr@2
   897
    void ResetItemArray();
williamr@2
   898
    void CreateItemArrayL();
williamr@2
   899
    void SetVScrollBarFlag();
williamr@2
   900
    TInt TopHighlightGap() const;
williamr@2
   901
    TInt BottomHighlightGap() const;
williamr@2
   902
    TInt EvaluateMaxIconWidth() const;
williamr@2
   903
    void CreateIconFromResourceL(TResourceReader& aReader, CEikMenuPaneItem& aItem) const;
williamr@2
   904
    // new for AVKON
williamr@2
   905
    void AnimateMenuPane(const TPoint& aNewPos);
williamr@2
   906
williamr@2
   907
    // To make layout correct
williamr@2
   908
    TRect ListMenuPane() const;
williamr@2
   909
    TRect PopupMenuWindow() const;
williamr@2
   910
    TRect PopupSubmenuWindow() const;
williamr@2
   911
williamr@2
   912
    // Skin support for menu
williamr@2
   913
    void UpdateBackgroundContext(const TRect& aWindowRect);
williamr@2
   914
williamr@2
   915
    // Support method for highlight animation
williamr@2
   916
    void RepaintHighlight() const;
williamr@2
   917
williamr@2
   918
private: // from CCoeControl
williamr@2
   919
    IMPORT_C void Reserved_1();
williamr@2
   920
    IMPORT_C void Reserved_2();
williamr@2
   921
williamr@2
   922
private : // new functions
williamr@2
   923
    void LoadCascadeBitmapL() ;
williamr@2
   924
williamr@2
   925
    // Support for check mark, from v3.0
williamr@2
   926
    void LoadCheckMarkBitmapL();
williamr@2
   927
    TBool MenuHasCheckBoxOn() const;
williamr@2
   928
    // Support for radio button, from v3.0
williamr@2
   929
    void LoadRadioButtonBitmapL();
williamr@2
   930
    TBool IsItemMemberOfRadioButtonGroup(TInt aItem) const ;
williamr@2
   931
    // for drawing,from v3.0
williamr@2
   932
    TBool MenuHasIcon() const;
williamr@2
   933
williamr@2
   934
    TRect CalculateSizeAndPositionScalable( const TRect& aWindowRect, TInt aNumItemsInPane ) ;
williamr@2
   935
    TRect HighlightRect() const;
williamr@2
   936
    void PrepareHighlightFrame() const;
williamr@2
   937
    void SetCascadedIconSize() const;
williamr@2
   938
williamr@2
   939
    // fixes marquee flickering
williamr@2
   940
    friend class CAknMarqueeControl;
williamr@2
   941
    static TInt RedrawMarqueeEvent( TAny* aControl );
williamr@2
   942
    
williamr@2
   943
    CEikMenuPaneExtension* Extension() const;
williamr@2
   944
williamr@2
   945
protected: // from CoeControl
williamr@2
   946
williamr@2
   947
    /**
williamr@2
   948
     * From @c CCoeControl.
williamr@2
   949
     *
williamr@2
   950
     * Retrieves an object of the same type as that encapsulated in aId. Other
williamr@2
   951
     * than in the case where @c NULL is returned, the object returned must be 
williamr@2
   952
     * of the same object type - that is, the @c ETypeId member of the object
williamr@2
   953
     * pointed to by the pointer returned by this function must be equal to the
williamr@2
   954
     * @c iUid member of @c aId.
williamr@2
   955
     *
williamr@2
   956
     * @since SDK 7.0s
williamr@2
   957
     * @param aId An encapsulated object type ID.
williamr@2
   958
     * @return Encapsulates the pointer to the object provided. Note that the 
williamr@2
   959
     *         encapsulated pointer may be @c NULL.
williamr@2
   960
     */
williamr@2
   961
    IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
williamr@2
   962
williamr@2
   963
public: // From CoeControl.
williamr@2
   964
    
williamr@2
   965
    /**
williamr@2
   966
     * From @c CoeControl.
williamr@2
   967
     *
williamr@2
   968
     * Gets the number of controls contained in a compound control. This 
williamr@2
   969
     * function should be implemented by all compound controls.
williamr@2
   970
     * 
williamr@2
   971
     * Note: 
williamr@2
   972
     * In SDK 6.1 this was changed from protected to public.
williamr@2
   973
     * 
williamr@2
   974
     * @return The number of component controls contained by this control.
williamr@2
   975
     */
williamr@2
   976
    IMPORT_C TInt CountComponentControls() const;
williamr@2
   977
    
williamr@2
   978
    /**
williamr@2
   979
     * From @c CoeControl.
williamr@2
   980
     *
williamr@2
   981
     * Gets the specified component of a compound control. This function shouldŽ
williamr@2
   982
     * be implemented by all compound controls.
williamr@2
   983
     *
williamr@2
   984
     * Note:
williamr@2
   985
     * Within a compound control, each component control is identified by an 
williamr@2
   986
     * index, where the index depends on the order the controls were added: the
williamr@2
   987
     * first is given an index of 0, the next an index of 1, and so on.
williamr@2
   988
     *
williamr@2
   989
     * @param[in, out] aIndex The index of the control to get.
williamr@2
   990
     * @return The component control with an index of @c aIndex.
williamr@2
   991
     */
williamr@2
   992
    IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
williamr@2
   993
    
williamr@2
   994
protected: // new functions
williamr@2
   995
    
williamr@2
   996
    /**
williamr@2
   997
     * Disables sliding effect
williamr@2
   998
     * By default is enabled if there is enough memory.
williamr@2
   999
     *
williamr@2
  1000
     * @since 3.1
williamr@2
  1001
     */
williamr@2
  1002
    void DisableAnimation();
williamr@2
  1003
    
williamr@2
  1004
    /**
williamr@2
  1005
     * The position of the menu will be changed according to the one 
williamr@2
  1006
     * which is specified by arguments in StartDisplayingMenuPane()
williamr@2
  1007
     * By default those arguments are not used.
williamr@2
  1008
     *
williamr@2
  1009
     * @since 3.1
williamr@2
  1010
     * @param aForced @c Etrue if arguments are used.
williamr@2
  1011
     */
williamr@2
  1012
    void SetPositionToBeForced(TBool aForced);
williamr@2
  1013
    
williamr@2
  1014
    /**
williamr@2
  1015
     * Gets the maximum number of items which can be seen simultaneously.
williamr@2
  1016
     *
williamr@2
  1017
     * @return The maximum number of items which can be seen simultaneously.
williamr@2
  1018
     */
williamr@2
  1019
    TInt NumberOfItemsThatFitInView() const;
williamr@2
  1020
    
williamr@2
  1021
    void DrawNow();    
williamr@2
  1022
    
williamr@2
  1023
private: // data
williamr@2
  1024
    friend class CEikMenuButton;
williamr@2
  1025
    MEikMenuObserver* iMenuObserver;
williamr@2
  1026
    MEikMenuObserver* iEditMenuObserver;
williamr@2
  1027
    CEikMenuPane* iCascadeMenuPane;
williamr@2
  1028
    const CEikMenuPaneTitle* iMenuPaneTitle;
williamr@2
  1029
    const CEikHotKeyTable* iHotKeyTable;
williamr@2
  1030
    CEikMenuPane* iOwner;
williamr@2
  1031
    CItemArray* iItemArray;
williamr@2
  1032
    TBool iArrayOwnedExternally;
williamr@2
  1033
    TBool iAllowPointerUpEvents;
williamr@2
  1034
    TInt iNumberOfDragEvents;
williamr@2
  1035
    TInt iSelectedItem;
williamr@2
  1036
    TInt iItemHeight;
williamr@2
  1037
    TInt iBaseLine;
williamr@2
  1038
    TInt iHotkeyColWidth;
williamr@2
  1039
    TInt iFlags;
williamr@2
  1040
    CEikScrollBarFrame* iSBFrame;
williamr@2
  1041
    CMenuScroller* iScroller;
williamr@2
  1042
    CEikButtonBase* iLaunchingButton; // for popouts only
williamr@2
  1043
    TInt iSubPopupWidth; // 0..2
williamr@2
  1044
    TBool iEnableAnimation;
williamr@2
  1045
    CEikMenuPaneExtension* iExtension ;  // iSpare used for extension class pointer.
williamr@2
  1046
williamr@2
  1047
    };
williamr@2
  1048
williamr@2
  1049
#endif
williamr@2
  1050