epoc32/include/mw/eikmenup.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 /*
     1 /*
     2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     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
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8 *
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    41 class CEikScrollBarFrame;
    41 class CEikScrollBarFrame;
    42 class CEikScrollBar;
    42 class CEikScrollBar;
    43 class TEikScrollBarModel;
    43 class TEikScrollBarModel;
    44 class CGulIcon;
    44 class CGulIcon;
    45 class CEikMenuPaneExtension ;
    45 class CEikMenuPaneExtension ;
       
    46 class CEikCba;
       
    47 class CAknItemActionMenuData;
    46 
    48 
    47 // CONSTANTS
    49 // CONSTANTS
    48 const TInt KScaleableTextSeparator = 0x0001;
    50 const TInt KScaleableTextSeparator = 0x0001;
    49 
    51 
    50 /**
    52 /**
   250     }
   252     }
   251 
   253 
   252 
   254 
   253 inline TBool CEikMenuPaneItem::IsScaleableText(const TDesC& aText) const
   255 inline TBool CEikMenuPaneItem::IsScaleableText(const TDesC& aText) const
   254     {
   256     {
   255     return (aText.Locate(TChar(KScaleableTextSeparator)) == KErrNotFound ? EFalse : ETrue);
   257     return aText.Locate( TChar( KScaleableTextSeparator ) ) != KErrNotFound;
   256     }
   258     }
   257 
   259 
   258 
   260 
   259 /**
   261 /**
   260  * Menu panes are opened by activating the menu title 
   262  * Menu panes are opened by activating the menu title 
   771     
   773     
   772     /**
   774     /**
   773      * Deletes dimmed items from the menu item array.
   775      * Deletes dimmed items from the menu item array.
   774      */
   776      */
   775     void FilterDimmedItems();
   777     void FilterDimmedItems();
   776     
   778 
   777     /**
       
   778      * Not implemented.
       
   779      *
       
   780      * @param aWidth Not used.
       
   781      */
       
   782     void ClipMenuItems(TInt aWidth);
       
   783     
       
   784     /**
   779     /**
   785      * Gets the menu pane for the cascade menu.
   780      * Gets the menu pane for the cascade menu.
   786      *
   781      *
   787      * @return The menu pane for the cascade menu.
   782      * @return The menu pane for the cascade menu.
   788      */
   783      */
   795      * @param aItemIndex The index of the item in the items array.
   790      * @param aItemIndex The index of the item in the items array.
   796      * @return The menu item's data.
   791      * @return The menu item's data.
   797      * @leave  KErrArgument Wrong @aItemIndex.
   792      * @leave  KErrArgument Wrong @aItemIndex.
   798      */
   793      */
   799     IMPORT_C CEikMenuPaneItem::SData& ItemDataByIndexL(TInt aItemIndex);
   794     IMPORT_C CEikMenuPaneItem::SData& ItemDataByIndexL(TInt aItemIndex);
   800     
   795 
   801     /**
       
   802      * Checks if the position of the menu was set from outside.
       
   803      *
       
   804      * @since S60 3.1
       
   805      * @return @c ETrue in case when position of the menu was set from outside.
       
   806      */
       
   807     TBool IsPositionToBeForced() const;
       
   808     
       
   809     /**
   796     /**
   810      * Creates and enables a special characters row to be used in the edit 
   797      * Creates and enables a special characters row to be used in the edit 
   811      * menu.
   798      * menu.
   812      *
   799      *
   813      * @since S60 3.1 
   800      * @since S60 3.1 
   822      * @param aIndex The index of the menu item for which the command ID is returned.
   809      * @param aIndex The index of the menu item for which the command ID is returned.
   823      * @since 3.1
   810      * @since 3.1
   824      */
   811      */
   825     IMPORT_C TInt MenuItemCommandId( TInt aIndex ) const;
   812     IMPORT_C TInt MenuItemCommandId( TInt aIndex ) const;
   826 
   813 
   827     
       
   828     /**
   814     /**
   829      * Creates and enables a special characters row to be used in the edit menu.
   815      * Creates and enables a special characters row to be used in the edit menu.
   830      * The special character row is constructed from the given special character table.
   816      * The special character row is constructed from the given special character table.
   831      *
   817      *
   832      * @param aSpecialChars Buffer that holds the selected characters after 
   818      * @param aSpecialChars Buffer that holds the selected characters after 
   861      *
   847      *
   862      * @since S60 3.2
   848      * @since S60 3.2
   863      */
   849      */
   864     IMPORT_C void ConstructMenuSctRowFromDialogL( TInt aCharCase, TDes& aSpecialChars, TInt aResourceId );
   850     IMPORT_C void ConstructMenuSctRowFromDialogL( TInt aCharCase, TDes& aSpecialChars, TInt aResourceId );
   865 
   851 
       
   852     /**
       
   853      * Sets menu item as item specific command.
       
   854      * 
       
   855      * @param aCommandId The command associated with this menu item.
       
   856      * @param aItemSpecific ETrue to define the menu item item specific,
       
   857      * EFalse otherwise.
       
   858      */
       
   859     IMPORT_C void SetItemSpecific( TInt aCommandId, TBool aItemSpecific );
       
   860 
       
   861     /**
       
   862      * Sets the embedded cba to options menu
       
   863      *
       
   864      * @param aCba Cba to embed to menu
       
   865      * 
       
   866      * @since S60 v5.2
       
   867      */
       
   868     void SetEmbeddedCba( CEikCba* aCba );
       
   869 
       
   870     /**
       
   871      * Closes and destroys any current cascade menu and takes focus back. Does
       
   872      * nothing if no cascade menu exists.
       
   873      * 
       
   874      * @param aMainMenuClosing ETrue if main menu is also to be closed.
       
   875      */
       
   876     void CloseCascadeMenu( TBool aMainMenuClosing );
       
   877 
       
   878     /**
       
   879      * Symbian two-phased constructor for menu panes that are created for
       
   880      * item specific menus.
       
   881      * 
       
   882      * @internal
       
   883      * @since S60 v5.2
       
   884      * @return Created menu pane. Ownership transfers to caller.
       
   885      */
       
   886     static CEikMenuPane* NewItemCommandMenuL( MEikMenuObserver* aObserver );
       
   887 
       
   888     /**
       
   889      * Sets item specific commands dimmed.
       
   890      * 
       
   891      * @internal
       
   892      * @since S60 v5.2
       
   893      */
       
   894     void SetItemCommandsDimmed();
       
   895 
       
   896     /**
       
   897      * Adds menu items to this menu and item action menu data. 
       
   898      * 
       
   899      * @internal
       
   900      * @since S60 v5.2
       
   901      * @param aMenuData Item action menu data.
       
   902      */
       
   903     void AddMenuItemsToItemActionMenuL(
       
   904             CAknItemActionMenuData& aMenuData );
       
   905 
       
   906     /**
       
   907      * Adds cascade menu items to item action menu data.
       
   908      * 
       
   909      * @internal
       
   910      * @since S60 v5.2
       
   911      * @param aCascadeId Cascade menu id.
       
   912      * @param aItemSpecific If ETrue, adds only item specific items.
       
   913      * @param aMenuData Item action menu data.
       
   914      */
       
   915     void AddCascadeMenuItemsToActionMenuL(
       
   916             TInt aCascadeId,
       
   917             TBool aItemSpecific,
       
   918             CAknItemActionMenuData& aMenuData );
       
   919     
       
   920     /**
       
   921      * Enables the default highlight in menu
       
   922      */
       
   923     void SetDefaultHighlight();
       
   924     
   866 private:
   925 private:
   867     enum { EInvalidCurrentSize=0x01, EBackgroundFaded=0x02 };
   926     enum { EInvalidCurrentSize=0x01, EBackgroundFaded=0x02 };
   868     
   927     
   869 private: // new functions
   928 private: // new functions
   870     TRect CalculateSizeAndPosition() ;
   929     TRect CalculateSizeAndPosition() ;
   871     enum THighlightType {ENoHighlight,EDrawHighlight,ERemoveHighlight};
   930     enum THighlightType {ENoHighlight,EDrawHighlight,ERemoveHighlight};
       
   931     void DrawItem( TInt aItem, THighlightType aHighlight ) const;
   872     void DrawItem(CWindowGc& aGc,TInt aItem, THighlightType aHighlight) const;
   932     void DrawItem(CWindowGc& aGc,TInt aItem, THighlightType aHighlight) const;
   873     void FindHotKeyDisplayText(TDes& aDes,const CEikMenuPaneItem& aItem) const;
       
   874     void ReportSelectionMadeL( TBool aAbortTransition = ETrue );
   933     void ReportSelectionMadeL( TBool aAbortTransition = ETrue );
   875     void ReportCanceled();
   934     void ReportCanceled();
   876     void GiveVisualFeedback();
       
   877     void LaunchCascadeMenuL(TInt aCascadeMenuId);
   935     void LaunchCascadeMenuL(TInt aCascadeMenuId);
   878     void DoLaunchCascadeMenuL(TInt aCascadeMenuId);
   936     void DoLaunchCascadeMenuL(TInt aCascadeMenuId);
   879     void TryLaunchCascadeMenuL(const CEikMenuPaneItem& aItem);
   937     void TryLaunchCascadeMenuL(const CEikMenuPaneItem& aItem);
   880     void PrepareGcForDrawingItems(CGraphicsContext& aGc) const;
   938     void PrepareGcForDrawingItems(CGraphicsContext& aGc) const;
   881     TBool ItemArrayOwnedExternally() const;
   939     TBool ItemArrayOwnedExternally() const;
   886     void UpdateScrollBar();
   944     void UpdateScrollBar();
   887     void DoUpdateScrollBarL();
   945     void DoUpdateScrollBarL();
   888     void UpdateScrollBarThumbs();
   946     void UpdateScrollBarThumbs();
   889     static TInt UpdateScrollBarCallBackL(TAny* aObj);
   947     static TInt UpdateScrollBarCallBackL(TAny* aObj);
   890     TRect ViewRect() const;
   948     TRect ViewRect() const;
   891 //    TInt NumberOfItemsThatFitInView() const;
       
   892     TInt TotalItemHeight() const;
   949     TInt TotalItemHeight() const;
   893     void ScrollToMakeItemVisible(TInt aItemIndex);
   950     void ScrollToMakeItemVisible(TInt aItemIndex);
   894     void Scroll(TInt aAmount);
   951     void Scroll(TInt aAmount);
   895     TBool CheckCreateScroller();
   952     TBool CheckCreateScroller();
   896     void CheckCreateScrollerL();
   953     void CheckCreateScrollerL();
   897     void ResetItemArray();
   954     void ResetItemArray();
   898     void CreateItemArrayL();
   955     void CreateItemArrayL();
   899     void SetVScrollBarFlag();
       
   900     TInt TopHighlightGap() const;
       
   901     TInt BottomHighlightGap() const;
       
   902     TInt EvaluateMaxIconWidth() const;
       
   903     void CreateIconFromResourceL(TResourceReader& aReader, CEikMenuPaneItem& aItem) const;
   956     void CreateIconFromResourceL(TResourceReader& aReader, CEikMenuPaneItem& aItem) const;
   904     // new for AVKON
       
   905     void AnimateMenuPane(const TPoint& aNewPos);
       
   906 
       
   907     // To make layout correct
       
   908     TRect ListMenuPane() const;
       
   909     TRect PopupMenuWindow() const;
       
   910     TRect PopupSubmenuWindow() const;
       
   911 
   957 
   912     // Skin support for menu
   958     // Skin support for menu
   913     void UpdateBackgroundContext(const TRect& aWindowRect);
   959     void UpdateBackgroundContext(const TRect& aWindowRect);
   914 
   960 
   915     // Support method for highlight animation
   961     // Support method for highlight animation
   936     void PrepareHighlightFrame() const;
   982     void PrepareHighlightFrame() const;
   937     void SetCascadedIconSize() const;
   983     void SetCascadedIconSize() const;
   938 
   984 
   939     // fixes marquee flickering
   985     // fixes marquee flickering
   940     friend class CAknMarqueeControl;
   986     friend class CAknMarqueeControl;
   941     static TInt RedrawMarqueeEvent( TAny* aControl );
       
   942     
   987     
   943     CEikMenuPaneExtension* Extension() const;
   988     CEikMenuPaneExtension* Extension() const;
       
   989     
       
   990     /**
       
   991      * Creates menu pane's extension object if it doesn't exist yet.
       
   992      */
       
   993     void CheckCreateExtensionL();
       
   994     
       
   995     /**
       
   996      * Calculates the rectangle occupied by an item.
       
   997 	 *
       
   998 	 * @param aItemIndex Item's index.
       
   999 	 * @return Item's rectangle.
       
  1000      */
       
  1001     TRect ItemRect( TInt aItemIndex ) const;
       
  1002     
       
  1003     /**
       
  1004      * Calculates the height of menu items.
       
  1005 	 *
       
  1006 	 * @return Item height.
       
  1007      */
       
  1008     TInt CalculateItemHeight() const;
   944 
  1009 
   945 protected: // from CoeControl
  1010 protected: // from CoeControl
   946 
  1011 
   947     /**
  1012     /**
   948      * From @c CCoeControl.
  1013      * From @c CCoeControl.
   976     IMPORT_C TInt CountComponentControls() const;
  1041     IMPORT_C TInt CountComponentControls() const;
   977     
  1042     
   978     /**
  1043     /**
   979      * From @c CoeControl.
  1044      * From @c CoeControl.
   980      *
  1045      *
   981      * Gets the specified component of a compound control. This function shouldŽ
  1046      * Gets the specified component of a compound control. This function should?
   982      * be implemented by all compound controls.
  1047      * be implemented by all compound controls.
   983      *
  1048      *
   984      * Note:
  1049      * Note:
   985      * Within a compound control, each component control is identified by an 
  1050      * Within a compound control, each component control is identified by an 
   986      * index, where the index depends on the order the controls were added: the
  1051      * index, where the index depends on the order the controls were added: the
   990      * @return The component control with an index of @c aIndex.
  1055      * @return The component control with an index of @c aIndex.
   991      */
  1056      */
   992     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
  1057     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
   993     
  1058     
   994 protected: // new functions
  1059 protected: // new functions
   995     
  1060 
   996     /**
       
   997      * Disables sliding effect
       
   998      * By default is enabled if there is enough memory.
       
   999      *
       
  1000      * @since 3.1
       
  1001      */
       
  1002     void DisableAnimation();
       
  1003     
       
  1004     /**
       
  1005      * The position of the menu will be changed according to the one 
       
  1006      * which is specified by arguments in StartDisplayingMenuPane()
       
  1007      * By default those arguments are not used.
       
  1008      *
       
  1009      * @since 3.1
       
  1010      * @param aForced @c Etrue if arguments are used.
       
  1011      */
       
  1012     void SetPositionToBeForced(TBool aForced);
       
  1013     
       
  1014     /**
  1061     /**
  1015      * Gets the maximum number of items which can be seen simultaneously.
  1062      * Gets the maximum number of items which can be seen simultaneously.
  1016      *
  1063      *
  1017      * @return The maximum number of items which can be seen simultaneously.
  1064      * @return The maximum number of items which can be seen simultaneously.
  1018      */
  1065      */
  1019     TInt NumberOfItemsThatFitInView() const;
  1066     TInt NumberOfItemsThatFitInView() const;
  1020     
       
  1021     void DrawNow();    
       
  1022     
  1067     
  1023 private: // data
  1068 private: // data
  1024     friend class CEikMenuButton;
  1069     friend class CEikMenuButton;
  1025     MEikMenuObserver* iMenuObserver;
  1070     MEikMenuObserver* iMenuObserver;
  1026     MEikMenuObserver* iEditMenuObserver;
  1071     MEikMenuObserver* iEditMenuObserver;
  1039     TInt iFlags;
  1084     TInt iFlags;
  1040     CEikScrollBarFrame* iSBFrame;
  1085     CEikScrollBarFrame* iSBFrame;
  1041     CMenuScroller* iScroller;
  1086     CMenuScroller* iScroller;
  1042     CEikButtonBase* iLaunchingButton; // for popouts only
  1087     CEikButtonBase* iLaunchingButton; // for popouts only
  1043     TInt iSubPopupWidth; // 0..2
  1088     TInt iSubPopupWidth; // 0..2
  1044     TBool iEnableAnimation;
  1089     TInt iSpare;
  1045     CEikMenuPaneExtension* iExtension ;  // iSpare used for extension class pointer.
  1090     CEikMenuPaneExtension* iExtension;
  1046 
  1091 
  1047     };
  1092     };
  1048 
  1093 
  1049 #endif
  1094 #endif
  1050 
  1095