photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxcommandhandler.h
changeset 0 4e91876724a2
child 25 191387a8b767
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2006-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:    Command Handler Base
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __C_GLXCOMMANDHANDLER_H__
       
    22 #define __C_GLXCOMMANDHANDLER_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <coedef.h>
       
    26 #include <w32std.h>
       
    27 #include <mpxattribute.h>
       
    28 
       
    29 class CEikMenuPane;
       
    30 
       
    31 
       
    32 /**
       
    33  * CGlxCommandHandler
       
    34  * 
       
    35  * Command handler base
       
    36  */
       
    37 class CGlxCommandHandler: public CBase
       
    38 	{
       
    39 public:
       
    40 
       
    41 	IMPORT_C CGlxCommandHandler( TBool aHasToolbarItem = EFalse );	
       
    42 	
       
    43 	/**
       
    44 	 * Execute the command, if applicable
       
    45 	 * @param aCommand The command to handle
       
    46 	 * @return ETrue iff command was handled
       
    47 	 */
       
    48 	virtual TBool ExecuteL(TInt aCommand) = 0;
       
    49 	
       
    50 	/**
       
    51 	 * Modify a menu before it is displayed.
       
    52 	 * @param aResourceId The resource ID of the menu
       
    53 	 * @param aMenuPane The in-memory representation of the menu pane
       
    54 	 */
       
    55 	virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) = 0;
       
    56 
       
    57 	/**
       
    58 	 * Called when the owning view is activated
       
    59 	 * @param aViewId The ID of the view
       
    60 	 */
       
    61 	IMPORT_C void ActivateL(TInt aViewId);	
       
    62 
       
    63 	/**
       
    64 	 * Called when the owning view is deactivated
       
    65 	 */
       
    66 	virtual void Deactivate() = 0;
       
    67 	
       
    68 	/**
       
    69 	 * Offers key events to the command handler
       
    70 	 * @param aKeyEvent The key event. 
       
    71 	 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown
       
    72 	 * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed
       
    73 	 */
       
    74 	virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) = 0;
       
    75 
       
    76 	/**
       
    77 	 * Perform any actions needed before the options menu is displayed.
       
    78 	 * The view calling this must first arrange a wait dialog to be displayed, as this operation may take
       
    79 	 * a long time to complete
       
    80      * @param aResourceId Menu resource id
       
    81 	 */
       
    82 	virtual void PreDynInitMenuPaneL( TInt aResourceId ) = 0;
       
    83 	
       
    84 	/**
       
    85 	 * Deriving classes should append required attributes to aAttributes
       
    86 	 * @param aAttributes array to append attributes to.
       
    87 	 * @param aFilterUsingSelection If ETrue, the deriving class should only append
       
    88 	 *        attributes relevant to the current selection, If EFalse all attributes
       
    89 	 *        should be appended.
       
    90 	 * @param aFilterUsingCommandId If ETrue, only attributes relevant
       
    91 	 *        to the command id specified by aCommandId will be appended
       
    92 	 * @param aCommandId if aFilterUsingCommandId is ETrue, only
       
    93 	 *        attributes relevant to aCommandId will be appened.
       
    94 	 */
       
    95     virtual void GetRequiredAttributesL(RArray< TMPXAttribute >& aAttributes, 
       
    96     		                            TBool aFilterUsingSelection,
       
    97     		                            TBool aFilterUsingCommandId,
       
    98     		                            TInt aCommandId = 0) const = 0;
       
    99     
       
   100     /**
       
   101 	 * Destructor
       
   102 	 */
       
   103 	IMPORT_C virtual ~CGlxCommandHandler();
       
   104 	
       
   105 protected:
       
   106 	IMPORT_C virtual void DoActivateL(TInt aViewId);
       
   107 	IMPORT_C virtual void PopulateToolbarL();
       
   108     
       
   109 private:
       
   110 	/** Whether the command should be enabled as a toolbar command*/
       
   111 	TBool iHasToolbarItem;    
       
   112 	};
       
   113 	
       
   114 
       
   115 #endif // __C_GLXCOMMANDHANDLER_H__