|
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: Command manager class definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_VTUICOMMANDMANAGER_H |
|
20 #define C_VTUICOMMANDMANAGER_H |
|
21 |
|
22 #include "mvtuicommandmanager.h" |
|
23 #include "mvtuicommandui.h" |
|
24 #include "tvtuilocalvariation.h" |
|
25 #include "CVtUiAppUi.h" |
|
26 |
|
27 class TVtUiStates; |
|
28 class CVtUiCommandPolicyManager; |
|
29 class CVtUiPrimaryCmdPolicy; |
|
30 class CVtUiCmdStateCheckAction; |
|
31 class CVtUiExecutionContext; |
|
32 |
|
33 /** |
|
34 * CVtUiCommandManager |
|
35 * |
|
36 * Acts as a proxy for Command UIs and Validators. |
|
37 * |
|
38 * @since S60 v3.2 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CVtUiCommandManager ) : public CBase, |
|
41 public MVtUiCommandManager, public MVtUiCommandUi |
|
42 { |
|
43 |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Static constructor. |
|
48 * |
|
49 * @param aUiStates Constant reference to UI states object. |
|
50 */ |
|
51 static CVtUiCommandManager* NewL( const TVtUiStates& aUiStates, |
|
52 CVtUiAppUi& aAppUi ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CVtUiCommandManager(); |
|
58 |
|
59 public: |
|
60 |
|
61 /** |
|
62 * Constant reference to UI states. |
|
63 * |
|
64 * @return Constant reference to UI states object. |
|
65 */ |
|
66 const TVtUiStates& UiStates() const; |
|
67 |
|
68 /** |
|
69 * Constant reference to VT local variation. |
|
70 * |
|
71 * @return Constant reference to VT local variation object. |
|
72 */ |
|
73 const TVtUiVideoTelephonyVariation& VideoTelephonyVariation() const; |
|
74 |
|
75 /** |
|
76 * Handles command. |
|
77 * |
|
78 * @param aCommandId Id of command to be handled. If given command is not |
|
79 * found, command will be silently ignored. |
|
80 */ |
|
81 void HandleCommandL( TInt aCommandId ); |
|
82 |
|
83 /** |
|
84 * Constant reference to CVtUiAppUi states. |
|
85 * |
|
86 * @return Constant reference to UI states object. |
|
87 */ |
|
88 const CVtUiAppUi& AppUi() const; |
|
89 |
|
90 |
|
91 public: // from MVtUiCommandManager |
|
92 |
|
93 /** |
|
94 * @see MVtUiCommandManager::AddCommandUi |
|
95 */ |
|
96 TInt AddCommandUi( MVtUiCommandUi& aCommandUi ); |
|
97 |
|
98 /** |
|
99 * @see MVtUiCommandManager::RemoveCommandUi |
|
100 */ |
|
101 void RemoveCommandUi( MVtUiCommandUi& aCommandUi ); |
|
102 |
|
103 /** |
|
104 * @see MVtUiCommandManager::ValidateMenuItemsL |
|
105 */ |
|
106 void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction ); |
|
107 |
|
108 /** |
|
109 * @see MVtUiCommandManager::ValidateSoftkeyItemsL |
|
110 */ |
|
111 void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction ); |
|
112 |
|
113 /** |
|
114 * @see MVtUiCommandManager::ValidateToolbarItemsL |
|
115 */ |
|
116 void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction ); |
|
117 |
|
118 /** |
|
119 * @see MVtUiCommandManager::IsCommandAllowedL |
|
120 */ |
|
121 TBool IsCommandAllowedL( TInt aCommandId ); |
|
122 |
|
123 /** |
|
124 * @see MVtUiCommandManager::RegisterCommandContext |
|
125 */ |
|
126 TInt RegisterCommandContext( CVtUiCmdContext& aContext ); |
|
127 |
|
128 /** |
|
129 * @see MVtUiCommandManager::UnregisterCommandContext |
|
130 */ |
|
131 void UnregisterCommandContext( CVtUiCmdContext& aContext ); |
|
132 |
|
133 /** |
|
134 * @see MVtUiCommandManager::AddValidator |
|
135 */ |
|
136 TInt AddValidator( CVtUiCmdValidatorBase& aValidator ); |
|
137 |
|
138 /** |
|
139 * @see MVtUiCommandManager::RemoveValidator |
|
140 */ |
|
141 void RemoveValidator( CVtUiCmdValidatorBase& aValidator ); |
|
142 |
|
143 /** |
|
144 * @see MVtUiCommandManager::RefreshL |
|
145 */ |
|
146 void RefreshL(); |
|
147 |
|
148 /** |
|
149 * @see MVtUiCommandManager::AddCommandModifier |
|
150 */ |
|
151 TInt AddCommandModifier( CVtUiCommandModifyBase& aModifier ); |
|
152 |
|
153 /** |
|
154 * @see MVtUiCommandManager::RemoveCommandModifier |
|
155 */ |
|
156 void RemoveCommandModifier( CVtUiCommandModifyBase& aModifier ); |
|
157 |
|
158 /** |
|
159 * @see MVtUiCommandManager::RegisterCommandL |
|
160 */ |
|
161 void RegisterCommandL( CVtUiCmdBase& aCommand ); |
|
162 |
|
163 /** |
|
164 * @see MVtUiCommandManager::UnregisterCommand |
|
165 */ |
|
166 void UnregisterCommand( const CVtUiCmdBase& aCommand ); |
|
167 |
|
168 private: |
|
169 |
|
170 /** |
|
171 * Constructor. |
|
172 */ |
|
173 CVtUiCommandManager( const TVtUiStates& aUiStates, CVtUiAppUi& aAppUi ); |
|
174 |
|
175 /** |
|
176 * Symbian OS constructor. |
|
177 * @param aModel Engine model. |
|
178 */ |
|
179 void ConstructL(); |
|
180 |
|
181 /** |
|
182 * Called when a new command modifier is added |
|
183 */ |
|
184 TInt CommandModifierAdded( CVtUiCommandModifyBase& aModifier ); |
|
185 |
|
186 /** |
|
187 * Called when a command modifier is removed |
|
188 */ |
|
189 void CommandModifierRemoved( CVtUiCommandModifyBase& aModifier ); |
|
190 |
|
191 /** |
|
192 * Called when a new command ui is added |
|
193 */ |
|
194 TInt CommandUiAdded( MVtUiCommandUi& aCommandUi ); |
|
195 |
|
196 /** |
|
197 * Called when a command ui is removed |
|
198 */ |
|
199 void CommandUiRemoved( MVtUiCommandUi& aCommandUi ); |
|
200 |
|
201 private: |
|
202 |
|
203 // Commands Uis |
|
204 RPointerArray< MVtUiCommandUi > iCommandUis; |
|
205 |
|
206 // Command modifiers |
|
207 RPointerArray< CVtUiCommandModifyBase > iCommandModifiers; |
|
208 |
|
209 // Registered commands |
|
210 RPointerArray< CVtUiCmdBase > iCommands; |
|
211 |
|
212 // Command policy manager instance |
|
213 CVtUiCommandPolicyManager* iCmdPolicyMgr; |
|
214 |
|
215 // Reference to UI states instance |
|
216 const TVtUiStates& iUiStates; |
|
217 |
|
218 // Reference to VT local variation |
|
219 TVtUiVideoTelephonyVariation iVtVariation; |
|
220 |
|
221 // Command state validation action |
|
222 CVtUiCmdStateCheckAction* iCmdStateCheckAction; |
|
223 |
|
224 // Execution context (for command state validation) |
|
225 CVtUiExecutionContext* iExecutionContext; |
|
226 |
|
227 // Reference to appui |
|
228 const CVtUiAppUi& iAppUi; |
|
229 }; |
|
230 |
|
231 #endif // C_VTUICOMMANDMANAGER_H |