idlehomescreen/inc/xnmenu.h
changeset 0 f72a12da539e
child 1 5315654608de
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Xuikon Menu Plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _XNMENU_H
       
    21 #define _XNMENU_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "xncomponent.h"
       
    25 #include "mxncomponentinterface.h"
       
    26 
       
    27 #if 0 // MSK icon change
       
    28 class TAknsItemID;
       
    29 #endif // MSK icon change
       
    30 
       
    31 namespace XnMenuInterface
       
    32 {
       
    33 _LIT8(KType, "menu");
       
    34 
       
    35 class MXnMenuObserver
       
    36     {
       
    37 public:
       
    38     /**
       
    39      * Called when options menu is about to open. Observer can add 
       
    40      * its own menu item to the aMenuItems array.
       
    41      * @param aMenuItem menu item
       
    42      * @param aPlugin plugin node
       
    43      * @return ETrue if the item should be shown, EFalse otherwise
       
    44      */        
       
    45     virtual TBool DynInitMenuItemL( CXnNodeAppIf& aMenuItem, CXnNodeAppIf* aPlugin = NULL ) = 0;
       
    46     };
       
    47 
       
    48 /**
       
    49 *  @ingroup group_xnmenufactory
       
    50 *  @lib xn3menufactory.dll
       
    51 *  @since S60 3.1
       
    52 */
       
    53 class MXnMenuInterface : public XnComponentInterface::MXnComponentInterface
       
    54     {
       
    55 public:
       
    56     /**
       
    57     * Soft key position enum
       
    58     * These are same as in CEikButtonGroupContainer::TCommandPosition
       
    59     */
       
    60     enum TSoftKeyPosition
       
    61         {
       
    62         ELeft = 0,
       
    63         ERight = 2,    
       
    64         ECenter = 3  /* Not supported when setting icon */
       
    65         };        
       
    66 
       
    67 public:
       
    68 		
       
    69     static inline const TDesC8& Type()
       
    70         {
       
    71         return KType;
       
    72         }
       
    73 		
       
    74 public: // New functions
       
    75 
       
    76     /**
       
    77     * Sets softkey image. If there was no leave, menu takes  
       
    78     * bitmap and mask ownership.
       
    79     * @since Series 60 3.2
       
    80     * @param aBitmap Bitmap to draw
       
    81     * @param aMask Mask to use
       
    82     * @param aPos Softkey position
       
    83     * @param aPreserveAspectRatio ETrue if image's aspect ratio is preserved
       
    84     * @param aInvertMask ETrue if white mask is used, EFalse if black mask is used
       
    85     * @param aTransferOwnership ETrue if bitmap and mask ownerhsip is transferred to menuadapter
       
    86     */        
       
    87     virtual void SetSoftKeyImageL( 
       
    88         CFbsBitmap* aBitmap, 
       
    89         CFbsBitmap* aMask, 
       
    90         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
       
    91         TBool aPreserveAspectRatio = EFalse, TBool aInvertMask = EFalse,
       
    92         TBool aTransferOwnership = ETrue ) = 0;   
       
    93 
       
    94     virtual void SetSoftKeyImageL( 
       
    95         CFbsBitmap* aBitmap, 
       
    96         CFbsBitmap* aMask, 
       
    97         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
       
    98         CXnNodeAppIf* aNode,
       
    99         TBool aPreserveAspectRatio = EFalse, TBool aInvertMask = EFalse,
       
   100         TBool aTransferOwnership = ETrue ) = 0;   
       
   101 
       
   102 #if 0 // MSK icon change
       
   103     /**
       
   104     * Sets soft key image.
       
   105     * @param aId icon bitmap IID 
       
   106     * @param aBmpFile file path.
       
   107     * @param aBmp Bitmap ID.
       
   108     * @param aBmpM Bitmap mask ID.
       
   109     * @param aPos Softkey position.
       
   110     * @param aEnable ETrue for set icon, EFalse for use default icon.
       
   111     */
       
   112     virtual void SetSoftKeyImageL( const TAknsItemID& aId,
       
   113                                    const TDesC& aBmpFile,
       
   114                                    const TInt32 aBmp,
       
   115                                    const TInt32 aBmpM,
       
   116                                    XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos, 
       
   117                                    TBool aEnable ) = 0;
       
   118 
       
   119 #endif // MSK icon change
       
   120 
       
   121     /**
       
   122     * Sets softkey text. 
       
   123     * @since Series 60 3.2
       
   124     * @param aText Text to draw    
       
   125     * @param aPos Softkey position
       
   126     */                
       
   127     virtual void SetSoftKeyTextL( const TDesC& aText,
       
   128         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) = 0;           
       
   129 
       
   130     /**
       
   131     * Sets softkey. 
       
   132     * @param aNode Softey node. 
       
   133     * @param aPos Softkey position.
       
   134     */       
       
   135     virtual void SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode,
       
   136         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) = 0;
       
   137 
       
   138     /**
       
   139     * Returns currently visible softkey node. 
       
   140     * @param aPos Softkey position.
       
   141     * @return Currently visible softkey. 
       
   142     */       
       
   143     virtual CXnNodePluginIf* SoftKeyL( XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) = 0;
       
   144 
       
   145    /**
       
   146     * Sets MXnMenuObserver observer
       
   147     * @since S60 5.1
       
   148     * @param aObserver observer to set
       
   149     */                
       
   150     virtual void SetObserver( XnMenuInterface::MXnMenuObserver& aObserver ) = 0;
       
   151 
       
   152    /**
       
   153     * Removes the observer
       
   154     * @since S60 5.1    
       
   155     */                   
       
   156     virtual void RemoveObserver() = 0;        
       
   157 
       
   158    /**
       
   159     * Tries to display menubar
       
   160     * @since S60 5.1    
       
   161     * @param aMenuNodeId the menu node id
       
   162     */                      
       
   163     virtual void TryDisplayingMenuBarL( const TDesC& aMenuNodeId ) = 0;
       
   164     };
       
   165 }   
       
   166     
       
   167 class CXnMenu : public CXnComponent, public XnMenuInterface::MXnMenuInterface
       
   168     {
       
   169     public:  // Constructors and destructor
       
   170         
       
   171         /**
       
   172         * Two-phased constructor.
       
   173         */
       
   174         static CXnMenu* NewL();
       
   175         
       
   176         /**
       
   177         * Destructor.
       
   178         */
       
   179         virtual ~CXnMenu();
       
   180     
       
   181     protected: // New functions
       
   182 
       
   183        /**
       
   184         * @see MXnMenuInterface::SetSoftKeyImage
       
   185         */
       
   186        void SetSoftKeyImageL(
       
   187         CFbsBitmap* aBitmap,
       
   188         CFbsBitmap* aMask,
       
   189         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
       
   190         TBool aPreserveAspectRatio, TBool aInvertMask,
       
   191         TBool aTransferOwnership = ETrue );
       
   192        
       
   193        void SetSoftKeyImageL( 
       
   194         CFbsBitmap* aBitmap, 
       
   195         CFbsBitmap* aMask, 
       
   196         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
       
   197         CXnNodeAppIf* aNode,
       
   198         TBool aPreserveAspectRatio, TBool aInvertMask,
       
   199         TBool aTransferOwnership = ETrue );
       
   200 
       
   201 #if 0 // MSK icon change
       
   202        /**
       
   203         * @see MXnMenuInterface::SetSoftKeyImage
       
   204         */
       
   205        void SetSoftKeyImageL( const TAknsItemID& aId,
       
   206                               const TDesC& aBmpFile,
       
   207                               const TInt32 aBmp,
       
   208                               const TInt32 aBmpM,
       
   209                               XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos, 
       
   210                               TBool aEnable );
       
   211 #endif // MSK icon change
       
   212 
       
   213        /**
       
   214         * @see MXnMenuInterface::SetSoftkeyTextL
       
   215         */        
       
   216        void SetSoftKeyTextL( const TDesC& aText,
       
   217         XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );           
       
   218 
       
   219        /**
       
   220         * @see MXnMenuInterface::SetSoftKeyL
       
   221         */        
       
   222         void SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode,
       
   223             XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
       
   224 
       
   225        /**
       
   226         * @see MXnMenuInterface::SoftKeyL
       
   227         */        
       
   228         CXnNodePluginIf* SoftKeyL( XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
       
   229 
       
   230        /**
       
   231         * @see MXnMenuInterface::SetObserver
       
   232         */                
       
   233        void SetObserver( XnMenuInterface::MXnMenuObserver& aObserver );
       
   234 
       
   235        /**
       
   236         * @see MXnMenuInterface::RemoveObserver
       
   237         */                
       
   238        void RemoveObserver();
       
   239 
       
   240        /**
       
   241         * @see MXnMenuInterface::TryDisplayingMenuBarL
       
   242         */                       
       
   243        void TryDisplayingMenuBarL( const TDesC& aMenuNodeId );
       
   244        
       
   245                               
       
   246       /**
       
   247        * @see MXnComponentInterface::MakeInterfaceL
       
   248        */
       
   249       XnComponentInterface::MXnComponentInterface* MakeInterfaceL( const TDesC8& aType );   
       
   250     private:
       
   251     
       
   252         /**
       
   253         * C++ default constructor.
       
   254         */
       
   255         CXnMenu();
       
   256 
       
   257         /**
       
   258         * By default Symbian 2nd phase constructor is private.
       
   259         */
       
   260         void ConstructL();
       
   261    };
       
   262 
       
   263 #endif      // _XNMENU_H 
       
   264             
       
   265 // End of File