|
1 <template location="HEADER_FILE"> |
|
2 #ifndef ${instanceName.toUpperCase()}_H |
|
3 #define ${instanceName.toUpperCase()}_H |
|
4 |
|
5 </template> |
|
6 |
|
7 <template location="HEADER_INCLUDES"><![CDATA[ |
|
8 #include <aknviewappui.h> |
|
9 ]]> </template> |
|
10 |
|
11 <template location="FORWARD_DECLARATIONS"/> |
|
12 |
|
13 <defineLocation id="CLASS" baseLocation="HEADER_FILE" |
|
14 owned="false" |
|
15 location="class(${className})"> |
|
16 <template><![CDATA[ |
|
17 /** |
|
18 * @class ${className} ${instanceName}.h |
|
19 * @brief The AppUi class handles application-wide aspects of the user interface, including |
|
20 * view management and the default menu, control pane, and status pane. |
|
21 */ |
|
22 class ${className} : public CAknViewAppUi |
|
23 { |
|
24 public: |
|
25 // constructor and destructor |
|
26 ${className}(); |
|
27 virtual ~${className}(); |
|
28 void ConstructL(); |
|
29 |
|
30 public: |
|
31 // from CCoeAppUi |
|
32 TKeyResponse HandleKeyEventL( |
|
33 const TKeyEvent& aKeyEvent, |
|
34 TEventCode aType ); |
|
35 |
|
36 // from CEikAppUi |
|
37 void HandleCommandL( TInt aCommand ); |
|
38 void HandleResourceChangeL( TInt aType ); |
|
39 |
|
40 // from CAknAppUi |
|
41 void HandleViewDeactivation( |
|
42 const TVwsViewId& aViewIdToBeDeactivated, |
|
43 const TVwsViewId& aNewlyActivatedViewId ); |
|
44 |
|
45 private: |
|
46 void InitializeContainersL(); |
|
47 }; |
|
48 ]]> |
|
49 </template> |
|
50 </defineLocation> |
|
51 |
|
52 |
|
53 <template location="CLASS"/> |
|
54 |
|
55 <template location="CLASS_METHODS"/> |
|
56 |
|
57 <template location="CLASS_IVARS"/> |
|
58 |
|
59 <template location="HEADER_FILE"> |
|
60 #endif // ${instanceName.toUpperCase()}_H |
|
61 </template> |
|
62 |
|
63 <!-- most locations provided by base component --> |
|
64 |
|
65 <template location="MAIN_FILE"/> |
|
66 <template location="MAIN_SYSTEM_INCLUDES"/> |
|
67 <template location="MAIN_USER_INCLUDES"/> |
|
68 <template location="CONSTANTS"/> |
|
69 <template location="CONSTRUCTOR"/> |
|
70 <template location="CONSTRUCTOR_BODY"/> |
|
71 <template location="DESTRUCTOR"/> |
|
72 <template location="DESTRUCTOR_BODY"/> |
|
73 <template location="INIT_CONTAINERSL"/> |
|
74 <template location="HANDLECOMMANDL_METHOD"/> |
|
75 <template location="HANDLECOMMANDL_BODY"/> |
|
76 <template location="HANDLERESOURCECHANGEL_METHOD"/> |
|
77 <template location="HANDLERESOURCECHANGEL_BODY"/> |
|
78 <template location="CLASS_USERHANDLERS"/> |
|
79 |
|
80 <defineLocation id="KeyEventOverride_Method" baseLocation="MAIN_FILE" |
|
81 owned="false" |
|
82 location="function(${className}::HandleKeyEventL(const TKeyEvent&,TEventCode))"> |
|
83 <template><![CDATA[ |
|
84 /** |
|
85 * Override of the HandleKeyEventL virtual function |
|
86 * @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not |
|
87 * @param aKeyEvent |
|
88 * @param aType |
|
89 */ |
|
90 TKeyResponse ${className}::HandleKeyEventL( |
|
91 const TKeyEvent& aKeyEvent, |
|
92 TEventCode aType ) |
|
93 { |
|
94 // The inherited HandleKeyEventL is private and cannot be called |
|
95 } |
|
96 ]]> |
|
97 </template> |
|
98 </defineLocation> |
|
99 |
|
100 <template location="KeyEventOverride_Method"/> |
|
101 |
|
102 <defineLocation id="KeyEventOverride_Body" baseLocation="KeyEventOverride_Method" |
|
103 location="region(Generated Contents)"> |
|
104 </defineLocation> |
|
105 |
|
106 <template location="KeyEventOverride_Body"/> |
|
107 |
|
108 <template location="KeyEventOverride_Method"> |
|
109 return EKeyWasNotConsumed; |
|
110 </template> |
|
111 |
|
112 <defineLocation id="HANDLE_VIEW_DEACTIVATION" baseLocation="MAIN_FILE" |
|
113 owned="false" |
|
114 location="function(${className}::HandleViewDeactivation(const TVwsViewId&,const TVwsViewId&))"> |
|
115 <template><![CDATA[ |
|
116 /** |
|
117 * Override of the HandleViewDeactivation virtual function |
|
118 * |
|
119 * @param aViewIdToBeDeactivated |
|
120 * @param aNewlyActivatedViewId |
|
121 */ |
|
122 void ${className}::HandleViewDeactivation( |
|
123 const TVwsViewId& aViewIdToBeDeactivated, |
|
124 const TVwsViewId& aNewlyActivatedViewId ) |
|
125 { |
|
126 CAknViewAppUi::HandleViewDeactivation( |
|
127 aViewIdToBeDeactivated, |
|
128 aNewlyActivatedViewId ); |
|
129 } |
|
130 ]]> |
|
131 </template> |
|
132 </defineLocation> |
|
133 |
|
134 <template location="HANDLE_VIEW_DEACTIVATION"/> |
|
135 |
|
136 <defineLocation id="HANDLE_VIEW_DEACTIVATION_BODY" baseLocation="HANDLE_VIEW_DEACTIVATION" |
|
137 location="region(Generated Contents)"> |
|
138 </defineLocation> |
|
139 |
|
140 <template location="HANDLE_VIEW_DEACTIVATION_BODY"/> |
|
141 |
|
142 <!-- BEGIN EVENT handleKeyEvent override of CAknAppUi --> |
|
143 <templateGroup id="GenerateHandleKeyEventHandlerViewAppUi" ifEvents="handleKeyEvent"> |
|
144 |
|
145 <template id="HandlerDecl" phase="UserHandlers"><![CDATA[ |
|
146 TKeyResponse ${event.handlerName}( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
147 ]]> </template> |
|
148 |
|
149 <template id="DispatchToHandler" location="KeyEventOverride_Body"><![CDATA[ |
|
150 if ( ${event.handlerName}( aKeyEvent, aType ) == EKeyWasConsumed ) |
|
151 { |
|
152 return EKeyWasConsumed; |
|
153 } |
|
154 ]]> </template> |
|
155 |
|
156 <defineLocation id="KeyEventHandler" baseLocation="MAIN_FILE" |
|
157 owned="false" |
|
158 isEventHandler="true" |
|
159 location="function(${handlerClassName}::${event.handlerName}(const TKeyEvent&, TEventCode))"> |
|
160 <template><![CDATA[ |
|
161 /** |
|
162 * Handle the ${event.eventName} event. |
|
163 * @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not |
|
164 */ |
|
165 TKeyResponse ${handlerClassName}::${event.handlerName}( const TKeyEvent& /* aKeyEvent */, TEventCode /* aType */ ) |
|
166 { |
|
167 // TODO: implement ${event.eventName} event handler |
|
168 return EKeyWasNotConsumed; |
|
169 } |
|
170 ]]> |
|
171 </template> |
|
172 </defineLocation> |
|
173 |
|
174 <template id="RealizeHandler" location="KeyEventHandler"/> |
|
175 </templateGroup> |
|
176 <!-- END EVENT handleKeyEvent override of CAknAppUi--> |
|
177 |
|
178 <!-- our contributions --> |
|
179 |
|
180 <useTemplate ids="MakeConstructL GenerateHandleCommandBody"/> |
|
181 <useTemplateGroup ids="GenerateHandleCommandEventHandler"/> |
|
182 <useTemplateGroup ids="GenerateForegroundEventHandler GenerateSwitchOnEventHandler"/> |
|
183 <useTemplateGroup ids="GenerateSystemEventHandler GenerateApplicationSpecificEventHandler"/> |
|
184 <useTemplateGroup ids="GenerateHandleStatusPaneSizeChangeHandler GenerateViewEventHandler"/> |
|
185 <useTemplateGroup ids="GenerateInitMenuPaneHandler GenerateOfferKeyToAppHandler"/> |
|
186 <useTemplateGroup ids="GenerateHandleResourceChangeHandler"/> |
|
187 |
|
188 <inline scope="prototype"> |
|
189 include("../containers/containerLibrary.js") |
|
190 include("../cba/cbaLibrary.js") |
|
191 </inline> |
|
192 |
|
193 <inline scope="prototype"><![CDATA[ |
|
194 ${jsObject}.prototype.getViewContribs = function(contribs, instance) { |
|
195 // gather contributions from views |
|
196 for (i in instance.children) { |
|
197 var view = instance.children[i]; |
|
198 if (view.isInstanceOf("com.nokia.sdt.series60.AvkonViewReference")) { |
|
199 var form = "RootAppUi"; |
|
200 if (instance.properties.initialDesign == view.name) { |
|
201 form += "|RootAppUi_InitialView"; |
|
202 if ((findNaviTabs(instance) != null) && view.properties.inTabGroup) |
|
203 form += "|RootAppUi_SetActiveTab"; |
|
204 } |
|
205 var viewContribs = Engine.generateViewContributions(view.properties.filePath, form); |
|
206 if (viewContribs != null) |
|
207 contribs.addAll(viewContribs); |
|
208 } |
|
209 } |
|
210 } |
|
211 ]]> </inline> |
|
212 |
|
213 <inline><![CDATA[ |
|
214 |
|
215 // Emit the view uids. We expect the tab group to have emitted zero |
|
216 // or more of these already. |
|
217 for (i in instance.children) { |
|
218 var view = instance.children[i]; |
|
219 if (view.isInstanceOf("com.nokia.sdt.series60.AvkonViewReference")) { |
|
220 //println("got view ref: " + view.properties.filePath); |
|
221 var theEnum = findOrCreateViewUidConstant(view); |
|
222 } |
|
223 } |
|
224 |
|
225 this.getHrhFiles(contribs); |
|
226 |
|
227 this.getChildContribs(contribs, form); |
|
228 |
|
229 this.getViewContribs(contribs, instance); |
|
230 |
|
231 Engine.assignLocationsForPhase(contribs, "HandleKeyEventL", "KeyEventOverride_Body"); |
|
232 Engine.assignLocationsForPhase(contribs, "HandleViewDeactivation", "HANDLE_VIEW_DEACTIVATION_BODY"); |
|
233 this.finalizeContribs(contribs); |
|
234 ]]> </inline> |
|
235 |
|
236 <useTemplate ids="IncludeRsgFile" /> |
|
237 |
|
238 <!-- contributions as child (to CAknDocument) --> |
|
239 |
|
240 <template phase="MainUserIncludes"> |
|
241 #include "${instanceName}.h" |
|
242 </template> |
|
243 |
|
244 <template phase="CreateAppUiL"> |
|
245 return new ( ELeave ) ${className}; |
|
246 </template> |