uidesigner/com.nokia.sdt.series60.componentlibrary/components/containers/CCoeControl.component
changeset 0 fb279309251b
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- Copyright (c) 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 the License "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 <componentDefinition xmlns="http://www.nokia.com/sdt/emf/component" 
       
    10 xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" 
       
    11 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
       
    12 	<component baseComponent="com.nokia.sdt.series60.ContainerBase" 
       
    13 			friendlyName="%friendlyName" 
       
    14 			qualifiedName="com.nokia.sdt.series60.CCoeControl" 
       
    15 			category="Basic"
       
    16 			instanceNameRoot="container"
       
    17 			version="1.2">
       
    18 		<documentation>
       
    19 			<information>%information</information>
       
    20 			<wizardDescription>%information</wizardDescription>
       
    21 		</documentation>
       
    22 		<symbian sdkName="com.nokia.series60" minSDKVersion="2.0" 
       
    23 			className="CCoeControl" classHelpTopic="" />
       
    24 		<designerImages 
       
    25 			smallIconFile="CCoeControl_sm.png" 
       
    26 			largeIconFile="CCoeControl.png"/>
       
    27 		<attributes>
       
    28 			<attribute key="is-top-level-content-container">true</attribute>
       
    29 			<attribute key="container-background-color-property-name">backColor</attribute>
       
    30 			<attribute key="event-handler-target">true</attribute>
       
    31 			<attribute key="base-container-class">CCoeControl</attribute>
       
    32 			<attribute key="associated-palette-drawer">Controls</attribute>
       
    33 		</attributes>
       
    34 		<properties>
       
    35 			<property category="Appearance" name="backColor" displayName="%backColor" type="string" 
       
    36 				editorClass="com.nokia.sdt.symbian.ui.editors.RGBEditorFactoryWithSystemColorCombo"
       
    37 				descriptionKey="backColorDescription" />
       
    38 			<componentReferenceProperty category="Behavior" scope="children" 
       
    39 				constraint="com.nokia.sdt.series60.CCoeControlBase" name="initialFocus"
       
    40 				descriptionKey="initialFocusDescription" />
       
    41 		</properties>
       
    42 
       
    43 		<extensionProperties name="default">
       
    44 			<componentReferenceProperty category="Behavior" 
       
    45 				constraint="com.nokia.sdt.series60.MenuBar" name="contextMenu"
       
    46 				descriptionKey="contextMenuDescription" />
       
    47 			<property category="Behavior" name="exitsApp" type="boolean" 
       
    48 				default="true"
       
    49 				descriptionKey="exitsAppDescription" />
       
    50 		</extensionProperties>
       
    51 		
       
    52 		<implementations>
       
    53 			<implementation>
       
    54 				<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
       
    55 				<script file="CCoeControl.js" prototype="CCoeControlVisual"/>
       
    56 			</implementation>
       
    57 			<implementation>
       
    58 				<interface id="com.nokia.sdt.datamodel.adapter.ILayout"/>
       
    59 				<script file="CCoeControl.js" prototype="CCoeControlLayout"/>
       
    60 			</implementation>
       
    61 			<implementation>
       
    62 				<interface id="com.nokia.sdt.datamodel.adapter.IPropertyExtenders"/>
       
    63 				<script file="CCoeControl.js" prototype="CCoeControlPropertyExtenders"/>
       
    64 			</implementation>
       
    65 			<implementation>
       
    66 				<interface id="com.nokia.sdt.datamodel.adapter.IQueryContainment"/>
       
    67 				<script file="CCoeControl.js" prototype="CCoeControlQueryContainment"/>
       
    68 			</implementation>
       
    69 			<implementation>
       
    70 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentInstancePropertyListener"/>
       
    71 				<script file="CCoeControl.js" prototype="CCoeControlPropertyListener"/>
       
    72 			</implementation>
       
    73 			<implementation>
       
    74 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentInstanceChildListener"/>
       
    75 				<script file="CCoeControl.js" prototype="CCoeControlChildListener"/>
       
    76 			</implementation>
       
    77 			<implementation>
       
    78 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentEventInfo"/>
       
    79 				<script file="CCoeControl.js" prototype="CCoeControlEventInfo"/>
       
    80 			</implementation>
       
    81 			
       
    82 		</implementations>
       
    83 		
       
    84 		<sourceGen forms="AppUi AknView RootAppUi">
       
    85 
       
    86 			<inline scope="prototype">
       
    87 include("containerLibrary.js");
       
    88 			</inline>
       
    89 
       
    90 		<templateGroup id="HeaderFile">
       
    91 
       
    92 			<!-- contributions as container -->		
       
    93 
       
    94 			<defineLocation id="HEADER_FILE" domain="cpp" dir="${inc}" 
       
    95 				file="${instanceName}.h"
       
    96 				owned="false"
       
    97 				location="">
       
    98 			</defineLocation>
       
    99 			
       
   100 			<template id="InclGuard0" location="HEADER_FILE">
       
   101 #ifndef ${instanceName.toUpperCase()}_H
       
   102 #define ${instanceName.toUpperCase()}_H
       
   103 
       
   104 			</template>
       
   105 			
       
   106 			<defineLocation id="HEADER_INCLUDES" baseLocation="HEADER_FILE"
       
   107 				location="region(Generated Includes)"
       
   108 				filter="unique-includes">
       
   109 				<template><![CDATA[
       
   110 #include <coecntrl.h>		
       
   111 ]]>				</template>
       
   112 			</defineLocation>
       
   113 			
       
   114 			<template id="RealizeHeaderIncludes" location="HEADER_INCLUDES"/>
       
   115 
       
   116 			<defineLocation id="EVENT_INCLUDES" baseLocation="HEADER_FILE"
       
   117 				owned="false"
       
   118 				filter="unique-includes"
       
   119 				location="region(Event Handler Includes)" />
       
   120 
       
   121 			<template id="RealizeEventIncludes" location="EVENT_INCLUDES" />
       
   122 
       
   123 			
       
   124 			<defineLocation id="HEADER_FORWARD_DECLARATIONS" baseLocation="HEADER_FILE"
       
   125 				location="region(Generated Forward Declarations)">
       
   126 				<template><![CDATA[
       
   127 class MEikCommandObserver;		
       
   128 ]]>				</template>
       
   129 			</defineLocation>	
       
   130 				
       
   131 			<template id="RealizeHeaderFwdDecls" location="HEADER_FORWARD_DECLARATIONS"/>
       
   132 			
       
   133 			<defineLocation id="CLASS" baseLocation="HEADER_FILE"
       
   134 				owned="false"
       
   135 				location="class(${className})">
       
   136 				<template><![CDATA[
       
   137 /**
       
   138  * Container class for ${instanceName}
       
   139  * 
       
   140  * @class	${className} ${instanceName}.h
       
   141  */
       
   142 class ${className} : public CCoeControl
       
   143 	{
       
   144 public:
       
   145 	// constructors and destructor
       
   146 	${className}();
       
   147 	static ${className}* NewL( 
       
   148 		const TRect& aRect, 
       
   149 		const CCoeControl* aParent, 
       
   150 		MEikCommandObserver* aCommandObserver );
       
   151 	static ${className}* NewLC( 
       
   152 		const TRect& aRect, 
       
   153 		const CCoeControl* aParent, 
       
   154 		MEikCommandObserver* aCommandObserver );
       
   155 	void ConstructL( 
       
   156 		const TRect& aRect, 
       
   157 		const CCoeControl* aParent, 
       
   158 		MEikCommandObserver* aCommandObserver );
       
   159 	virtual ~${className}();
       
   160 
       
   161 public:
       
   162 	// from base class CCoeControl
       
   163 	TInt CountComponentControls() const;
       
   164 	CCoeControl* ComponentControl( TInt aIndex ) const;
       
   165 	TKeyResponse OfferKeyEventL( 
       
   166 			const TKeyEvent& aKeyEvent, 
       
   167 			TEventCode aType );
       
   168 	void HandleResourceChange( TInt aType );
       
   169 	
       
   170 protected:
       
   171 	// from base class CCoeControl
       
   172 	void SizeChanged();
       
   173 
       
   174 private:
       
   175 	// from base class CCoeControl
       
   176 	void Draw( const TRect& aRect ) const;
       
   177 
       
   178 private:
       
   179 	void InitializeControlsL();
       
   180 	void LayoutControls();
       
   181 	CCoeControl* iFocusControl;
       
   182 	MEikCommandObserver* iCommandObserver;
       
   183 	};
       
   184 ]]>				
       
   185 				</template>
       
   186 			</defineLocation>
       
   187 
       
   188 			<template id="RealizeClass" location="CLASS"/>
       
   189 			
       
   190 			<defineLocation id="CLASS_METHODS" baseLocation="CLASS"
       
   191 				filter="unique-prototypes"
       
   192 				location="region(Generated Methods)">
       
   193 				<template><![CDATA[
       
   194 public: <% contrib.indentAdjust(-1); %>
       
   195 ]]>				</template>
       
   196 			</defineLocation>
       
   197 			
       
   198 			<template id="RealizeClassMethods" location="CLASS_METHODS"/>
       
   199 
       
   200 		<defineLocation id="CLASS_TYPES" baseLocation="CLASS"
       
   201 			location="region(Generated Type Declarations)">
       
   202 				<template><![CDATA[
       
   203 public: <% contrib.indentAdjust(-1); %>
       
   204 ]]>				</template>
       
   205 			</defineLocation>
       
   206 
       
   207 			<template id="RealizeClassTypes" location="CLASS_TYPES"/>
       
   208 
       
   209 			<defineLocation id="CLASS_IVARS" baseLocation="CLASS"
       
   210 			location="region(Generated Instance Variables)">
       
   211 				<template><![CDATA[
       
   212 private: <% contrib.indentAdjust(-1); %>
       
   213 ]]>				</template>
       
   214 			</defineLocation>
       
   215 
       
   216 			<template id="RealizeClassIvars" location="CLASS_IVARS"/>
       
   217 
       
   218 			<defineLocation id="BASE_CLASS_LIST" baseLocation="CLASS"
       
   219 				owned="false"
       
   220 				filter="unique-bases"
       
   221 				location="bases()">
       
   222 			</defineLocation>
       
   223 			
       
   224 			<template id="RealizeBaseClassList" location="BASE_CLASS_LIST" />
       
   225 			
       
   226 			<defineLocation id="CLASS_OVERRIDES" baseLocation="CLASS"
       
   227 				owned="false"
       
   228 				filter="unique-prototypes"
       
   229 				location="region(Overridden Methods)">
       
   230 				<template><![CDATA[
       
   231 protected: <% contrib.indentAdjust(-1); %>
       
   232 ]]>				</template>
       
   233 				
       
   234 			</defineLocation>			
       
   235 				
       
   236 			<template id="RealizeClassOverrides" location="CLASS_OVERRIDES"/>
       
   237 			
       
   238 			<defineLocation id="CLASS_USERHANDLERS" baseLocation="CLASS"
       
   239 				owned="false"
       
   240 				filter="unique-prototypes"
       
   241 				location="region(User Handlers)">
       
   242 				<template><![CDATA[
       
   243 protected: <% contrib.indentAdjust(-1); %>
       
   244 ]]>				</template>
       
   245 				
       
   246 			</defineLocation>				
       
   247 			
       
   248 			<template id="RealizeClassUserHandlers" location="CLASS_USERHANDLERS"/>
       
   249 
       
   250 
       
   251 			<template id="IncludeGuardEnd" location="HEADER_FILE">
       
   252 #endif // ${instanceName.toUpperCase()}_H
       
   253 			</template>
       
   254 
       
   255 			<defineLocation id="CHILD_ENUMS" baseLocation="CLASS"
       
   256 				owned="false"
       
   257 				location="enum(TControls)">
       
   258 				<template><![CDATA[
       
   259 public: <% contrib.indentAdjust(-1); %>
       
   260 enum TControls
       
   261 	{
       
   262 	};
       
   263 ]]>				</template>
       
   264 			</defineLocation>
       
   265 
       
   266 			<defineLocation id="CHILD_ENUMS_CONTENTS" baseLocation="CHILD_ENUMS"
       
   267 				location="region(Generated Contents)">
       
   268 			</defineLocation>
       
   269 
       
   270 			<template id="GetChildEnums" location="CHILD_ENUMS_CONTENTS"><![CDATA[<%
       
   271 	// each control must contribute enumerators
       
   272 	if (Engine.formMatches(form, ["AppUi", "AknView"])) {
       
   273 		var enumContribs = Engine.generateChildContributions("HandleCCoeControlEnums");
       
   274 		Engine.assignLocationsForPhase(enumContribs, "ChildEnumsContents", "CHILD_ENUMS_CONTENTS");
       
   275 		contribs.addAll(enumContribs);
       
   276 	}
       
   277 %>]]>
       
   278 			</template>
       
   279 
       
   280 			<template id="AddLastChildEnum" location="CHILD_ENUMS">
       
   281 // add any user-defined entries here...
       
   282 
       
   283 ELastControl
       
   284 			</template>
       
   285 
       
   286 		</templateGroup>
       
   287 
       
   288 		<templateGroup id="SourceFile">
       
   289 
       
   290 			<defineLocation id="MAIN_FILE" domain="cpp" dir="${src}" 
       
   291 				file="${instanceName}.cpp"
       
   292 				owned="false"
       
   293 				location="">
       
   294 			</defineLocation>
       
   295 
       
   296 			<template id="RealizeMainFile" location="MAIN_FILE"/>
       
   297 			
       
   298 			<defineLocation id="MAIN_SYSTEM_INCLUDES" baseLocation="MAIN_FILE"
       
   299 				location="region(Generated System Includes)"
       
   300 				filter="unique-includes">
       
   301 			</defineLocation>
       
   302 			
       
   303 			<template id="RealizeSystemIncludes" location="MAIN_SYSTEM_INCLUDES" />
       
   304 
       
   305 			<template id="ViewAppUiHeaderIncl" form="AknView" location="MAIN_SYSTEM_INCLUDES"><![CDATA[
       
   306 #include <aknviewappui.h>
       
   307 ]]>			</template>
       
   308 
       
   309 <!-- need to add in two steps to get uniqueness checking -->
       
   310 			<template id="ContextMenuEikmenubInclude" 
       
   311 				location="MAIN_SYSTEM_INCLUDES"><![CDATA[
       
   312 <% if (properties.contextMenu != "") { %>		
       
   313 #include <eikmenub.h>
       
   314 <% } %>]]></template>
       
   315 			<template id="ContextMenuEikcmobsInclude" 
       
   316 				location="MAIN_SYSTEM_INCLUDES"><![CDATA[
       
   317 <% if (properties.contextMenu != "") { %>		
       
   318 #include <eikcmobs.h>
       
   319 <% } %>]]></template>
       
   320 
       
   321 			<defineLocation id="MAIN_USER_INCLUDES" baseLocation="MAIN_FILE"
       
   322 				location="region(Generated User Includes)"
       
   323 				filter="unique-includes">
       
   324 				<template><![CDATA[
       
   325 #include "${instanceName}.h"
       
   326 ]]>				</template>
       
   327 			</defineLocation>		
       
   328 
       
   329 			<template id="RealizeMainUserIncludes" location="MAIN_USER_INCLUDES"/>
       
   330 
       
   331 			<template id="IncludeParentHeaderFile" location="MAIN_USER_INCLUDES"><![CDATA[
       
   332 #include "${instance.parent.name}.h"
       
   333 ]]></template>
       
   334 
       
   335 			<defineLocation id="CONSTANTS" baseLocation="MAIN_FILE"
       
   336 				location="region(Generated Constants)">
       
   337 			</defineLocation>
       
   338 
       
   339 			<template id="RealizeConstants" location="CONSTANTS" />
       
   340 
       
   341 			<defineLocation id="CONSTRUCTOR" baseLocation="MAIN_FILE"
       
   342 				location="function(${className}::${className}())"
       
   343 				owned="false">
       
   344 				<template>
       
   345 /**
       
   346  * First phase of Symbian two-phase construction. Should not 
       
   347  * contain any code that could leave.
       
   348  */
       
   349 ${className}::${className}()
       
   350 	{
       
   351 	}
       
   352 				</template>
       
   353 			</defineLocation>
       
   354 
       
   355 			<template id="RealizeConstructor" location="CONSTRUCTOR" />
       
   356 
       
   357 			<defineLocation id="CONSTRUCTOR_BODY" baseLocation="CONSTRUCTOR"
       
   358 				location="region(Generated Contents)">
       
   359 			</defineLocation>
       
   360 			
       
   361 			<template id="RealizeConstructorBody" location="CONSTRUCTOR_BODY"/>
       
   362 
       
   363 			
       
   364 			<defineLocation id="DESTRUCTOR" baseLocation="MAIN_FILE"
       
   365 				owned="false"
       
   366 				location="function(${className}::~${className}())">
       
   367 				<template><![CDATA[
       
   368 /** 
       
   369  * Destroy child controls.
       
   370  */
       
   371 ${className}::~${className}()
       
   372 	{
       
   373 	}
       
   374 ]]>				
       
   375 				</template>			
       
   376 			</defineLocation>
       
   377 			
       
   378 			<template id="RealizeDestructor" location="DESTRUCTOR"/>
       
   379 			
       
   380 			<defineLocation id="DESTRUCTOR_BODY" baseLocation="DESTRUCTOR"
       
   381 				location="region(Generated Contents)">
       
   382 			</defineLocation>
       
   383 		
       
   384 			<template id="RealizeDestructorBody" location="DESTRUCTOR_BODY"/>
       
   385 
       
   386 			<template id="GetNewlImpls" location="MAIN_FILE"><![CDATA[
       
   387 /**
       
   388  * Construct the control (first phase).
       
   389  *  Creates an instance and initializes it.
       
   390  *  Instance is not left on cleanup stack.
       
   391  * @param aRect bounding rectangle
       
   392  * @param aParent owning parent, or NULL
       
   393  * @param aCommandObserver command observer
       
   394  * @return initialized instance of ${className}
       
   395  */
       
   396 ${className}* ${className}::NewL( 
       
   397 		const TRect& aRect, 
       
   398 		const CCoeControl* aParent, 
       
   399 		MEikCommandObserver* aCommandObserver )
       
   400 	{
       
   401 	${className}* self = ${className}::NewLC( 
       
   402 			aRect, 
       
   403 			aParent, 
       
   404 			aCommandObserver );
       
   405 	CleanupStack::Pop( self );
       
   406 	return self;
       
   407 	}
       
   408 
       
   409 /**
       
   410  * Construct the control (first phase).
       
   411  *  Creates an instance and initializes it.
       
   412  *  Instance is left on cleanup stack.
       
   413  * @param aRect The rectangle for this window
       
   414  * @param aParent owning parent, or NULL
       
   415  * @param aCommandObserver command observer
       
   416  * @return new instance of ${className}
       
   417  */
       
   418 ${className}* ${className}::NewLC( 
       
   419 		const TRect& aRect, 
       
   420 		const CCoeControl* aParent, 
       
   421 		MEikCommandObserver* aCommandObserver )
       
   422 	{
       
   423 	${className}* self = new ( ELeave ) ${className}();
       
   424 	CleanupStack::PushL( self );
       
   425 	self->ConstructL( aRect, aParent, aCommandObserver );
       
   426 	return self;
       
   427 	}
       
   428 ]]>			
       
   429 			</template>
       
   430 
       
   431 			<!-- note: this method is declared one-time when the class is created, and the definition
       
   432 				is editable by the user.  The user has the freedom to modify the parameter list as well.
       
   433 				We add '...' here to the function arguments *in the location only* to allow sourcegen to
       
   434 				locate the method with added parameters, without regenerating it. -->
       
   435 			<defineLocation id="CONSTRUCTL" baseLocation="MAIN_FILE"
       
   436 				owned="false"
       
   437 				location="function(${className}::ConstructL(const TRect&amp;, const CCoeControl*, MEikCommandObserver*, ...))">
       
   438 				<template><![CDATA[
       
   439 /**
       
   440  * Construct the control (second phase).
       
   441  *  Creates a window to contain the controls and activates it.
       
   442  * @param aRect bounding rectangle
       
   443  * @param aCommandObserver command observer
       
   444  * @param aParent owning parent, or NULL
       
   445  */ 
       
   446 void ${className}::ConstructL( 
       
   447 		const TRect& aRect, 
       
   448 		const CCoeControl* aParent, 
       
   449 		MEikCommandObserver* aCommandObserver )
       
   450 	{
       
   451 	if ( aParent == NULL )
       
   452 	    {
       
   453 		CreateWindowL();
       
   454 	    }
       
   455 	else
       
   456 	    {
       
   457 	    SetContainerWindowL( *aParent );
       
   458 	    }
       
   459 	iFocusControl = NULL;
       
   460 	iCommandObserver = aCommandObserver;
       
   461 	InitializeControlsL();
       
   462 	SetRect( aRect );
       
   463 	ActivateL();
       
   464 	}
       
   465 ]]>			
       
   466 				</template>
       
   467 			</defineLocation>
       
   468 			
       
   469 			<template id="RealizeConstructL" location="CONSTRUCTL"/>
       
   470 						
       
   471 			<defineLocation id="CONSTRUCTL_BODY" baseLocation="CONSTRUCTL"
       
   472 				location="region(Post-ActivateL initializations)">
       
   473 			</defineLocation>
       
   474 			
       
   475 			<template id="RealizeConstructLBody" location="CONSTRUCTL_BODY" />
       
   476 			
       
   477 			<defineLocation id="COUNT_COMPONENT_CONTROLS" baseLocation="MAIN_FILE"
       
   478 				owned="false"
       
   479 				location="function(${className}::CountComponentControls())">
       
   480 				<template><![CDATA[
       
   481 /**
       
   482 * Return the number of controls in the container (override)
       
   483 * @return count
       
   484 */
       
   485 TInt ${className}::CountComponentControls() const
       
   486 	{
       
   487 	return ( int ) ELastControl;
       
   488 	}
       
   489 ]]>				
       
   490 				</template>
       
   491 			</defineLocation>
       
   492 
       
   493 			<template id="RealizeCountComponentControls" 
       
   494 				location="COUNT_COMPONENT_CONTROLS" />
       
   495 			
       
   496 			<defineLocation id="COMPONENT_CONTROL" baseLocation="MAIN_FILE"
       
   497 				owned="false"
       
   498 				location="function(${className}::ComponentControl(TInt))">
       
   499 				<template><![CDATA[
       
   500 /**
       
   501 * Get the control with the given index (override)
       
   502 * @param aIndex Control index [0...n) (limited by #CountComponentControls)
       
   503 * @return Pointer to control
       
   504 */
       
   505 CCoeControl* ${className}::ComponentControl( TInt aIndex ) const
       
   506 	{
       
   507 	}
       
   508 ]]>				
       
   509 				</template>
       
   510 			</defineLocation>
       
   511 			
       
   512 			<template id="RealizeComponentControl" location="COMPONENT_CONTROL"/>
       
   513 			
       
   514 			<defineLocation id="COMPONENT_CONTROL_BODY" baseLocation="COMPONENT_CONTROL"
       
   515 				location="region(Generated Contents)">
       
   516 			</defineLocation>
       
   517 
       
   518 			<template id="ComponentControlSwitch1" location="COMPONENT_CONTROL_BODY"><![CDATA[
       
   519 switch ( aIndex )
       
   520 	{
       
   521 ]]>			</template>
       
   522 
       
   523 			<template id="GetChildSwitchCases" location="COMPONENT_CONTROL_BODY"><![CDATA[<%
       
   524 	// each control must contribute switch cases
       
   525 	if (Engine.formMatches(form, ["AppUi", "AknView"])) {
       
   526 		var switchContribs = Engine.generateChildContributions("HandleComponentSwitchDispatch");
       
   527 		Engine.assignLocationsForPhase(switchContribs, "ComponentControlBody", "COMPONENT_CONTROL_BODY");
       
   528 		contribs.addAll(switchContribs);
       
   529 	}
       
   530 		%>]]></template>
       
   531 
       
   532 			<template id="ComponentControlSwitch2" location="COMPONENT_CONTROL_BODY"><![CDATA[
       
   533 	}
       
   534 ]]>			</template>
       
   535 
       
   536 
       
   537 			<template id="ComponentControlFooter" location="COMPONENT_CONTROL">
       
   538 // handle any user controls here...
       
   539 
       
   540 return NULL;
       
   541 			</template>
       
   542 						
       
   543 			<defineLocation id="SIZECHANGED" baseLocation="MAIN_FILE"
       
   544 				owned="false"
       
   545 				location="function(${className}::SizeChanged())">
       
   546 				<template><![CDATA[
       
   547 /**
       
   548  *	Handle resizing of the container. This implementation will lay out
       
   549  *  full-sized controls like list boxes for any screen size, and will layout
       
   550  *  labels, editors, etc. to the size they were given in the UI designer.
       
   551  *  This code will need to be modified to adjust arbitrary controls to
       
   552  *  any screen size.
       
   553  */				
       
   554 void ${className}::SizeChanged()
       
   555 	{
       
   556 	CCoeControl::SizeChanged();
       
   557 	LayoutControls();
       
   558 	}
       
   559 ]]>				
       
   560 				</template>
       
   561 			</defineLocation>
       
   562 
       
   563 			<template id="RealizeSizeChanged" location="SIZECHANGED" />
       
   564 			
       
   565 			<defineLocation id="SIZECHANGED_BODY" baseLocation="SIZECHANGED"
       
   566 				location="region(Generated Contents)">
       
   567 			</defineLocation>
       
   568 
       
   569 			<template id="RealizeSizeChangedBody" location="SIZECHANGED_BODY"><![CDATA[
       
   570 <% var event = instance.events["sizeChanged"];
       
   571    if (event) { %>
       
   572 ${event.handlerName}();
       
   573 <% } %>		
       
   574 ]]>			</template>
       
   575 
       
   576 
       
   577 			<defineLocation id="LAYOUT_CONTROLS" baseLocation="MAIN_FILE"
       
   578 				location="function(${className}::LayoutControls())">
       
   579 			<template><![CDATA[
       
   580 /**
       
   581  * Layout components as specified in the UI Designer
       
   582  */
       
   583 void ${className}::LayoutControls()
       
   584 	{
       
   585 	}
       
   586 ]]>			</template>
       
   587 			</defineLocation>
       
   588 
       
   589 			<template id="RealizeLayoutControls" location="LAYOUT_CONTROLS" />
       
   590 						
       
   591 			<defineLocation id="OFFER_KEYEVENTL" baseLocation="MAIN_FILE"
       
   592 				owned="false"
       
   593 				location="function(${className}::OfferKeyEventL(const TKeyEvent&amp;, TEventCode))">
       
   594 				<template><![CDATA[
       
   595 /**
       
   596  *	Handle key events.
       
   597  */				
       
   598 TKeyResponse ${className}::OfferKeyEventL( 
       
   599 		const TKeyEvent& aKeyEvent, 
       
   600 		TEventCode aType )
       
   601 	{
       
   602 	}
       
   603 ]]>				
       
   604 				</template>
       
   605 			</defineLocation>
       
   606 
       
   607 			<template id="RealizeOfferKeyEventL" location="OFFER_KEYEVENTL" />
       
   608 
       
   609 			<defineLocation id="OFFER_KEYEVENTL_BODY" baseLocation="OFFER_KEYEVENTL"
       
   610 				location="region(Generated Contents)">
       
   611 			</defineLocation>
       
   612 
       
   613 			<template id="RealizeOfferKeyEventLBody" location="OFFER_KEYEVENTL_BODY"/>
       
   614 
       
   615 			<template id="GetChildOfferKeySnippets" location="OFFER_KEYEVENTL_BODY"><![CDATA[<%
       
   616 	// allow controls to contribute their own key handling snippets
       
   617 	if (Engine.formMatches(form, ["AppUi", "AknView"])) {
       
   618 		var handlerContribs = Engine.generateChildContributions("HandleOfferKeyEventL");
       
   619 		Engine.assignLocationsForPhase(handlerContribs, "OfferKeyEventContents", "OFFER_KEYEVENTL_BODY");
       
   620 		contribs.addAll(handlerContribs);
       
   621 	}
       
   622 		%>]]></template>
       
   623 
       
   624 			
       
   625 			<template id="OfferKeyEventLCode"
       
   626 				form="AknView" location="OFFER_KEYEVENTL_BODY"><![CDATA[
       
   627 <% if (properties.contextMenu != "") {
       
   628 	var contextMenuId = Engine.getGeneratedResource(lookupInstanceByName(properties.contextMenu)); 
       
   629 	if (contextMenuId != null) {
       
   630 		includeProjectHrhFile(contribs);
       
   631 		// and continue with contrib code...
       
   632 %>		
       
   633 TBool selectKeyPressed = ( aType == EEventKey && aKeyEvent.iCode == EKeyOK );
       
   634 if ( selectKeyPressed )
       
   635 	{
       
   636 	CAknView* view = iAvkonViewAppUi->View( TUid::Uid( ${getViewUidConstant(instance.parent)} ) );
       
   637 	CEikMenuBar* menuBar = view->MenuBar();
       
   638 
       
   639 	// try to display the context sensitive menu bar
       
   640 	if ( menuBar != NULL )
       
   641 		{
       
   642 		// set the menu bar to the context-sensitive menu bar
       
   643 		menuBar->SetMenuTitleResourceId( ${contextMenuId.toUpperCase()} );
       
   644 		
       
   645 		// make sure the Options menubar isn't showing
       
   646 		menuBar->StopDisplayingMenuBar();
       
   647 		
       
   648 		// display the menu bar
       
   649 		menuBar->TryDisplayMenuBarL();
       
   650 <%if (properties.optionsMenu != "") {
       
   651 	var optionsMenuId = Engine.getGeneratedResource(lookupInstanceByName(instance.parent.properties.optionsMenu));
       
   652 	if (optionsMenuId != null) { 
       
   653 %>		
       
   654 		// set the menu bar back to the Avkon View's Options menu
       
   655 		menuBar->SetMenuTitleResourceId( ${optionsMenuId.toUpperCase()} );
       
   656 <% }} %>
       
   657 		}
       
   658 	return EKeyWasConsumed;
       
   659 	}
       
   660 <% }} 
       
   661 	var event = instance.events["offerKeyEvent"];
       
   662 	if (event) { %>
       
   663 if ( ${event.handlerName}( aKeyEvent, aType ) == EKeyWasConsumed )
       
   664 	{
       
   665 	return EKeyWasConsumed;
       
   666 	}
       
   667 <% } %>
       
   668 ]]>			</template>
       
   669 			
       
   670 			<template id="OfferKeyEventLFooter" location="OFFER_KEYEVENTL"><![CDATA[
       
   671 if ( iFocusControl != NULL
       
   672 	&& iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
       
   673 	{
       
   674 	return EKeyWasConsumed;
       
   675 	}
       
   676 return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
       
   677 ]]>			</template>
       
   678 						
       
   679 			<defineLocation id="DRAW" baseLocation="MAIN_FILE"
       
   680 				owned="false"
       
   681 				location="function(${className}::Draw(const TRect&amp;))">
       
   682 				<template><![CDATA[
       
   683 /**
       
   684  *	Draw container contents.
       
   685  */				
       
   686 void ${className}::Draw( const TRect& aRect ) const
       
   687 	{
       
   688 	}
       
   689 ]]>				
       
   690 				</template>
       
   691 			</defineLocation>
       
   692 
       
   693 			<defineLocation id="DRAW_BODY" baseLocation="DRAW"
       
   694 				location="region(Generated Contents)">
       
   695 			</defineLocation>
       
   696 
       
   697 			<!-- moved below templateGroup 
       
   698 			<useTemplate ids="DrawBodyBgColor"/>
       
   699 			-->
       
   700 			
       
   701 			<defineLocation id="INIT_CONTROLSL" baseLocation="MAIN_FILE"
       
   702 				owned="true"
       
   703 				location="function(${className}::InitializeControlsL())">
       
   704 				<template><![CDATA[
       
   705 /**
       
   706  *	Initialize each control upon creation.
       
   707  */				
       
   708 void ${className}::InitializeControlsL()
       
   709 	{
       
   710 	}
       
   711 ]]>				</template>
       
   712 			</defineLocation>
       
   713 
       
   714 			<template id="RealizeInitControlsL" location="INIT_CONTROLSL"/>
       
   715 			
       
   716 			<template id="SetupFocusChild" phase="PostInitialize"><![CDATA[
       
   717 <%	var initialFocusChild = instance.properties["initialFocus"];
       
   718   	if (initialFocusChild != null && initialFocusChild != "") {%>
       
   719 i${titleCase(initialFocusChild)}->SetFocus( ETrue );
       
   720 iFocusControl = i${titleCase(initialFocusChild)};
       
   721 <%	} %>
       
   722 ]]>			</template>
       
   723 	
       
   724 			<defineLocation id="ResourceChangedOverride" baseLocation="MAIN_FILE"
       
   725 				owned="false"
       
   726 				location="function(${handlerClassName}::HandleResourceChange(TInt))">
       
   727 				<template><![CDATA[
       
   728 /** 
       
   729  * Handle global resource changes, such as scalable UI or skin events (override)
       
   730  */
       
   731 void ${handlerClassName}::HandleResourceChange( TInt aType )
       
   732 	{
       
   733 	${instance.attributes["base-container-class"]}::HandleResourceChange( aType );
       
   734 	}
       
   735 ]]>				
       
   736 				</template>
       
   737 			</defineLocation>
       
   738 
       
   739 			<template id="RealizeResourceChangedOverride" location="ResourceChangedOverride" />
       
   740 				
       
   741 			<template id="AddEikappuiInclude" location="MAIN_SYSTEM_INCLUDES"><![CDATA[
       
   742 #include <eikappui.h>
       
   743 ]]>			</template>
       
   744 
       
   745 			<!-- n.b.: ids can be shared for different forms -->
       
   746 			<template id="SetupResourceChangedOverride" 
       
   747 				form="AppUi" location="ResourceChangedOverride"><![CDATA[
       
   748 SetRect( static_cast< CEikAppUi* >( iCoeEnv->AppUi() )->ClientRect() );
       
   749 ]]>				</template>
       
   750 		
       
   751 			<template id="SetupResourceChangedOverride" 
       
   752 				form="AknView" location="ResourceChangedOverride"><![CDATA[
       
   753 <% 	includeProjectHrhFile(contribs);
       
   754 %>SetRect( iAvkonViewAppUi->View( TUid::Uid( ${getViewUidConstant(instance.parent, contribs)} ) )->ClientRect() );
       
   755 ]]>				</template>
       
   756 		
       
   757 			<defineLocation id="ResourceChangedBody" baseLocation="ResourceChangedOverride"
       
   758 				location="region(Generated Contents)">
       
   759 			</defineLocation>
       
   760 			
       
   761 			<template id="RealizeResourceChangedBody" location="ResourceChangedBody"/>
       
   762 		
       
   763 		</templateGroup>
       
   764 		
       
   765 			<useTemplate ids="DrawBodyBgColor"/>
       
   766 			<useTemplateGroup ids="HandlePointerEvent HandlePointerEventHandler"/>
       
   767 			<useTemplateGroup ids="GenerateFocusChanged"/>
       
   768 			<useTemplateGroup ids="GeneratePositionChanged GeneratePrepareForFocusLoss GeneratePrepareForFocusGain"/>
       
   769 			<useTemplateGroup ids="HandleLongTapEvent"/>
       
   770 			
       
   771 <!-- BEGIN EVENT sizeChanged -->
       
   772 			<templateGroup id="GenerateSizeChangedForCCoeControl" ifEvents="sizeChanged">
       
   773 				
       
   774 				<template id="DeclareSizeChangedHandler" phase="UserHandlers">
       
   775 void ${event.handlerName}();
       
   776 				</template>
       
   777 
       
   778 				<defineLocation id="SizeChangedHandlerMethod" baseLocation="MAIN_FILE"
       
   779 					owned="false"
       
   780 					isEventHandler="true"
       
   781 					location="function(${handlerClassName}::${event.handlerName}())">
       
   782 				<template><![CDATA[
       
   783 /** 
       
   784  * Handle the ${event.eventName} event.
       
   785  */
       
   786 void ${handlerClassName}::${event.handlerName}()
       
   787 	{
       
   788 	// TODO: implement ${event.eventName} event handler
       
   789 	}
       
   790 ]]>				
       
   791 					</template>
       
   792 				</defineLocation>
       
   793 			
       
   794 				<template id="RealizeSizeChangedHandler" location="SizeChangedHandlerMethod" />
       
   795 			</templateGroup>
       
   796 <!-- END EVENT sizeChanged -->
       
   797 <!-- BEGIN EVENT offerKeyEvent -->
       
   798 			<templateGroup id="GenerateOfferKeyEventForCCoeControl" ifEvents="offerKeyEvent">
       
   799 
       
   800 				<template id="DeclareOfferKeyEventHandler" phase="UserHandlers"><![CDATA[
       
   801 TKeyResponse ${event.handlerName}( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   802 ]]>				</template>
       
   803 
       
   804 				<defineLocation id="OfferKeyEventHandlerMethod" baseLocation="MAIN_FILE"
       
   805 					owned="false"
       
   806 					isEventHandler="true"
       
   807 					location="function(${handlerClassName}::${event.handlerName}(const TKeyEvent&amp;, TEventCode))">
       
   808 				<template><![CDATA[
       
   809 /** 
       
   810  * Handle the ${event.eventName} event.
       
   811  */
       
   812 TKeyResponse ${handlerClassName}::${event.handlerName}( 
       
   813 		const TKeyEvent& aKeyEvent, 
       
   814 		TEventCode aType )
       
   815 	{
       
   816 	// TODO: implement ${event.eventName} event handler
       
   817 	return EKeyWasNotConsumed;
       
   818 	}
       
   819 ]]>				
       
   820 				</template>
       
   821 				</defineLocation>
       
   822 			
       
   823 				<template id="RealizeOfferKeyEventHandler" location="OfferKeyEventHandlerMethod" />
       
   824 			</templateGroup>
       
   825 <!-- END EVENT offerKeyEvent -->
       
   826 <!-- BEGIN EVENT draw -->
       
   827 			<templateGroup id="GenerateDrawForCCoeControl" ifEvents="draw">
       
   828 				<template location="DRAW_BODY"><![CDATA[
       
   829 ${event.handlerName}( aRect );
       
   830 ]]>				</template>
       
   831 
       
   832 				<template id="DeclareDrawHandler" phase="UserHandlers"><![CDATA[
       
   833 void ${event.handlerName}( const TRect& aRect ) const;
       
   834 ]]>				</template>
       
   835 
       
   836 				<defineLocation id="DrawHandlerMethod" baseLocation="MAIN_FILE"
       
   837 					owned="false"
       
   838 					isEventHandler="true"
       
   839 					location="function(${handlerClassName}::${event.handlerName}(const TRect&amp;))">
       
   840 					<template><![CDATA[
       
   841 /** 
       
   842  * Handle the ${event.eventName} event.
       
   843  */
       
   844 void ${handlerClassName}::${event.handlerName}( const TRect& aRect ) const
       
   845 	{
       
   846 	// TODO: implement ${event.eventName} event handler
       
   847 	}
       
   848 ]]>				
       
   849 					</template>
       
   850 				</defineLocation>
       
   851 			
       
   852 				<template id="RealizeDrawHandler" location="DrawHandlerMethod" />
       
   853 			</templateGroup>
       
   854 <!-- END EVENT draw -->	
       
   855 
       
   856 <!-- BEGIN EVENT resourceChanged : special case for CCoeControl -->
       
   857 			<templateGroup id="GenerateResourceChanged" ifEvents="resourceChanged">
       
   858 
       
   859 			<template id="InvokeResourceChangedHandler" location="ResourceChangedBody">
       
   860 ${event.handlerName}( aType );
       
   861 			</template>
       
   862 
       
   863 			<template id="DeclareResourceChangedHandler" phase="UserHandlers">
       
   864 void ${event.handlerName}( TInt aType );
       
   865 			</template>
       
   866 
       
   867 			<defineLocation id="ResourceChangedHandlerMethod" baseLocation="MAIN_FILE"
       
   868 				owned="false"
       
   869 				isEventHandler="true"
       
   870 				location="function(${handlerClassName}::${event.handlerName}(TInt))">
       
   871 			<template><![CDATA[
       
   872 /** 
       
   873  * Handle the ${event.eventName} event.
       
   874  */
       
   875 void ${handlerClassName}::${event.handlerName}( TInt aType )
       
   876 	{
       
   877 	// TODO: implement ${event.eventName} event handler
       
   878 	}
       
   879 ]]>				
       
   880 				</template>
       
   881 			</defineLocation>
       
   882 			
       
   883 			<template id="RealizeResourceChangedHandler" location="ResourceChangedHandlerMethod" />
       
   884 			</templateGroup>
       
   885 <!-- END EVENT resourceChanged -->		
       
   886 
       
   887 			<inline>
       
   888 			if (Engine.formMatches(form, ["AppUi", "AknView"])) {
       
   889 				// get the generated files matching this pattern and include them
       
   890 				var files = Engine.findGeneratedRssFiles(".*\\.hrh");
       
   891 				for (idx in files) {
       
   892 					var file = files[idx];
       
   893 					var mycontrib = Engine.createContributionForLocation("MAIN_USER_INCLUDES")
       
   894 					mycontrib.setText("#include \"" + file + "\"\n");
       
   895 					contribs.add(mycontrib);
       
   896 				}
       
   897 			}
       
   898 			</inline>
       
   899 
       
   900 			<!-- child contributions -->						
       
   901 			<inline scope="prototype"><![CDATA[
       
   902 			include("../srcgenLibrary.js");
       
   903 
       
   904 /** 
       
   905 	Initialize sourcegen, here by removing stored tables used to
       
   906 	ensure image-related declarations are only emitted once 
       
   907 */			
       
   908 ${jsObject}.prototype.initSourceGen = function(contribs, instance, form) {
       
   909 	if (Engine.formMatches(form, ["AppUi", "AknView"])) {
       
   910 		// clear out any image stuff
       
   911 		resetImagePropertyState(instance);
       
   912 	}
       
   913 }
       
   914 
       
   915 /** 
       
   916 	Get child sourcegen, by recursing to children and retrieving
       
   917 	contributions for the passed-in form, and optionally any specific
       
   918 	to a Container.  
       
   919 */			
       
   920 ${jsObject}.prototype.getChildSourceGen = function(contribs, instance, form) {
       
   921 	if (!Engine.formMatches(form, ["RootAppUi"])) {
       
   922 		if (Engine.formMatches(form, [ "AknView", "AppUi" ])) {
       
   923 			// get default and container-specific contributions
       
   924 			// (the argument is a regular expression)
       
   925 			contribs.addAll(Engine.generateChildContributions(form+"|Container"))
       
   926 		} else {
       
   927 			// unknown form -- likely specific to a parent -- so get 
       
   928 			// form-specific contributions
       
   929 			contribs.addAll(Engine.generateChildContributions(form))
       
   930 		}
       
   931 	}
       
   932 }
       
   933 			
       
   934 /**
       
   935 	Finish sourcegen for this CCoeControl by organizing contributions
       
   936 	and resolving contributions attached to a phase to their actual
       
   937 	locations.  All contributions leaving a component should have
       
   938 	locations rather than phases unless another parent is known to
       
   939 	handle them.
       
   940 	
       
   941 	Children generate contributions to phases rather than known location
       
   942 	ids to add a level of indirection which allows for refactoring in the
       
   943 	future.  It is not a required practice (and indeed, event handler
       
   944 	sourcegen does need to know about MAIN_FILE) but helps reduce coupling.
       
   945 */
       
   946 ${jsObject}.prototype.finishSourceGen = function(contribs, instance, form) {
       
   947 	if (Engine.formMatches(form, ["AppUi", "AknView"])) {
       
   948 		Engine.collateContributionsByPhase(contribs, ["Initialize", "PostInitialize"]);
       
   949 		
       
   950 		// fix up the phases so they point to real locations
       
   951 		Engine.assignLocationsForPhase(contribs, "MainConstants", "CONSTANTS");
       
   952 		Engine.assignLocationsForPhase(contribs, "MainSystemIncludes", "MAIN_SYSTEM_INCLUDES");
       
   953 		Engine.assignLocationsForPhase(contribs, "MainUserIncludes", "MAIN_USER_INCLUDES");
       
   954 		Engine.assignLocationsForPhase(contribs, "Destroy", "DESTRUCTOR_BODY");
       
   955 		Engine.assignLocationsForPhase(contribs, "Construct", "CONSTRUCTOR_BODY");
       
   956 		Engine.assignLocationsForPhase(contribs, "Initialize", "INIT_CONTROLSL");
       
   957 		Engine.assignLocationsForPhase(contribs, "PostInitialize", "INIT_CONTROLSL");
       
   958 		Engine.assignLocationsForPhase(contribs, "PostActivateL", "CONSTRUCTL_BODY");
       
   959 		Engine.assignLocationsForPhase(contribs, "LayoutControls", "LAYOUT_CONTROLS");
       
   960 		Engine.assignLocationsForPhase(contribs, "HeaderIncludes", "HEADER_INCLUDES");
       
   961 		Engine.assignLocationsForPhase(contribs, "ForwardDeclarations", "HEADER_FORWARD_DECLARATIONS");
       
   962 		Engine.assignLocationsForPhase(contribs, "ClassTypeDeclarations", "CLASS_TYPES");
       
   963 		Engine.assignLocationsForPhase(contribs, "InstanceVariables", "CLASS_IVARS");
       
   964 		Engine.assignLocationsForPhase(contribs, "ClassMethods", "CLASS_METHODS");
       
   965 		Engine.assignLocationsForPhase(contribs, "ClassSource", "MAIN_FILE");
       
   966 		Engine.assignLocationsForPhase(contribs, "ClassHeader", "HEADER_FILE");
       
   967 		Engine.assignLocationsForPhase(contribs, "BaseClassList", "BASE_CLASS_LIST");
       
   968 		Engine.assignLocationsForPhase(contribs, "OverriddenMethods", "CLASS_OVERRIDES");
       
   969 		Engine.assignLocationsForPhase(contribs, "UserHandlers", "CLASS_USERHANDLERS");
       
   970 		Engine.assignLocationsForPhase(contribs, "EventIncludes", "EVENT_INCLUDES");
       
   971 		Engine.assignLocationsForPhase(contribs, "SizeChanged", "SIZECHANGED_BODY");
       
   972 								
       
   973 		// remove duplicate contributions where the location doesn't already have a filter
       
   974 		Engine.removeDuplicateContributionsForLocation(contribs, "HEADER_FORWARD_DECLARATIONS");
       
   975 		Engine.removeDuplicateContributionsForLocation(contribs, "DESTRUCTOR_BODY");
       
   976 	}
       
   977 }
       
   978 
       
   979 ]]>			</inline>
       
   980 			
       
   981 			<inline><![CDATA[
       
   982 
       
   983 			if (!Engine.formMatches(form, ["RootAppUi"])) {
       
   984 
       
   985 				this.initSourceGen(contribs, instance, form);
       
   986 	
       
   987 				this.getChildSourceGen(contribs, instance, form);
       
   988 							
       
   989 				this.finishSourceGen(contribs, instance, form);
       
   990 
       
   991 			}
       
   992 						
       
   993 ]]>			</inline>			
       
   994 
       
   995 			<template id="IncludeRsgFile" location="MAIN_SYSTEM_INCLUDES"><![CDATA[
       
   996 <% if (resourceFileNameBase != null) {%>#include <${resourceFileNameBase}.rsg>
       
   997 <% } %>]]></template>
       
   998 		
       
   999 			<!-- contributions as child -->		
       
  1000 
       
  1001 			<templateGroup id="ChildDeclContribs" forms="RootAppUi AknView">
       
  1002 				<template id="Header" phase="MainUserIncludes"><![CDATA[
       
  1003 #include "${instanceName}.h"
       
  1004 ]]>				</template>
       
  1005 
       
  1006 				<template id="FwdClass" phase="ForwardDeclarations">
       
  1007 class ${className};
       
  1008 				</template>
       
  1009 
       
  1010 				<template id="Var" phase="InstanceVariables">
       
  1011 ${className}* ${instanceMemberName};
       
  1012 				</template>
       
  1013 
       
  1014 				<template id="Init" phase="Construct">
       
  1015 ${instanceMemberName} = NULL;
       
  1016 				</template>
       
  1017 				
       
  1018 				<template id="Delete" form="AknView" phase="Destroy">
       
  1019 delete ${instanceMemberName};
       
  1020 ${instanceMemberName} = NULL;
       
  1021 				</template>
       
  1022 			</templateGroup>
       
  1023 
       
  1024 			<templateGroup id="ChildConstructionContribs">			
       
  1025 				<template id="AddToStack" form="AknView" phase="DoActivateL">
       
  1026 if ( ${instanceMemberName} == NULL )
       
  1027 	{
       
  1028 	${instanceMemberName} = CreateContainerL();
       
  1029 	${instanceMemberName}->SetMopParent( this );
       
  1030 	AppUi()->AddToStackL( *this, ${instanceMemberName} );
       
  1031 	} 
       
  1032 				</template>
       
  1033 			
       
  1034 				<template id="RemoveFromStack" form="AknView" phase="DoDeactivate">
       
  1035 if ( ${instanceMemberName} != NULL )
       
  1036 	{
       
  1037 	AppUi()->RemoveFromViewStack( *this, ${instanceMemberName} );
       
  1038 	delete ${instanceMemberName};
       
  1039 	${instanceMemberName} = NULL;
       
  1040 	}
       
  1041 				</template>
       
  1042 			
       
  1043 				<!-- note: RootAppUi form still creates container directly,
       
  1044 					not using CreateContainerL() -->
       
  1045 				<template id="AddToStack" form="RootAppUi" phase="Initialize">
       
  1046 ${instanceMemberName} = ${className}::NewL( ClientRect(), NULL, this );
       
  1047 ${instanceMemberName}->SetMopParent( this );
       
  1048 AddToStackL( ${instanceMemberName} );
       
  1049 				</template>
       
  1050 
       
  1051 				<template id="RemoveFromStack" form="RootAppUi" phase="Destroy">
       
  1052 if ( ${instanceMemberName} != NULL )
       
  1053 	{
       
  1054 	RemoveFromStack( ${instanceMemberName} );
       
  1055 	delete ${instanceMemberName};
       
  1056 	${instanceMemberName} = NULL;
       
  1057 	}
       
  1058 				</template>
       
  1059 
       
  1060 				<!-- new for 1.3: allow overriding constructor (NewL) call -->
       
  1061 				
       
  1062 				<!-- owned declaration -->
       
  1063 				<template id="CreateContainerDecl" forms="AknView" phase="ClassMethods"><![CDATA[
       
  1064 ${className}* CreateContainerL();
       
  1065 ]]>				</template>
       
  1066 				
       
  1067 				<!-- non-owned definition.  No location is needed since we're just spewing text -->
       
  1068 				<template id="CreateContainerDefn" forms="AknView" phase="ClassSource"><![CDATA[
       
  1069 /**
       
  1070  *	Creates the top-level container for the view.  You may modify this method's
       
  1071  *	contents and the ${className}::NewL() signature as needed to initialize the
       
  1072  *	container, but the signature for this method is fixed.
       
  1073  *	@return new initialized instance of ${className}
       
  1074  */
       
  1075 ${className}* ${instance.parent.properties.className}::CreateContainerL()
       
  1076 	{
       
  1077 	return ${className}::NewL( ClientRect(), NULL, this );
       
  1078 	}
       
  1079 ]]>				</template>
       
  1080 
       
  1081 			</templateGroup>		
       
  1082 
       
  1083 			<template mode="upgrade(1.0,1.1)" location="HEADER_FILE">
       
  1084 @@@ Make TControls enum public
       
  1085 - enum TControls
       
  1086 + public:				
       
  1087 + 	enum TControls
       
  1088 			</template>
       
  1089 
       
  1090 			<!-- add function at EOF -->
       
  1091 			<template mode="upgrade(1.1,1.2)" forms="AknView" phase="ClassSource"><![CDATA[
       
  1092 @@@ Factor out construction of container to allow user customization
       
  1093 + 
       
  1094 + /**
       
  1095 +  *	Creates the top-level container for the view.  You may modify this method's
       
  1096 +  *	contents and the ${className}::NewL() signature as needed to initialize the
       
  1097 +  *	container, but the signature for this method is fixed.
       
  1098 +  *	@return new initialized instance of ${className}
       
  1099 +  */
       
  1100 + ${className}* ${instance.parent.properties.className}::CreateContainerL()
       
  1101 + 	{
       
  1102 + 	return ${className}::NewL( ClientRect(), NULL, this );
       
  1103 + 	}
       
  1104 + 			
       
  1105 ]]>			</template>
       
  1106 
       
  1107 		</sourceGen>
       
  1108 	</component>
       
  1109 </componentDefinition>