epoc32/include/mw/eikmenub.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) 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@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:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined(__EIKMENUB_H__)
williamr@2
    20
#define __EIKMENUB_H__
williamr@2
    21
williamr@2
    22
#if !defined(__EIKDEF_H__)
williamr@2
    23
#include <eikdef.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined(__EIKBCTRL_H__)
williamr@2
    27
#include <eikbctrl.h>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
#if !defined(__EIKMENUP_H__)
williamr@2
    31
#include <eikmenup.h>
williamr@2
    32
#endif
williamr@2
    33
williamr@2
    34
#include <eikbtgpc.h>
williamr@2
    35
#include <eikcmobs.h>
williamr@2
    36
#include <aknintermediate.h>
williamr@2
    37
williamr@2
    38
class CEikHotKeyTable;
williamr@2
    39
class CEikMenuBarExtension;
williamr@4
    40
class CAknItemActionMenu;
williamr@2
    41
williamr@2
    42
williamr@2
    43
/**
williamr@2
    44
 * The CEikMenuBarTitle class encapsulates the data needed to define a menu bar title and
williamr@2
    45
 * provides some of the functionality required to display the title.
williamr@2
    46
 *
williamr@2
    47
 * @since ER5U
williamr@2
    48
 */
williamr@2
    49
class CEikMenuBarTitle : public CBase
williamr@2
    50
	{
williamr@2
    51
public:
williamr@2
    52
    /**
williamr@2
    53
     * Defines a menu bar. See also @c MEikMenuObserver::DynInitMenuPaneL(). 
williamr@2
    54
     * See also @c MENU_TITLE for details of the resource interface to menu 
williamr@2
    55
     * items.
williamr@2
    56
     */
williamr@2
    57
	struct SData
williamr@2
    58
		{
williamr@2
    59
        enum { 
williamr@2
    60
            /** Nominal legth of the text. */
williamr@2
    61
            ENominalTextLength=40 
williamr@2
    62
            };
williamr@2
    63
        /** 
williamr@2
    64
         * The resource ID from which the menu pane is constructed.
williamr@2
    65
         */
williamr@2
    66
		TInt iMenuPaneResourceId;
williamr@2
    67
        /** 
williamr@2
    68
         * The text to display on the menu pane.
williamr@2
    69
         */
williamr@2
    70
		TBuf<ENominalTextLength> iText; // less than this actually stored
williamr@2
    71
		};
williamr@2
    72
public:
williamr@2
    73
    /**
williamr@2
    74
     * C++ default constructor.
williamr@2
    75
     */
williamr@2
    76
	IMPORT_C CEikMenuBarTitle();
williamr@2
    77
    /**
williamr@2
    78
     * Destructor.
williamr@2
    79
     */
williamr@2
    80
	IMPORT_C ~CEikMenuBarTitle();
williamr@2
    81
    /** 
williamr@2
    82
     * Sets the title icon.
williamr@2
    83
     *
williamr@2
    84
     * @param aIcon The icon to set.
williamr@2
    85
     */
williamr@2
    86
	IMPORT_C void SetIcon(CGulIcon* aIcon);
williamr@2
    87
williamr@2
    88
    /** 
williamr@2
    89
     * Sets whether the bitmap and mask are owned externally or not.
williamr@2
    90
     *
williamr@2
    91
     * @param aOwnedExternally @c ETrue if bitmaps are set as externally owned. 
williamr@2
    92
     *        @c EFalse if bitmaps are set as not being externally owned. 
williamr@2
    93
     */
williamr@2
    94
	IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
williamr@2
    95
williamr@2
    96
    /** 
williamr@2
    97
     * Draws the title icon to the graphics context @c aGc, inside the rect @c 
williamr@2
    98
     * aRect with an offset from the left side of the rectangle of size @c  
williamr@2
    99
     * aLeftMargin.
williamr@2
   100
     *
williamr@2
   101
     * @param aGc Window graphic context.
williamr@2
   102
     * @param aRect Rectangle area.
williamr@2
   103
     * @param aLeftMargin Left margin.
williamr@2
   104
     */
williamr@2
   105
	IMPORT_C void DrawIcon(CWindowGc& aGc, TRect aRect, TInt aLeftMargin) const;
williamr@2
   106
williamr@2
   107
    /** 
williamr@2
   108
     * Constructs a new icon for the title, taking ownership of the picture 
williamr@2
   109
     * bitmap and the mask bitmap unless they are externally owned.
williamr@2
   110
     *
williamr@2
   111
     * @param aBitmap Bitmap.
williamr@2
   112
     * @param aMask Mask of the bitmap.
williamr@2
   113
     */
williamr@2
   114
	IMPORT_C void CreateIconL(CFbsBitmap* aBitmap, CFbsBitmap* aMask);
williamr@2
   115
williamr@2
   116
    /** 
williamr@2
   117
     * Sets the bitmap for the icon. Transfers 
williamr@2
   118
     * ownership unless the bitmaps are owned externally.
williamr@2
   119
     *
williamr@2
   120
     * @param aBitmap Bitmap
williamr@2
   121
     */	
williamr@2
   122
	IMPORT_C void SetIconBitmapL(CFbsBitmap* aBitmap);
williamr@2
   123
williamr@2
   124
    /** 
williamr@2
   125
     * Sets the bitmap mask for the icon. Transfers ownership 
williamr@2
   126
     * unless the bitmaps are owned externally.
williamr@2
   127
     *
williamr@2
   128
     * @param aMask Mask of a bitmap.
williamr@2
   129
     */	
williamr@2
   130
	IMPORT_C void SetIconMaskL(CFbsBitmap* aMask);
williamr@2
   131
williamr@2
   132
    /** 
williamr@2
   133
     * Gets a pointer to the title icon’s bitmap. Does not imply transfer of
williamr@2
   134
     * ownership.
williamr@2
   135
     *
williamr@2
   136
     * @return Pointer to the title icon’s bitmap.
williamr@2
   137
     */
williamr@2
   138
	IMPORT_C CFbsBitmap* IconBitmap() const;
williamr@2
   139
williamr@2
   140
    /** 
williamr@2
   141
     * Gets a pointer to the title icon’s bitmap mask. Does not imply transfer
williamr@2
   142
     * of ownership.
williamr@2
   143
     *
williamr@2
   144
     * @return Pointer to the title icon’s bitmap mask. 
williamr@2
   145
     */
williamr@2
   146
	IMPORT_C CFbsBitmap* IconMask() const;
williamr@2
   147
williamr@2
   148
public: // other functions
williamr@2
   149
williamr@2
   150
    /** 
williamr@2
   151
     * Gets the value of the extra left margin for the title text which will
williamr@2
   152
     * take into account the width of the title icon.
williamr@2
   153
     *
williamr@2
   154
     * @return Value of extra left margin.
williamr@2
   155
     */
williamr@2
   156
	TInt ExtraLeftMargin() const;
williamr@2
   157
williamr@2
   158
    /** 
williamr@2
   159
     * Adjusts the value of the title text baseline offset @c aBaseLine to take
williamr@2
   160
     * into account any size of the title icon.
williamr@2
   161
     *
williamr@2
   162
     * @param[in,out] aBaseLine Gets result of baseline.
williamr@2
   163
     * @param[in,out] aTitleHeight Gets result of height.
williamr@2
   164
     */	
williamr@2
   165
	void CalculateBaseLine(TInt& aBaseLine, TInt& aTitleHeight);
williamr@2
   166
	
williamr@2
   167
public:
williamr@2
   168
williamr@2
   169
    /** The title’s position on the menu bar. */
williamr@2
   170
	TInt iPos;
williamr@2
   171
williamr@2
   172
    /** The title’s width. */
williamr@2
   173
	TInt iWidth;
williamr@2
   174
williamr@2
   175
    /** The menu bar title text. */
williamr@2
   176
	SData iData;
williamr@2
   177
williamr@2
   178
    /** Flags used internally by the menu bar title. */
williamr@2
   179
	TInt iTitleFlags;
williamr@2
   180
	
williamr@2
   181
private:
williamr@2
   182
	CGulIcon* iIcon;
williamr@2
   183
	};
williamr@2
   184
williamr@2
   185
/**
williamr@2
   186
 * Menu bars are constructed from @c MENU_BAR resources and issue application
williamr@2
   187
 * commands which should be handled by overriding @c 
williamr@2
   188
 * CEikAppUi::HandleCommandL().
williamr@2
   189
 */
williamr@2
   190
class CEikMenuBar : public CEikBorderedControl, 
williamr@2
   191
                    public MEikCommandObserver, 
williamr@2
   192
                    public MAknIntermediateState
williamr@2
   193
	{
williamr@2
   194
	
williamr@2
   195
public:
williamr@2
   196
williamr@2
   197
    /** 
williamr@2
   198
     * Declares an object type for a class, in order to allow the object
williamr@2
   199
     * provider mechanism to locate and provide objects from the class.
williamr@2
   200
     */
williamr@2
   201
	DECLARE_TYPE_ID(0x101F4106)
williamr@2
   202
williamr@2
   203
	/** Specifies the menu item within the menu pane. */
williamr@2
   204
	struct SCursor
williamr@2
   205
		{
williamr@2
   206
		/** Index of a title in the menu bar. */
williamr@2
   207
		TInt iMenuPaneIndex;
williamr@2
   208
		
williamr@2
   209
		/** Index of an item in a menu pane. */
williamr@2
   210
		TInt iMenuItemIndex;
williamr@2
   211
		};
williamr@2
   212
williamr@2
   213
    /**  */
williamr@2
   214
	struct SPosition
williamr@2
   215
		{
williamr@2
   216
		/**  */
williamr@2
   217
		TInt iMenuId;
williamr@2
   218
		
williamr@2
   219
		/**  */
williamr@2
   220
		SCursor iMenuCursorPos;
williamr@2
   221
		};
williamr@2
   222
williamr@2
   223
    enum TMenuType {
williamr@2
   224
        /** 
williamr@2
   225
         *  Options menu launched from the Options softkey. 
williamr@2
   226
         *  This is the default value.
williamr@2
   227
         */
williamr@2
   228
        EMenuOptions = 0,
williamr@2
   229
        
williamr@2
   230
        /** 
williamr@2
   231
         *  Context sensitive menu that is launched from selection key 
williamr@2
   232
         *  when the application supports it.
williamr@2
   233
         */
williamr@2
   234
        EMenuContext = 1,
williamr@2
   235
        
williamr@2
   236
        /** 
williamr@2
   237
         *  Edit menu containing editing specific items.
williamr@2
   238
         */
williamr@2
   239
        EMenuEdit = 2,
williamr@2
   240
        
williamr@2
   241
        /** 
williamr@2
   242
         *  Options menu launched from the Options softkey. Task swapper item
williamr@2
   243
         *  is not shown.
williamr@2
   244
         */
williamr@2
   245
        EMenuOptionsNoTaskSwapper = 3
williamr@2
   246
        };
williamr@2
   247
williamr@2
   248
	friend class CEikMenuPaneTitle;
williamr@2
   249
	
williamr@2
   250
private:
williamr@2
   251
	
williamr@2
   252
	enum {ENothingSelected=-1};
williamr@2
   253
	
williamr@2
   254
public:
williamr@2
   255
williamr@2
   256
    /**
williamr@2
   257
     * Destructor.
williamr@2
   258
     */
williamr@2
   259
	IMPORT_C ~CEikMenuBar();
williamr@2
   260
	
williamr@2
   261
    /**
williamr@2
   262
     * C++ default constructor.
williamr@2
   263
     */
williamr@2
   264
	IMPORT_C CEikMenuBar();
williamr@2
   265
	
williamr@2
   266
public: // framework
williamr@2
   267
williamr@2
   268
    /**
williamr@2
   269
     * From @c CCoeControl
williamr@2
   270
     * 
williamr@2
   271
     * Handles key events offered to the menu by the control environment and
williamr@2
   272
     * provides an appropriate implementation of 
williamr@2
   273
     * @c CCoeControl::OfferKeyEventL(). 
williamr@2
   274
     *
williamr@2
   275
     * @param aKeyEvent The key event. 
williamr@2
   276
     * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c
williamr@2
   277
     * EEventKeyDown. 
williamr@2
   278
     *
williamr@2
   279
     * @return Indicates whether or not the key event was used by this control.
williamr@2
   280
     */
williamr@2
   281
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   282
	                                     TEventCode aType);
williamr@2
   283
williamr@2
   284
    /**
williamr@2
   285
     * From @c CCoeControl
williamr@2
   286
     * 
williamr@2
   287
     * Handles pointer events. This function gets called whenever a pointer 
williamr@2
   288
     * event occurs in the control, i.e. when the pointer is within the 
williamr@2
   289
     * control's extent, or when the control has grabbed the pointer. The 
williamr@2
   290
     * control should implement this function to handle pointer events.
williamr@2
   291
     * 
williamr@2
   292
     * Note: events of type @c EButton1Down are processed before @c
williamr@2
   293
     * HandlePointerEventL() is called, in order to transfer keyboard focus to 
williamr@2
   294
     * the control in which the @c EButton1Down event occurred.
williamr@2
   295
     *
williamr@2
   296
     * If overriding @c HandlePointerEventL(), the implementation must include 
williamr@2
   297
     * a base call to @c CCoeControl's @c HandlePointerEventL().
williamr@2
   298
     *
williamr@2
   299
     * @param aPointerEvent The pointer event.
williamr@2
   300
     */
williamr@2
   301
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   302
williamr@2
   303
    /** 
williamr@2
   304
     * From @c CCoeControl
williamr@2
   305
     * 
williamr@2
   306
     * Not implemented.
williamr@2
   307
     *
williamr@2
   308
     * @param Not used.
williamr@2
   309
     */
williamr@2
   310
    IMPORT_C void Draw(const TRect& aRect) const;
williamr@2
   311
	
williamr@2
   312
private:
williamr@2
   313
williamr@2
   314
    /**
williamr@2
   315
    * From CAknControl
williamr@2
   316
    */
williamr@2
   317
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   318
williamr@2
   319
private: // from MCoeInputObserver
williamr@2
   320
williamr@2
   321
	IMPORT_C TCoeInputCapabilities InputCapabilities() const;
williamr@2
   322
	
williamr@2
   323
public:
williamr@2
   324
williamr@2
   325
     /**
williamr@2
   326
      *  This class enables construction, and destruction of an array of
williamr@2
   327
      *  information about menu bar titles.
williamr@2
   328
      */
williamr@2
   329
	class CTitleArray : public CArrayPtrFlat<CEikMenuBarTitle>
williamr@2
   330
		{
williamr@2
   331
		
williamr@2
   332
	public:
williamr@2
   333
	
williamr@2
   334
		/**
williamr@2
   335
		 * Destructor.
williamr@2
   336
		 */
williamr@2
   337
		IMPORT_C ~CTitleArray();
williamr@2
   338
		
williamr@2
   339
        /**
williamr@2
   340
         * C++ default constructor.
williamr@2
   341
         */	
williamr@2
   342
		IMPORT_C CTitleArray();
williamr@2
   343
		
williamr@2
   344
        /** 
williamr@2
   345
         * Adds the menu bar title @c aMenuTitle to the end of the array owned
williamr@2
   346
         * by the menu bar and transfers ownership.
williamr@2
   347
         *
williamr@2
   348
         * @param aMenuTitle Append object to flat array.
williamr@2
   349
         */				
williamr@2
   350
		IMPORT_C void AddTitleL(CEikMenuBarTitle* aMenuTitle);
williamr@2
   351
williamr@2
   352
        /** 
williamr@2
   353
         * Deletes selected index into array.
williamr@2
   354
         *
williamr@2
   355
         * @param aResource Array index that will be delete.
williamr@2
   356
         */		
williamr@2
   357
		void DeleteResource(TInt aResource);
williamr@2
   358
		};
williamr@2
   359
williamr@2
   360
public: // new functions
williamr@2
   361
williamr@2
   362
    /** 
williamr@2
   363
     * Second phase constructor for a menu bar. 
williamr@2
   364
     *
williamr@2
   365
     * @param aMenuObserver The menu's observer. 
williamr@2
   366
     * @param aHotKeyResourceId The ID of the resource, of type HOTKEY from 
williamr@2
   367
     *        which the hotkey table is created. This is optional. By default
williamr@2
   368
     *        it's nil.
williamr@2
   369
     * @param aMenuTitleResourceId The ID of the resource, of type @c MENU_BAR 
williamr@2
   370
     *        from which the menu title array is created. This is optional. By 
williamr@2
   371
     *        default it's nil.
williamr@2
   372
     */
williamr@2
   373
		
williamr@2
   374
	IMPORT_C void ConstructL(MEikMenuObserver* aMenuObserver,
williamr@2
   375
	                         TInt aHotKeyResourceId=0,
williamr@2
   376
	                         TInt aMenuTitleResourceId=0);
williamr@2
   377
williamr@2
   378
    /** 
williamr@2
   379
     * Second phase constructor for a menu bar which builds the menu bar from
williamr@2
   380
     * the given resource file. 
williamr@2
   381
     *
williamr@2
   382
     * @param aReader The resource reader. 
williamr@2
   383
     */		
williamr@2
   384
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   385
williamr@2
   386
    /** 
williamr@2
   387
     * Not implemented
williamr@2
   388
     *
williamr@2
   389
     * @param aHotKeyResourceId Not used.
williamr@2
   390
     * @param aMenuTitleResourceId Not used.
williamr@2
   391
     * @param aDisplayNow Not used.
williamr@2
   392
     */		
williamr@2
   393
    IMPORT_C void ChangeMenuBarL(TInt aHotKeyResourceId=0,
williamr@2
   394
                                 TInt aMenuTitleResourceId=0,
williamr@2
   395
                                 TInt aDisplayNow=ETrue);
williamr@2
   396
williamr@2
   397
    /** 
williamr@2
   398
     * Not implemented!
williamr@2
   399
     *
williamr@2
   400
     * @param aHotKeyTable Not used.
williamr@2
   401
     * @return  NULL.
williamr@2
   402
     */
williamr@2
   403
    IMPORT_C CEikHotKeyTable* SetHotKeyTable(CEikHotKeyTable* aHotKeyTable);
williamr@2
   404
williamr@2
   405
    /** 
williamr@2
   406
     * Sets the menu’s resource ID.
williamr@2
   407
     * 
williamr@2
   408
     * @param aMenuTitleResourceId The ID of the resource to use.
williamr@2
   409
     */
williamr@2
   410
    IMPORT_C void SetMenuTitleResourceId(TInt aMenuTitleResourceId);
williamr@2
   411
    
williamr@2
   412
    /**
williamr@2
   413
    *
williamr@2
   414
    *
williamr@2
   415
    * @param aMenuTitleResourceId
williamr@2
   416
    */
williamr@2
   417
	IMPORT_C void SetContextMenuTitleResourceId(TInt aMenuTitleResourceId);
williamr@2
   418
		
williamr@2
   419
    /** 
williamr@2
   420
     * Not implemented.
williamr@2
   421
     *
williamr@2
   422
     * @param aTitleArray Not used. 
williamr@2
   423
     */
williamr@2
   424
    IMPORT_C void SetMenuTitleArray(CTitleArray* aTitleArray);
williamr@2
   425
williamr@2
   426
    /** 
williamr@2
   427
     * Not implemented.
williamr@2
   428
     *
williamr@2
   429
     * @param aOwnedExternally Not used.
williamr@2
   430
     */
williamr@2
   431
    IMPORT_C void SetTitleArrayOwnedExternally(TBool aOwnedExternally);
williamr@2
   432
williamr@2
   433
    /** 
williamr@2
   434
     * Sets the cursor to the specifed menu pane and menu item.
williamr@2
   435
     *
williamr@2
   436
     * @param aCursor The menu pane and menu item to which the cursor is set.
williamr@2
   437
     * @return A @c SCursor structure holding the menu item within the menu
williamr@2
   438
     *         pane.
williamr@2
   439
     */
williamr@2
   440
    IMPORT_C SCursor SetMenuCursor(const SCursor& aCursor);
williamr@2
   441
williamr@2
   442
    /** 
williamr@2
   443
     * Stops displaying the menu bar.
williamr@2
   444
     * 
williamr@2
   445
     * This function causes the menu bar to disappear from the screen until it
williamr@2
   446
     * is invoked again by the user. In most circumstances this is done by the 
williamr@2
   447
     * @c Uikon framework, so an application program will not normally need to 
williamr@2
   448
     * use this function.
williamr@2
   449
     */
williamr@2
   450
    IMPORT_C void StopDisplayingMenuBar();
williamr@2
   451
williamr@2
   452
    /** 
williamr@2
   453
     * Displays the menu bar.
williamr@2
   454
     *
williamr@2
   455
     * If the menu is not already displayed, this function displays the menu
williamr@2
   456
     * bar and allows the user to make a selection. In most circumstances this
williamr@2
   457
     * is done by the @c Uikon framework, so an application program will not 
williamr@2
   458
     * normally need to use this function.
williamr@2
   459
     */
williamr@2
   460
    IMPORT_C void TryDisplayMenuBarL();
williamr@2
   461
	IMPORT_C void TryDisplayContextMenuBarL();
williamr@2
   462
    /**
williamr@2
   463
     * If the menu is not already displayed, this function displays the menu
williamr@2
   464
     * bar without fep menu and allows the user to make a selection. In most
williamr@2
   465
     * circumstances this is done by the @c Uikon framework, so an application 
williamr@2
   466
     * program will not normally need to use this function.
williamr@2
   467
     */
williamr@2
   468
    IMPORT_C void TryDisplayMenuBarWithoutFepMenusL();
williamr@2
   469
williamr@2
   470
    /** 
williamr@2
   471
     * Not implemented.
williamr@2
   472
     *
williamr@2
   473
     * @param aNewSelectedTitle Not used
williamr@2
   474
     * @param aNewSelectedItem Not used.
williamr@2
   475
     */	
williamr@2
   476
    IMPORT_C void MoveHighlightToL(TInt aNewSelectedTitle,
williamr@2
   477
                                   TInt aNewSelectedItem=0);
williamr@2
   478
williamr@2
   479
    /** 
williamr@2
   480
     * Not implemented. 
williamr@2
   481
     *
williamr@2
   482
     * @param aItem Not used. 
williamr@2
   483
     */	
williamr@2
   484
    IMPORT_C void DrawItem(TInt aItem) const;
williamr@2
   485
williamr@2
   486
    /** 
williamr@2
   487
     * Gets a pointer to the menu’s hot key table. 
williamr@2
   488
     */	
williamr@2
   489
    CEikHotKeyTable* HotKeyTable() const { return(iHotKeyTable); }
williamr@2
   490
williamr@2
   491
    /** 
williamr@2
   492
     * Gets the index of the menu pane selected by the cursor.
williamr@2
   493
     *
williamr@2
   494
     * @return The index of the selected menu pane.
williamr@2
   495
     */	
williamr@2
   496
    IMPORT_C TInt SelectedTitle();
williamr@2
   497
williamr@2
   498
    /** 
williamr@2
   499
     * Gets the index of the menu item selected by the cursor.
williamr@2
   500
     *
williamr@2
   501
     * @return The index of the selected menu item.
williamr@2
   502
     */	
williamr@2
   503
    IMPORT_C TInt SelectedItem();
williamr@2
   504
williamr@2
   505
    /** 
williamr@2
   506
     * Searches for the menu item that corresponds to the specified command.
williamr@2
   507
     *
williamr@2
   508
     * @param aCommandId The ID to search for. 
williamr@2
   509
     * @param aPaneindex Menu pane index.
williamr@2
   510
     * @param aItemindex Menu item index.
williamr@2
   511
     */	
williamr@2
   512
    IMPORT_C virtual void FindCommandIdInResourceL(TInt aCommandId,
williamr@2
   513
                                                   TInt& aPaneindex,
williamr@2
   514
                                                   TInt& aItemindex);
williamr@2
   515
williamr@2
   516
    /** 
williamr@2
   517
     * Gets a menu pane resource.
williamr@2
   518
     *
williamr@2
   519
     * @return The pointer to @c CEikMenuPane object containing a menu pane 
williamr@2
   520
     * resource.
williamr@2
   521
     */	
williamr@2
   522
    IMPORT_C CEikMenuPane* MenuPane();
williamr@2
   523
williamr@2
   524
    /** 
williamr@2
   525
     * If the menu bar is visible, removes the menu bar height from the top of
williamr@2
   526
     * @c aRect and returns the new rectangle in a new value of @c aRect. 
williamr@2
   527
     *
williamr@2
   528
     * @param[in,out] aRect A rectangle that on return is reduced in height by
williamr@2
   529
     *                the height of the menu bar.
williamr@2
   530
     */	
williamr@2
   531
    IMPORT_C void ReduceRect(TRect& aRect) const;
williamr@2
   532
williamr@2
   533
    /** 
williamr@2
   534
     * Gets array of information about the menu bar titles.
williamr@2
   535
     *
williamr@2
   536
     * @return Pointer to @c CTitleArray object containing array of information 
williamr@2
   537
     *         about menu bar titles.
williamr@2
   538
     */	
williamr@2
   539
    IMPORT_C CTitleArray* TitleArray();
williamr@2
   540
williamr@2
   541
    /** 
williamr@2
   542
     * Sets menu observer interface.
williamr@2
   543
     *
williamr@2
   544
     * @param aEditMenuObserver Menu observer interface.
williamr@2
   545
     */	
williamr@2
   546
    IMPORT_C void SetEditMenuObserver(MEikMenuObserver* aEditMenuObserver);
williamr@2
   547
williamr@2
   548
    /** 
williamr@2
   549
     * Sets the menu observer interface to @c NULL.
williamr@2
   550
     *
williamr@2
   551
     * @param aEditMenuObserver Menu observer interface that will be set to @c
williamr@2
   552
     *        NULL.
williamr@2
   553
     */	
williamr@2
   554
    IMPORT_C void RemoveEditMenuObserver(MEikMenuObserver* aEditMenuObserver);
williamr@2
   555
 
williamr@2
   556
    /** 
williamr@2
   557
     * Allows the client to determine if the menubar instance is displayed.
williamr@2
   558
     *
williamr@2
   559
     * @return @c Etrue if displayed and @c EFalse if not.
williamr@2
   560
     */
williamr@2
   561
    IMPORT_C TBool IsDisplayed();
williamr@2
   562
williamr@2
   563
    /**
williamr@2
   564
    * Sets type of the menu. Menu can be for example Options menu launched from 
williamr@2
   565
    * Options softkey or context sensitive menu launched from the selection key.
williamr@2
   566
    * By default the launched menu is options menu.
williamr@2
   567
    * @since S60 3.1
williamr@2
   568
    * @param aMenuType One of values of CEikMenuBar::TMenuType enumeration. 
williamr@2
   569
    */
williamr@2
   570
    IMPORT_C void SetMenuType(TMenuType aMenuType);
williamr@4
   571
    
williamr@4
   572
    /**
williamr@4
   573
    * Gets type of the menu. 
williamr@4
   574
    * 
williamr@4
   575
    * @since S60 5.2
williamr@4
   576
    * @return the type defined in CEikMenuBar::TMenuType of menu.
williamr@4
   577
    */    
williamr@4
   578
    IMPORT_C CEikMenuBar::TMenuType GetMenuType() const;    
williamr@4
   579
williamr@4
   580
    /**
williamr@4
   581
     * Returns ETrue when item specific commands are enabled in menu
williamr@4
   582
     * bar (main pane collection has a highlight) and EFalse when they are
williamr@4
   583
     * disabled (main pane collection does not have a highlight). 
williamr@4
   584
     * 
williamr@4
   585
     * @since S60 5.2
williamr@4
   586
     * @return ETrue when item specific commands are enabled.
williamr@4
   587
     */
williamr@4
   588
    IMPORT_C TBool ItemSpecificCommandsEnabled() const;
williamr@4
   589
    
williamr@4
   590
    /**
williamr@4
   591
     * Sets item action menu instance to menu bar.
williamr@4
   592
     * 
williamr@4
   593
     * @internal
williamr@4
   594
     * @since S60 v5.2
williamr@4
   595
     * @param aItemActionMenu Pointer to item action menu.
williamr@4
   596
     */
williamr@4
   597
    void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu );
williamr@4
   598
williamr@4
   599
    /**
williamr@4
   600
     * Provides pointer to item action menu.
williamr@4
   601
     * 
williamr@4
   602
     * @internal
williamr@4
   603
     * @since S60 v5.2
williamr@4
   604
     * @return Pointer to item action menu.
williamr@4
   605
     */
williamr@4
   606
    CAknItemActionMenu* ItemActionMenu() const;
williamr@4
   607
williamr@4
   608
    /**
williamr@4
   609
     * Populates item action menu.
williamr@4
   610
     * 
williamr@4
   611
     * @internal
williamr@4
   612
     * @since S60 v5.2
williamr@4
   613
     * @param aItemActionMenu Reference to item action menu.
williamr@4
   614
     * @return Created menu pane. Ownership transfers to caller.
williamr@4
   615
     */
williamr@4
   616
    CEikMenuPane* PopulateItemActionMenuL( CAknItemActionMenu& aItemActionMenu );
williamr@2
   617
williamr@2
   618
private: // from MAknIntermediateState
williamr@2
   619
williamr@2
   620
	void CloseState();
williamr@2
   621
	
williamr@2
   622
public:	// from CCoeControl
williamr@2
   623
williamr@2
   624
    /** 
williamr@2
   625
     * From @c CCoeControl.
williamr@2
   626
     *
williamr@2
   627
     * Gets the list of logical colours used to draw the control. 
williamr@2
   628
     *
williamr@2
   629
     * The list includes an explanation of how each colour is used. By default,
williamr@2
   630
     * this function has an empty implementation. 
williamr@2
   631
     *
williamr@2
   632
     * @since 5.1 SDK.
williamr@2
   633
     * @param aColorUseList The colour list.
williamr@2
   634
     */
williamr@2
   635
    IMPORT_C virtual void GetColorUseListL(
williamr@2
   636
	    CArrayFix<TCoeColorUse>& aColorUseList) const; 
williamr@2
   637
	
williamr@2
   638
	/** 
williamr@2
   639
     * From @c CCoeControl.
williamr@2
   640
     *
williamr@2
   641
     * Handles a change to the control's resources. 
williamr@2
   642
     *
williamr@2
   643
     * The types of resources handled are those which are shared across the
williamr@2
   644
     * environment, e.g. colours or fonts. 
williamr@2
   645
     *
williamr@2
   646
     * @since 5.1 SDK.
williamr@2
   647
     * @param aType A message UID value. The most common is @c 
williamr@2
   648
     *        KEikMessageColorSchemeChange which controls get when the colour 
williamr@2
   649
     *        scheme is changed. Other examples include: @c 
williamr@2
   650
     *        KEikMessageFadeAllWindows, @c KEikMessageUnfadeWindows, @c 
williamr@2
   651
     *        KEikMessageZoomChange, @c KEikMessageVirtualCursorStateChange, @c
williamr@2
   652
     *        KEikMessageCapsLock, @c KEikMessagePrepareForSave.
williamr@2
   653
     */
williamr@2
   654
	IMPORT_C virtual void HandleResourceChange(TInt aType);			
williamr@2
   655
williamr@2
   656
private: // from CCoeControl
williamr@2
   657
	IMPORT_C void Reserved_1();
williamr@2
   658
	IMPORT_C void Reserved_2();
williamr@2
   659
	// from MEikCommandObserver
williamr@2
   660
	void ProcessCommandL(TInt aCommandId);
williamr@2
   661
private: // from MObjectProvider
williamr@2
   662
	TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
williamr@2
   663
private:
williamr@2
   664
	void StartDisplayingMenuBarL();
williamr@2
   665
	void HideMenuPane();
williamr@2
   666
	void SaveCurrentMenuPositionL();
williamr@2
   667
	void SetCursorPositionFromArray();
williamr@2
   668
	TBool MenuHasItems() const;
williamr@2
   669
	void SetMenuHasItems();
williamr@2
   670
	TBool MenuHasPane() const;
williamr@2
   671
	void SetMenuHasPane();
williamr@2
   672
	TBool TitleArrayOwnedExternally() const;
williamr@2
   673
	void ResetTitleArray();
williamr@2
   674
	void CreateTitleArrayL();
williamr@2
   675
	void SetMenuPaneFlag(TInt aFlag);
williamr@2
   676
	void AddFEPMenuL();
williamr@2
   677
	void AddMenuIfNotPresentL(TInt aResourceId);
williamr@2
   678
	void UpdateTitleTextBaseline();
williamr@2
   679
private:
williamr@2
   680
	enum TEikMenuFlags {ETitleArrayOwnedExternally=0x01,EMenuHasItems=0x02,EMenuHasPane=0x04,EBackgroundFaded=0x08, ESoundsInstalled=0x10};
williamr@2
   681
	CEikButtonGroupContainer* iMenuCba;
williamr@2
   682
	MEikMenuObserver* iMenuObserver;
williamr@2
   683
	MEikMenuObserver* iEditMenuObserver;
williamr@2
   684
	MEikMenuObserver* iActiveEditMenuObserver;
williamr@2
   685
	CEikMenuPane* iMenuPane;
williamr@2
   686
 	CEikHotKeyTable* iHotKeyTable;
williamr@2
   687
	SCursor iCursor;
williamr@2
   688
	TInt iMenuTitleResourceId;
williamr@2
   689
	TInt iMenuPaneResourceId;
williamr@2
   690
	TInt iMenuHotKeyResourceId;
williamr@2
   691
	TInt iSelectedTitle;
williamr@2
   692
	TInt iBaseLine;
williamr@2
   693
	TInt iMenuTitleLeftSpace;
williamr@2
   694
	TInt iMenuFlags;
williamr@2
   695
	CTitleArray* iTitleArray;
williamr@2
   696
	CArrayFixFlat<SPosition>* iPastMenuPosArray;
williamr@2
   697
	TBool iPreventFepMenu;
williamr@2
   698
	friend class CEikMenuBarExtension;
williamr@2
   699
	CEikMenuBarExtension* iExt;
williamr@2
   700
	};
williamr@2
   701
williamr@2
   702
 /**
williamr@2
   703
  *  This class is not intended to be used by application programmers.
williamr@2
   704
  */
williamr@2
   705
class CEikMenuPaneTitle : public CEikBorderedControl
williamr@2
   706
	{
williamr@2
   707
	
williamr@2
   708
public:
williamr@2
   709
williamr@2
   710
    /**
williamr@2
   711
     * Default C++ constructor
williamr@2
   712
     */
williamr@2
   713
	IMPORT_C CEikMenuPaneTitle(CEikMenuBar* aMenuBar);
williamr@2
   714
	
williamr@2
   715
	/** 
williamr@2
   716
     * Second phase constructor for a menu bar. By default Symbian 2nd phase
williamr@2
   717
     * constructor is private.
williamr@2
   718
     */	
williamr@2
   719
	IMPORT_C void ConstructL();
williamr@2
   720
	
williamr@2
   721
	/** 
williamr@2
   722
     * Not implemented
williamr@2
   723
     *
williamr@2
   724
     * @param aSelectedTitle Not used.
williamr@2
   725
     */	
williamr@2
   726
	IMPORT_C void SetSelectedTitle(TInt aSelectedTitle);
williamr@2
   727
	
williamr@2
   728
	/** 
williamr@2
   729
     * Not implemented
williamr@2
   730
     *
williamr@2
   731
     * @param aRect Not used.
williamr@2
   732
     */	
williamr@2
   733
	IMPORT_C void Draw(const TRect& aRect) const;
williamr@2
   734
    
williamr@2
   735
	/** 
williamr@2
   736
     * Gets the menu pane title’s margins.
williamr@2
   737
     *
williamr@2
   738
     * @return The menu pane title’s margins.
williamr@2
   739
     */    
williamr@2
   740
    IMPORT_C TMargins Margins() const;
williamr@2
   741
	
williamr@2
   742
	/** 
williamr@2
   743
     * Not implemented
williamr@2
   744
     */	
williamr@2
   745
	IMPORT_C void Close();
williamr@2
   746
	
williamr@2
   747
public:// framework
williamr@2
   748
williamr@2
   749
    /**
williamr@2
   750
     * Not implemented.
williamr@2
   751
     *
williamr@2
   752
     * @param aPointerEvent Not used.
williamr@2
   753
     */
williamr@2
   754
	IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   755
williamr@2
   756
	/** 
williamr@2
   757
     * From @c CCoeControl.
williamr@2
   758
     *
williamr@2
   759
     * Gets the list of logical colours used to draw the control. 
williamr@2
   760
     *
williamr@2
   761
     * The list includes an explanation of how each colour is used. By default,
williamr@2
   762
     * this function has an empty implementation. 
williamr@2
   763
     *
williamr@2
   764
     * Since 5.1 SDK.
williamr@2
   765
     *
williamr@2
   766
     * @param aColorUseList The colour list.
williamr@2
   767
     */
williamr@2
   768
	IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
williamr@2
   769
williamr@2
   770
	/** 
williamr@2
   771
     * Not implemented
williamr@2
   772
     *
williamr@2
   773
     * @param aType Not used.
williamr@2
   774
     */
williamr@2
   775
	IMPORT_C virtual void HandleResourceChange(TInt aType);			// not available before Release 005u
williamr@2
   776
williamr@2
   777
private:
williamr@2
   778
    /**
williamr@2
   779
    * From CAknControl
williamr@2
   780
    */
williamr@2
   781
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   782
private:
williamr@2
   783
	CEikMenuBar* const iMenuBar;
williamr@2
   784
	TInt iSelectedTitle;
williamr@2
   785
	};
williamr@2
   786
williamr@2
   787
#endif