menucontentsrv/inc/menuhandlereng.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Definition of menu handler engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MENUHANDLERENG_H__
       
    20 #define __MENUHANDLERENG_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class RMenu;
       
    25 class CMenuHandler;
       
    26 class CMenuOperation;
       
    27 class CMenuItem;
       
    28 
       
    29 /**
       
    30  *  Menu handler engine.
       
    31  *  Handler related menu functionality and objects (factory, handler list, ...)
       
    32  *  are collected in this class, to keep RMenu implementation and API clean.
       
    33  *  @lib mcsmenu.lib
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CMenuHandlerEng ): public CBase
       
    37     {
       
    38 
       
    39 public:
       
    40 
       
    41     /**
       
    42     * Destructor.
       
    43     */
       
    44     virtual ~CMenuHandlerEng();
       
    45 
       
    46     /**
       
    47     * Two-phased constructor.
       
    48     * @param aMenu Menu.
       
    49     * @return The created object.
       
    50     */
       
    51     static CMenuHandlerEng* NewL( RMenu& aMenu );
       
    52 
       
    53     /**
       
    54     * Handle command.
       
    55     * @param aItem Item.
       
    56     * @param aCommand Command.
       
    57     * @param aParams. Command parameters.
       
    58     * @param aStatus Observer request status. When the operation completes,
       
    59     * this status will be completed with the resulting error code.
       
    60     * @return Asynchronous operation. Owned by the caller.
       
    61     */
       
    62     CMenuOperation* HandleCommandL(
       
    63         CMenuItem& aItem,
       
    64         const TDesC8& aCommand,
       
    65         const TDesC8& aParams,
       
    66         TRequestStatus& aStatus );
       
    67 
       
    68 protected:
       
    69 
       
    70     /**
       
    71     * Constructor.
       
    72     * @param aMenu Menu.
       
    73     */
       
    74     CMenuHandlerEng( RMenu& aMenu );
       
    75 
       
    76 private:
       
    77 
       
    78     /**
       
    79     * Find loaded handler by type.
       
    80     * @param aType Type.
       
    81     * @return Loaded handler or NULL no handler is loaded for that type.
       
    82     */
       
    83     CMenuHandler* FindHandler( const TDesC& aType );
       
    84 
       
    85     /**
       
    86     * Load handler for given type.
       
    87     * @param aType Type.
       
    88     * @return Loaded handler or NULL no handler is found for that type.
       
    89     */
       
    90     CMenuHandler* LoadHandlerL( const TDesC& aType );
       
    91 
       
    92 private:    // data
       
    93 
       
    94     RMenu& iMenu; ///<Menu.
       
    95     RPointerArray<CMenuHandler> iHandlers; ///< Own.
       
    96 
       
    97     };
       
    98 
       
    99 #endif // __MENUHANDLERENG_H__