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