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