2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__EIKMENUP_H__)
20 #define __EIKMENUP_H__
22 #if !defined(__EIKBCTRL_H__)
26 #if !defined(__EIKDEF_H__)
30 #if !defined(__EIKSBOBS_H__)
31 #include <eiksbobs.h> // for TEikScrollEvent
36 // FORWARD DECLARATIONS
37 class MEikMenuObserver;
38 class CEikHotKeyTable;
39 class CEikMenuPaneTitle;
41 class CEikScrollBarFrame;
43 class TEikScrollBarModel;
45 class CEikMenuPaneExtension ;
47 class CAknItemActionMenuData;
50 const TInt KScaleableTextSeparator = 0x0001;
53 * A helper class for extending CEikMenuPaneItem without breaking binary
56 class CExtendedItemData : public CBase
68 /** Two packaked bitmaps: bitmap icon and mask for it. */
71 /** Scalable text buffer. */
72 HBufC* iScaleableText;
77 * The @c CEikMenuPaneItem class encapsulates the data needed to define a menu
78 * pane item and provides some of the functionality required to display the
83 class CEikMenuPaneItem : public CBase
88 /** Struct to menu pane item. */
92 /** Nominal text length.*/
93 enum { ENominalTextLength=40 };
96 * ID of the command to issue when the menu item using this @c SData is
101 /** Resource ID of a menu pane to cascade from this item. */
105 * Flags used internally by @c CEikMenuPane and accessible through
106 * functions such as @c CEikMenuPane::SetItemDimmed().
110 /** The text buffer displayed in the main area of the menu item. */
111 TBuf<ENominalTextLength> iText; // less than this actually stored
114 * Additional descriptive text about the item. This is used by @c
115 * CEikMenuPane to display hotkey names.
123 * C++ default constructor.
125 IMPORT_C CEikMenuPaneItem();
130 IMPORT_C ~CEikMenuPaneItem();
133 * Sets a menu item icon. This replaces any icon already set for the menu
136 * @param aIcon Menu item icon consisting of a picture bitmap and a mask
139 IMPORT_C void SetIcon(CGulIcon* aIcon);
142 * Draws the menu item icon.
144 * @param aGc Graphics context to which the icon is drawn.
145 * @param aRect Rectangle in which the icon is drawn.
146 * @param aDimmed If @c ETrue the icon is drawn dimmed.
147 * @param aBitmapSpaceRequired Length of one side of the square required to
148 * contain the bitmap.
150 IMPORT_C void DrawItemIcon(CWindowGc& aGc,
153 TInt aBitmapSpaceRequired) const;
156 * Construct an icon from bitmaps.
158 * Constructs a new icon for the menu item, taking ownership of the picture
159 * bitmap aBitmap and the mask bitmap aMask unless the bitmaps are
162 * @param aBitmap Picture bitmap.
163 * @param aMask Mask bitmap.
165 IMPORT_C void CreateIconL(CFbsBitmap* aBitmap,
169 * Gets a pointer to the menu item's icon picture bitmap. This does not
170 * imply transfer of ownership.
172 * @return Picture bitmap.
174 IMPORT_C CFbsBitmap* IconBitmap() const;
177 * Gets a pointer to the menu item's icon mask bitmap. This does not imply
178 * transfer of ownership.
180 * @return Mask bitmap.
182 IMPORT_C CFbsBitmap* IconMask() const;
185 * Sets icon bitmap ownership.
186 * Sets the menu item's icon bitmaps as externally owned if @c
187 * aOwnedExternally is @c ETrue.
189 * @param aOwnedExternally If @c ETrue bitmaps are set as externally owned.
190 * @c If EFalse bitmaps are set as not being externally owned.
192 IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
195 * Sets the picture bitmap. Transfers ownership unless the bitmaps are
196 * already owned externally.
198 * @param aBitmap Picture bitmap.
200 IMPORT_C void SetIconBitmapL(CFbsBitmap* aBitmap);
203 * Sets the mask bitmap. Transfers ownership unless the bitmaps are already
206 * @param aMask Mask bitmap.
208 IMPORT_C void SetIconMaskL(CFbsBitmap* aMask);
211 * Returns scaleable text. If there isn't scaleable text available then
212 * this method returns @c iData.iText.
214 * @return Pointer to TPtrC object that contains scaleable text.
216 IMPORT_C TPtrC ScaleableText() const;
219 * Sets scaleable text. @c iData.iText is set to first text version.
221 * @param aText Scalable text.
223 IMPORT_C void SetScaleableTextL(const TDesC& aText);
226 inline void CreateExtendedDataBlock();
227 inline TBool IsScaleableText(const TDesC& aText) const;
228 TPtrC GetNominalText(const TDesC& aText);
232 /** The y position of the menu pane item. */
235 /** The menu pane item's hotkey text. */
238 /** Information from an SData struct. */
242 CExtendedItemData* iExtendedData;
246 inline void CEikMenuPaneItem::CreateExtendedDataBlock()
250 TRAPD(err, ( iExtendedData = new (ELeave) CExtendedItemData() ) );
255 inline TBool CEikMenuPaneItem::IsScaleableText(const TDesC& aText) const
257 return aText.Locate( TChar( KScaleableTextSeparator ) ) != KErrNotFound;
262 * Menu panes are opened by activating the menu title
263 * @c (CEikMenuPaneTitle / MENU_TITLE) which is displayed in the menu bar @c
264 * (CEikMenuBar / MENU_BAR). They can also be cascaded from a menu item @c
265 * (CEikMenuPaneItem / MENU_ITEM) or launched by a menu button @c
268 * Menu panes may be defined using a @c MENU_PANE resource.
270 class CEikMenuPane : public CEikBorderedControl
273 enum {ENothingSelected=-1};
275 friend class CMenuScroller;
276 friend class CEikMenuPaneExtension;
279 /** The text to be displayed for a hotkey. */
280 typedef TBuf<20> THotKeyDisplayText;
285 * This class provides a constructor to create an array of menu pane items
286 * and a destructor to destroy an array of menu pane items.
288 class CItemArray:public CArrayPtrFlat<CEikMenuPaneItem>
294 * C++ default constructor that creates a flat array of menu pane
297 IMPORT_C CItemArray();
302 IMPORT_C ~CItemArray();
305 * Appends @c CEikMenuPaneItem class object to array.
307 * @param aMenuItem The menu item to add.
309 IMPORT_C void AddItemL(CEikMenuPaneItem* aMenuItem);
317 IMPORT_C ~CEikMenuPane();
320 * C++ default constructor. Constructs a menu pane object with the
321 * specified observer.
323 * @param aMenuObserver Menu observer.
325 IMPORT_C CEikMenuPane(MEikMenuObserver* aMenuObserver);
328 * Handles 2nd base construction. Completes construction of a menu pane object.
330 * @param aOwner Menu pane owner ( for cascade menu ).
331 * @param aEditMenuObserver Observer for the edit menu. In default this is
334 IMPORT_C void ConstructL(CEikMenuPane* aOwner,
335 MEikMenuObserver* aEditMenuObserver = NULL);
338 * Destroys the menu pane's item array.
340 IMPORT_C void Reset();
345 * From @c CcoeControl.
347 * Handles key events offered to the menu by the control environment and
348 * provides an appropriate implementation of @c
349 * CCoeControl::OfferKeyEventL().
351 * @param aKeyEvent The key event.
352 * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c
355 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
359 * From @c CcoeControl.
361 * Handles a pointer event on the menu.
363 * @param aPointerEvent The pointer event to handle.
365 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
368 * From @c CcoeControl.
370 * Gets the list of logical colours employed in the drawing of the control,
371 * paired with an explanation of how they are used. Appends the list into
375 * @param aColorUseList The list of colours paired with explanations.
377 IMPORT_C virtual void GetColorUseListL(
378 CArrayFix<TCoeColorUse>& aColorUseList) const;
381 * From @c CcoeControl.
383 * Handles a change to the menu's resources which are shared across the
384 * environment. For example, colours or fonts.
387 * @param aType The type of resource that has changed.
389 IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
391 private: // from base class
399 IMPORT_C void* ExtensionInterface( TUid aInterface );
401 public: // from MCoeInputObserver
404 * From @c CCoeControl.
406 * Gets the list box’s input capabilities as set through the list box flags.
408 * @return List box input capabilities.
410 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
412 protected: // from base class
415 * From @c CCoeControl
417 * Draw a control called by window server.
419 * All controls, except blank controls, should implement this function. The
420 * default implementation draws a blank control. This function is used for
421 * window server-initiated redrawing of controls, and for some
422 * application-initiated drawing. It should be implemented by each control,
423 * but is only called from within @c CCoeControl's member functions, and
424 * not from the derived class. For this reason it is a private member
425 * function of @c CCoeControl.
427 * The rectangle aRect indicates the region of the control that needs to be
428 * redrawn. The implementation of @c Draw() must always draw to every pixel
429 * within this rectangle.
431 * @param aRect The region of the control to be redrawn.
432 * Co-ordinates are relative to the control's origin (top left
433 * corner). Optional, not used currently.
435 IMPORT_C void Draw(const TRect& aRect) const;
438 * From @c CCoeControl.
440 * Takes any action required when the menu pane gains or loses focus,
441 * to change its appearance for example.
443 * @param aDrawNow If @c EDrawNow the menu pane is redrawn. If @c
444 * ENoDrawNow the menu pane is not redrawn.
446 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
449 * From @c CCoeControl.
451 * Constructs the menu pane using the specified resource reader.
452 * Fills the menu item array with the list of menu items provided by the
455 * @param aReader The resource reader to use.
456 * @leave KErrNoMemory Memory allocation failure earlier construction.
458 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
460 public: // new functions
463 * Adds a menu item dynamically by creating a new menu item, setting its
464 * data to @c aMenuItem and appending it to the pane's menu item array.
465 * Updates the menu's scroll bar to take account of the new item.
467 * @param aMenuItem The menu item to add.
468 * NOTICE that @c SData is a structure so all fields in it should be
469 * set to avoid any unexpected behaviour.
471 IMPORT_C void AddMenuItemL(const CEikMenuPaneItem::SData& aMenuItem);
474 * Adds a menu item dynamically by creating a new menu item, setting its
475 * data to @c aMenuItem and inserting it into the pane's menu item array.
476 * Updates the menu's scroll bar to take account of the new item.
478 * @param aMenuItem The menu item to add. NOTICE that @c SData is a
479 * structure so all fields in it should be set to avoid any
480 * unexpected behaviour.
481 * @param aPreviousId The id of the item after which the new item should be
484 IMPORT_C void AddMenuItemL(const CEikMenuPaneItem::SData& aMenuItem,
488 * Adds menu items dynamically by creating new menu items from resource
489 * and inserts them into the pane's menu item array.
491 * @param aResourceId The ID of the resource for the menu item.
492 * @param aPreviousId The ID of the previous menu item, after which this
493 * newly created item should be added.
494 * @param aAddSeperator Shouldn't be used as separator is not not supported
497 IMPORT_C void AddMenuItemsL(TInt aResourceId,
498 TInt aPreviousId = 0,
499 TBool aAddSeperator = EFalse);
502 * Deletes the specified item in the menu pane.
504 * @param aCommandId The ID for the item to be deleted.
506 IMPORT_C void DeleteMenuItem(TInt aCommandId);
509 * Deletes the items between specified items.
511 * @param aStartIndex The index of the item after which items should be
513 * @param aEndIndex The index of the item up to which items should be
516 IMPORT_C void DeleteBetweenMenuItems(TInt aStartIndex,
520 * Gets a reference to the data in the specified menu item.
522 * @param aCommandId The command ID of the menu item for which data is
524 * @return Reference to struct that contains command id.
526 IMPORT_C CEikMenuPaneItem::SData& ItemData(TInt aCommandId);
529 * Gets a pointer to the specified menu item. Also gets the position of the
530 * item within the menu pane. Panics if there are no menu items in the menu
531 * pane. Panics if the menu pane id does not identify any menu pane item in
534 * @param aCommandId The ID of the menu item for which a pointer is
536 * @param aPos On return, the position of the menu item with an ID of
538 * @return A pointer to the menu item.
539 * @panic EEikPanicNoSuchMenuItem Panics if there are no menu items in the
540 * menu pane or if the menu pane id does not
541 * identify any menu pane item in the array.
543 IMPORT_C CEikMenuPaneItem* ItemAndPos(TInt aCommandId,TInt& aPos);
546 * Displays the menu pane with the corner identified by @c aTargetType in
547 * the position specified by @c aTargetPos. This function uses @c
548 * aMinTitleWidth to calculate the area required to display the menu pane,
549 * taking into account whether the menu is a cascading menu or popup menu.
551 * @param aHotKeyTable Optional hotkey table.
552 * @param aTargetPos Position of the corner of the menu pane identified by
554 * @param aMenuPaneTitle The menu pane's title.
555 * @param aMinWidth Minimum width of the menu's title.
556 * @param aTargetType The corner of the menu pane to which @c aTargetPos
557 * relates. The default is the top left corner. Possible: @c
558 * EPopupTargetTopLeft, @c EPopupTargetTopRight,
559 * @cEPopupTargetBottomLeft, @c EPopupTargetBottomRight.
561 IMPORT_C void StartDisplayingMenuPane(
562 const CEikHotKeyTable* aHotKeyTable,
563 const TPoint& aTargetPos,
564 const CEikMenuPaneTitle* aMenuPaneTitle,
566 TPopupTargetPosType aTargetType = EPopupTargetTopLeft);
569 * Sets the text in a menu item.
571 * @param aCommandId The command (as defined in an .hrh file) associated
572 * with this menu item. This identifies the menu item whose text is
574 * @param aDes New item text.
576 IMPORT_C void SetItemTextL(TInt aCommandId,
580 * Sets the text in a menu item from resource.
582 * @param aCommandId The command (as defined in an .hrh file) associated
583 * with this menu item. This identifies the menu item whose text is
585 * @param aRid The resource ID of the menu item text.
587 IMPORT_C void SetItemTextL(TInt aCommandId,
591 * Dims (greys out) or undims a menu item. Dimming indicates that user
592 * input is not accepted.
594 * @param aCommandId The command (as defined in an .hrh file) associated
595 * with this menu item. This identifies the menu item whose text is
596 * to be dimmed or un-dimmed.
597 * @param aDimmed @c ETrue to dim this menu item. @c EFalse to un-dim this
600 IMPORT_C void SetItemDimmed(TInt aCommandId,
604 * Sets the item to be indicated or not. It should be used to change the
605 * state of radio buttons or check box items. It has real effect only
606 * starting from S60 v3.0.
608 * @param aCommandId The command (as defined in an .hrh file) associated
609 * with this menu item. This identifies the menu item for which the
610 * state is set or unset.
611 * @param aButtonState should be @c EEikMenuItemSymbolOn or @c
612 * EEikMenuItemSymbolIndeterminate
614 IMPORT_C void SetItemButtonState(TInt aCommandId,
618 * Sets the selected menu item.
620 * @param aSelectedItem The index of the item to get selected
622 IMPORT_C void SetSelectedItem(TInt aSelectedItem);
625 * Gets the position of the selected menu item.
627 * @return The position of the selected menu item.
629 IMPORT_C TInt SelectedItem() const;
632 * Closes and destroys any current cascade menu and takes focus back. Does
633 * nothing if no cascade menu exists.
635 IMPORT_C void CloseCascadeMenu();
638 * Sets the array containing the list of menu items for the current menu
641 * @param aItemArray The menu item array for the menu pane.
643 IMPORT_C void SetItemArray(CItemArray* aItemArray);
646 * Set menu item array ownership.
648 * @param aOwnedExternally If @c ETrue the menu pane's menu item array is
649 * set as externally owned. If @c EFalse the menu pane's menu item
650 * array is set as not externally owned.
652 IMPORT_C void SetItemArrayOwnedExternally(TBool aOwnedExternally);
655 * Sets the specified button to launch the menu pane. Doesn't have any
656 * effect in current implementation.
658 * @param aButton The button to set as launching the menu.
660 IMPORT_C void SetLaunchingButton(CEikButtonBase* aButton);
663 * Moves the menu pane highlight to a newly selected menu item identified
664 * by @c aNewSelectedItem. Scrolls the menu to show the new selected item
665 * if necessary and redraws only the newly selected item and the currently
666 * selected item if possible.
668 * @param aNewSelectedItem The newly selected menu item index.
670 IMPORT_C void MoveHighlightTo(TInt aNewSelectedItem);
673 * Gets the number of menu items within the menu pane.
675 * @return Number of menu items within menu pane.
677 IMPORT_C TInt NumberOfItemsInPane() const;
680 * Closes the menu pane.
682 IMPORT_C void Close();
687 * Handles key events offered to the menu by the control environment.
689 * @since Platform 004.
690 * @param aKeyEvent The key event.
691 * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c
693 * @param aConsumeAllKeys If @c ETrue this function returns @c
694 * EKeyWasConsumed regardless of whether it was used. If @c EFalse
695 * the key event is consumed if possible and either @c
696 * EKeyWasConsumed or @c EKeyWasNotConsumed is returned as
699 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
701 TBool aConsumeAllKeys); // not available before Platform 004
704 * Sets whether the scroll bar occupies the left side of the menu pane.
706 * @param aOnLeft If @c ETrue the scroll bar will occupy the left side of
709 IMPORT_C void SetScrollBarOnLeft(TBool aOnLeft);
712 * Sets whether the menu pane uses an arrow head scroll bar.
714 * @param aArrowHead If @c ETrue the menu pane uses an arrow head scroll
717 IMPORT_C void SetArrowHeadScrollBar(TBool aArrowHead);
722 * Moves highlight to the next item or to the first one if last item is
725 IMPORT_C void NavigateToNextItem();
728 * Inserts the menu item to the specified position.
730 * @param aMenuItem The menu item to add. NOTICE @c SData is the structure
731 * and all fileds should be initialized.
732 * @param aPosition The position of newly created item in the array.
734 IMPORT_C void InsertMenuItemL(const CEikMenuPaneItem::SData& aMenuItem,
738 * Checks whether menu pane contains the menu item and returns position of
739 * it if the item is found.
741 * @param[in] aCommandId The command ID of the item to be searched for.
742 * @param[out] aPosition On return contains position of the item.
743 * @return @c ETrue if item was found. Otherwise @c EFalse.
745 IMPORT_C TBool MenuItemExists(TInt aCommandId,
749 * Checks whether the menu pane is a cascade menu or a main menu.
751 * @return @c ETrue if the menu pane is cascade menu and @c EFalse if the
752 * menu pane is the main menu.
754 IMPORT_C TBool IsCascadeMenuPane() const;
757 * Enables or disables text scrolling functionality. It is disabled by
760 * @param aEnable @c ETrue to enable text scrolling functionality.
762 IMPORT_C void EnableMarqueeL(const TBool aEnable);
765 * Report that selection was done for the currently highlighted item.
767 void ActivateCurrentItemL();
770 * Closes cascade menu if there is one and it is active.
772 TBool CancelActiveMenuPane();
775 * Deletes dimmed items from the menu item array.
777 void FilterDimmedItems();
780 * Gets the menu pane for the cascade menu.
782 * @return The menu pane for the cascade menu.
784 IMPORT_C CEikMenuPane* CascadeMenuPane();
787 * Gets a reference to the data in the specified menu item.
790 * @param aItemIndex The index of the item in the items array.
791 * @return The menu item's data.
792 * @leave KErrArgument Wrong @aItemIndex.
794 IMPORT_C CEikMenuPaneItem::SData& ItemDataByIndexL(TInt aItemIndex);
797 * Creates and enables a special characters row to be used in the edit
801 * @param aSpecialChars Buffer that holds the selected characters after
802 * user has selected them.
804 IMPORT_C void ConstructMenuSctRowL( TDes& aSpecialChars );
807 * Returns the command id of the specified menu item. The function panics
808 * if aIndex doesn't exist or is out of range.
809 * @param aIndex The index of the menu item for which the command ID is returned.
812 IMPORT_C TInt MenuItemCommandId( TInt aIndex ) const;
815 * Creates and enables a special characters row to be used in the edit menu.
816 * The special character row is constructed from the given special character table.
818 * @param aSpecialChars Buffer that holds the selected characters after
819 * user has selected them.
820 * @param aResourceId The special character table resource id to define the
821 * characters in the row.
825 IMPORT_C void ConstructMenuSctRowL( TDes& aSpecialChars, TInt aResourceId );
828 * Creates and enables a special characters row to be used in the edit menu.
829 * The special character row is constructed from the given special character dialog.
831 * @param aSpecialChars Buffer that holds the selected characters after
832 * user has selected them.
833 * @param aResourceId The special character dialog resource id that contains a special character table
837 IMPORT_C void ConstructMenuSctRowFromDialogL( TDes& aSpecialChars, TInt aResourceId );
840 * Creates and enables a special characters row to be used in the edit menu.
841 * The special character row is constructed from the given special character dialog.
843 * @param aCharCase the charcase used by menu sct
844 * @param aSpecialChars Buffer that holds the selected characters after
845 * user has selected them.
846 * @param aResourceId The special character dialog resource id that contains a special character table
850 IMPORT_C void ConstructMenuSctRowFromDialogL( TInt aCharCase, TDes& aSpecialChars, TInt aResourceId );
853 * Sets menu item as item specific command.
855 * @param aCommandId The command associated with this menu item.
856 * @param aItemSpecific ETrue to define the menu item item specific,
859 IMPORT_C void SetItemSpecific( TInt aCommandId, TBool aItemSpecific );
862 * Sets the embedded cba to options menu
864 * @param aCba Cba to embed to menu
868 void SetEmbeddedCba( CEikCba* aCba );
871 * Closes and destroys any current cascade menu and takes focus back. Does
872 * nothing if no cascade menu exists.
874 * @param aMainMenuClosing ETrue if main menu is also to be closed.
876 void CloseCascadeMenu( TBool aMainMenuClosing );
879 * Symbian two-phased constructor for menu panes that are created for
880 * item specific menus.
884 * @return Created menu pane. Ownership transfers to caller.
886 static CEikMenuPane* NewItemCommandMenuL( MEikMenuObserver* aObserver );
889 * Sets item specific commands dimmed.
894 void SetItemCommandsDimmed();
897 * Adds menu items to this menu and item action menu data.
901 * @param aMenuData Item action menu data.
903 void AddMenuItemsToItemActionMenuL(
904 CAknItemActionMenuData& aMenuData );
907 * Adds cascade menu items to item action menu data.
911 * @param aCascadeId Cascade menu id.
912 * @param aItemSpecific If ETrue, adds only item specific items.
913 * @param aMenuData Item action menu data.
915 void AddCascadeMenuItemsToActionMenuL(
918 CAknItemActionMenuData& aMenuData );
921 * Enables the default highlight in menu
923 void SetDefaultHighlight();
926 enum { EInvalidCurrentSize=0x01, EBackgroundFaded=0x02 };
928 private: // new functions
929 TRect CalculateSizeAndPosition() ;
930 enum THighlightType {ENoHighlight,EDrawHighlight,ERemoveHighlight};
931 void DrawItem( TInt aItem, THighlightType aHighlight ) const;
932 void DrawItem(CWindowGc& aGc,TInt aItem, THighlightType aHighlight) const;
933 void ReportSelectionMadeL( TBool aAbortTransition = ETrue );
934 void ReportCanceled();
935 void LaunchCascadeMenuL(TInt aCascadeMenuId);
936 void DoLaunchCascadeMenuL(TInt aCascadeMenuId);
937 void TryLaunchCascadeMenuL(const CEikMenuPaneItem& aItem);
938 void PrepareGcForDrawingItems(CGraphicsContext& aGc) const;
939 TBool ItemArrayOwnedExternally() const;
940 TBool IsHotKeyL(const TInt modifiers,const TInt aCode);
941 TBool MoveToItemL(TInt aCode, TInt aModifiers);
942 void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
943 void CreateScrollBarFrame();
944 void UpdateScrollBar();
945 void DoUpdateScrollBarL();
946 void UpdateScrollBarThumbs();
947 static TInt UpdateScrollBarCallBackL(TAny* aObj);
948 TRect ViewRect() const;
949 TInt TotalItemHeight() const;
950 void ScrollToMakeItemVisible(TInt aItemIndex);
951 void Scroll(TInt aAmount);
952 TBool CheckCreateScroller();
953 void CheckCreateScrollerL();
954 void ResetItemArray();
955 void CreateItemArrayL();
956 void CreateIconFromResourceL(TResourceReader& aReader, CEikMenuPaneItem& aItem) const;
958 // Skin support for menu
959 void UpdateBackgroundContext(const TRect& aWindowRect);
961 // Support method for highlight animation
962 void RepaintHighlight() const;
964 private: // from CCoeControl
965 IMPORT_C void Reserved_1();
966 IMPORT_C void Reserved_2();
968 private : // new functions
969 void LoadCascadeBitmapL() ;
971 // Support for check mark, from v3.0
972 void LoadCheckMarkBitmapL();
973 TBool MenuHasCheckBoxOn() const;
974 // Support for radio button, from v3.0
975 void LoadRadioButtonBitmapL();
976 TBool IsItemMemberOfRadioButtonGroup(TInt aItem) const ;
977 // for drawing,from v3.0
978 TBool MenuHasIcon() const;
980 TRect CalculateSizeAndPositionScalable( const TRect& aWindowRect, TInt aNumItemsInPane ) ;
981 TRect HighlightRect() const;
982 void PrepareHighlightFrame() const;
983 void SetCascadedIconSize() const;
985 // fixes marquee flickering
986 friend class CAknMarqueeControl;
988 CEikMenuPaneExtension* Extension() const;
991 * Creates menu pane's extension object if it doesn't exist yet.
993 void CheckCreateExtensionL();
996 * Calculates the rectangle occupied by an item.
998 * @param aItemIndex Item's index.
999 * @return Item's rectangle.
1001 TRect ItemRect( TInt aItemIndex ) const;
1004 * Calculates the height of menu items.
1006 * @return Item height.
1008 TInt CalculateItemHeight() const;
1010 protected: // from CoeControl
1013 * From @c CCoeControl.
1015 * Retrieves an object of the same type as that encapsulated in aId. Other
1016 * than in the case where @c NULL is returned, the object returned must be
1017 * of the same object type - that is, the @c ETypeId member of the object
1018 * pointed to by the pointer returned by this function must be equal to the
1019 * @c iUid member of @c aId.
1022 * @param aId An encapsulated object type ID.
1023 * @return Encapsulates the pointer to the object provided. Note that the
1024 * encapsulated pointer may be @c NULL.
1026 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
1028 public: // From CoeControl.
1031 * From @c CoeControl.
1033 * Gets the number of controls contained in a compound control. This
1034 * function should be implemented by all compound controls.
1037 * In SDK 6.1 this was changed from protected to public.
1039 * @return The number of component controls contained by this control.
1041 IMPORT_C TInt CountComponentControls() const;
1044 * From @c CoeControl.
1046 * Gets the specified component of a compound control. This function should?
1047 * be implemented by all compound controls.
1050 * Within a compound control, each component control is identified by an
1051 * index, where the index depends on the order the controls were added: the
1052 * first is given an index of 0, the next an index of 1, and so on.
1054 * @param[in, out] aIndex The index of the control to get.
1055 * @return The component control with an index of @c aIndex.
1057 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
1059 protected: // new functions
1062 * Gets the maximum number of items which can be seen simultaneously.
1064 * @return The maximum number of items which can be seen simultaneously.
1066 TInt NumberOfItemsThatFitInView() const;
1069 friend class CEikMenuButton;
1070 MEikMenuObserver* iMenuObserver;
1071 MEikMenuObserver* iEditMenuObserver;
1072 CEikMenuPane* iCascadeMenuPane;
1073 const CEikMenuPaneTitle* iMenuPaneTitle;
1074 const CEikHotKeyTable* iHotKeyTable;
1075 CEikMenuPane* iOwner;
1076 CItemArray* iItemArray;
1077 TBool iArrayOwnedExternally;
1078 TBool iAllowPointerUpEvents;
1079 TInt iNumberOfDragEvents;
1083 TInt iHotkeyColWidth;
1085 CEikScrollBarFrame* iSBFrame;
1086 CMenuScroller* iScroller;
1087 CEikButtonBase* iLaunchingButton; // for popouts only
1088 TInt iSubPopupWidth; // 0..2
1090 CEikMenuPaneExtension* iExtension;