|
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 * @param aIsBrowseMode ETrue if in grid view |
|
55 */ |
|
56 virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane, |
|
57 TBool aIsBrowseMode) = 0; |
|
58 |
|
59 /** |
|
60 * Called when the owning view is activated |
|
61 * @param aViewId The ID of the view |
|
62 */ |
|
63 IMPORT_C void ActivateL(TInt aViewId); |
|
64 |
|
65 /** |
|
66 * Called when the owning view is deactivated |
|
67 */ |
|
68 virtual void Deactivate() = 0; |
|
69 |
|
70 /** |
|
71 * Offers key events to the command handler |
|
72 * @param aKeyEvent The key event. |
|
73 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown |
|
74 * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed |
|
75 */ |
|
76 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) = 0; |
|
77 |
|
78 /** |
|
79 * Perform any actions needed before the options menu is displayed. |
|
80 * The view calling this must first arrange a wait dialog to be displayed, as this operation may take |
|
81 * a long time to complete |
|
82 * @param aResourceId Menu resource id |
|
83 */ |
|
84 virtual void PreDynInitMenuPaneL( TInt aResourceId ) = 0; |
|
85 |
|
86 /** |
|
87 * Deriving classes should append required attributes to aAttributes |
|
88 * @param aAttributes array to append attributes to. |
|
89 * @param aFilterUsingSelection If ETrue, the deriving class should only append |
|
90 * attributes relevant to the current selection, If EFalse all attributes |
|
91 * should be appended. |
|
92 * @param aFilterUsingCommandId If ETrue, only attributes relevant |
|
93 * to the command id specified by aCommandId will be appended |
|
94 * @param aCommandId if aFilterUsingCommandId is ETrue, only |
|
95 * attributes relevant to aCommandId will be appened. |
|
96 */ |
|
97 virtual void GetRequiredAttributesL(RArray< TMPXAttribute >& aAttributes, |
|
98 TBool aFilterUsingSelection, |
|
99 TBool aFilterUsingCommandId, |
|
100 TInt aCommandId = 0) const = 0; |
|
101 |
|
102 /** |
|
103 * Destructor |
|
104 */ |
|
105 IMPORT_C virtual ~CGlxCommandHandler(); |
|
106 |
|
107 protected: |
|
108 IMPORT_C virtual void DoActivateL(TInt aViewId); |
|
109 IMPORT_C virtual void PopulateToolbarL(); |
|
110 |
|
111 private: |
|
112 /** Whether the command should be enabled as a toolbar command*/ |
|
113 TBool iHasToolbarItem; |
|
114 }; |
|
115 |
|
116 |
|
117 #endif // __C_GLXCOMMANDHANDLER_H__ |