uidesigner/com.nokia.sdt.series60.componentlibrary/components/containers/CAknForm.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.DialogBase" 
       
    13 			friendlyName="%friendlyName" 
       
    14 			qualifiedName="com.nokia.sdt.series60.CAknForm" 
       
    15 			category="Basic"
       
    16 			instanceNameRoot="form"
       
    17 			version="1.0">
       
    18 		<documentation>
       
    19 			<information>%information</information>
       
    20 			<wizardDescription>%information</wizardDescription>
       
    21 		</documentation>
       
    22 		<symbian sdkName="com.nokia.series60" minSDKVersion="2.0" 
       
    23 			className="CAknForm" classHelpTopic="" />
       
    24 		<designerImages 
       
    25 			smallIconFile="CAknForm_sm.png" 
       
    26 			largeIconFile="CAknForm.png" 
       
    27 			thumbnailFile="form_tn.png"/>
       
    28 			
       
    29 		<attributes>
       
    30 			<attribute key="is-initial-content">true</attribute>
       
    31 			<attribute key="has-builtin-options-menu">true</attribute>
       
    32 			<attribute key="event-handler-target">true</attribute>
       
    33 			<attribute key="base-container-class">CAknForm</attribute>
       
    34 			<attribute key="base-control-observer-class">CAknForm</attribute>
       
    35 			<attribute key="default-cba-value">R_AVKON_SOFTKEYS_OPTIONS_BACK</attribute>
       
    36 			<attribute key="use-restricted-cba">true</attribute>
       
    37 			<attribute key="associated-palette-drawer">Editors</attribute>
       
    38 		</attributes>
       
    39 
       
    40 		<properties>
       
    41 			<property category="Form" name="EEikFormHideEmptyFields" type="boolean" default="false"
       
    42 				descriptionKey="EEikFormHideEmptyFieldsKey" />
       
    43 			<property category="Form" name="EEikFormShowBitmaps" type="boolean" default="false"
       
    44 				descriptionKey="EEikFormShowBitmapsKey" />
       
    45 			<property category="Form" name="EEikFormEditModeOnly" type="boolean" default="false"
       
    46 				descriptionKey="EEikFormEditModeOnlyKey" />
       
    47 			<property category="Form" name="EEikFormUseDoubleSpacedFormat" type="boolean" default="false"
       
    48 				descriptionKey="EEikFormUseDoubleSpacedFormat" />
       
    49 			<property category="Behavior" name="exitsApp" type="boolean" default="true"
       
    50 				descriptionKey="exitsAppKey" />
       
    51 		</properties>
       
    52 		
       
    53 		<extensionProperties name="default">
       
    54 			<property category="Item" name="prompt" type="localizedString" default="prompt"
       
    55 				descriptionKey="promptDescription"
       
    56 				editorClass="com.nokia.sdt.symbian.ui.editors.ScalableTextEditorFactory" />
       
    57 			<property category="Item" name="EEikDlgItemTakesEnterKey" 
       
    58 				type="boolean" default="false"
       
    59 				descriptionKey="EEikDlgItemTakesEnterKeyDescription" />
       
    60 			<property category="Item" name="EEikDlgItemOfferAllHotKeys" 
       
    61 				type="boolean" default="false"
       
    62 				descriptionKey="EEikDlgItemOfferAllHotKeysDescription" />
       
    63 			<property category="Item" name="EEikDlgItemSeparatorBefore" 
       
    64 				type="boolean" default="false"
       
    65 				descriptionKey="EEikDlgItemSeparatorBeforeDescription" /> 
       
    66 			<compoundProperty category="Item" name="promptImage" 
       
    67 				type="com.nokia.sdt.symbian.imageProperty"
       
    68 				descriptionKey="promptImageDescription" />
       
    69 		</extensionProperties>
       
    70 	
       
    71 		<implementations>
       
    72 			<implementation>
       
    73 				<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
       
    74 				<interface id="com.nokia.sdt.datamodel.adapter.ILayout"/>
       
    75 				<interface id="com.nokia.sdt.datamodel.adapter.IScrollBoundsProvider"/>
       
    76 				<code class="com.nokia.sdt.series60.component.AknFormVisualAndLayoutImplFactory"/>
       
    77 			</implementation>
       
    78 			<implementation>
       
    79 				<interface id="com.nokia.sdt.datamodel.adapter.IPropertyExtenders"/>
       
    80 				<script file="CAknForm_propertyExtenders.js" prototype="CAknFormPropertyExtenders"/>
       
    81 			</implementation>
       
    82 			<implementation>
       
    83 				<interface id="com.nokia.sdt.datamodel.adapter.IQueryContainment"/>
       
    84 				<script file="CAknForm_queryContainment.js" prototype="CAknFormQueryContainment"/>
       
    85 			</implementation>
       
    86 			</implementations>
       
    87 	
       
    88 		<sourceMapping>
       
    89 			<mapResource struct="DIALOG" headers="avkon.rsg avkon.rh eikon.rh">
       
    90 				<mapBitmaskMember property="." member="flags"
       
    91 					includedProperties="wait notifyEsc modeless">
       
    92 					<!-- initial blank entries force bits on -->
       
    93 					<mapBitmaskValue properties="" value="EEikDialogFlagNoDrag" />
       
    94 					<mapBitmaskValue properties="" value="EEikDialogFlagNoTitleBar" />
       
    95 					<mapBitmaskValue properties="" value="EEikDialogFlagCbaButtons" />
       
    96 					<mapBitmaskValue properties="" value="EEikDialogFlagFillAppClientRect" />
       
    97 					
       
    98 					<mapBitmaskValue properties="notifyEsc" value="EEikDialogFlagNotifyEsc" />
       
    99 					<mapBitmaskValue properties="modeless" value="EEikDialogFlagModeless" />
       
   100 					<mapBitmaskValue properties="wait" value="EEikDialogFlagWait" />
       
   101 				</mapBitmaskMember>
       
   102 	  		    <select property="[parent].[com.nokia.sdt.series60.CBARestricted]">
       
   103 	   		        <choice value="">
       
   104 	  		          <!-- no CBA -->
       
   105 	  		        </choice>
       
   106 	  		        <choice>
       
   107 						<mapIdentifierMember property="[parent].[com.nokia.sdt.series60.CBARestricted].info" member="buttons" />
       
   108 					</choice>
       
   109 				</select>
       
   110 				<mapResourceMember struct="FORM" property="." member="form" headers="eikon.rh">
       
   111 				<mapBitmaskMember property="." member="flags"
       
   112 					includedProperties="EEikFormHideEmptyFields EEikFormShowBitmaps EEikFormEditModeOnly EEikFormUseDoubleSpacedFormat">
       
   113 					<mapBitmaskValue properties="EEikFormHideEmptyFields" value="EEikFormHideEmptyFields" />
       
   114 					<mapBitmaskValue properties="EEikFormShowBitmaps" value="EEikFormShowBitmaps" />
       
   115 					<mapBitmaskValue properties="EEikFormEditModeOnly" value="EEikFormEditModeOnly" />
       
   116 					<mapBitmaskValue properties="EEikFormUseDoubleSpacedFormat" value="EEikFormUseDoubleSpacedFormat" />
       
   117 				</mapBitmaskMember>
       
   118 					<mapArrayMember property="." member="items">
       
   119 						<select attribute="is-form-content">
       
   120 							<!-- only map visible items, not menu bars, etc. -->
       
   121 							<choice value="true">
       
   122 								<mapResourceElement struct="DLG_LINE" headers="avkon.rh"
       
   123 									instanceIdentifyingMember="id">
       
   124 									<!-- looking at the current array element, always
       
   125 										create a unique value from the dialog and instance name -->
       
   126 									<mapEnumMember property="." member="type"
       
   127 										nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_CONTROL_TYPE"
       
   128 									/>
       
   129 									<mapSimpleMember property="prompt" member="prompt"/>
       
   130 									<mapEnumMember property="." member="id"
       
   131 										uniqueValue="*"
       
   132 										nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_DIALOG_LINE_ID"
       
   133 									/>
       
   134 									<!-- looking at the current array element, get the
       
   135 										enumerator for the instance's control type -->
       
   136 									<mapBitmaskMember property="." member="itemflags"
       
   137 										includedProperties="EEikDlgItemTakesEnterKey EEikDlgItemOfferAllHotKeys EEikDlgItemSeparatorBefore">
       
   138 										<mapBitmaskValue properties="EEikDlgItemTakesEnterKey" value="EEikDlgItemTakesEnterKey" />
       
   139 										<mapBitmaskValue properties="EEikDlgItemOfferAllHotKeys" value="EEikDlgItemOfferAllHotKeys" />
       
   140 										<mapBitmaskValue properties="EEikDlgItemSeparatorBefore" value="EEikDlgItemSeparatorBefore" />
       
   141 									</mapBitmaskMember>
       
   142 									<mapResourceMember property="." member="control"/>
       
   143 								<!-- initialized in code for SVG support
       
   144 									<mapSimpleMember property="promptImage.bmpfile" member="bmpfile"/>
       
   145 									<mapIdentifierMember property="promptImage.bmpid" member="bmpid"/>
       
   146 									// stupid header doesn't initialize bmpmask to -1
       
   147 									<select property="promptImage.bmpmask">
       
   148 										<choice value="">
       
   149 											<mapFixedMember member="bmpmask" value="-1"/>
       
   150 										</choice>
       
   151 										<choice>
       
   152 											<mapIdentifierMember property="promptImage.bmpmask" member="bmpmask"/>
       
   153 										</choice>
       
   154 									</select>
       
   155 								-->
       
   156 								</mapResourceElement>
       
   157 							</choice>
       
   158 							<!-- default case does nothing -->
       
   159 							<choice/>
       
   160 						</select>						
       
   161 					</mapArrayMember>
       
   162 				</mapResourceMember>
       
   163 			</mapResource>
       
   164 		</sourceMapping>
       
   165 		
       
   166 		<sourceGen forms="AppUi AknView RootAppUi">
       
   167 		
       
   168 			<!-- contributions as Form -->
       
   169 
       
   170 			<defineLocation id="HEADER_FILE" domain="cpp" dir="${inc}" 
       
   171 				file="${instanceName}.h"
       
   172 				owned="false"
       
   173 				location="">
       
   174 			</defineLocation>
       
   175 			
       
   176 			<template location="HEADER_FILE">
       
   177 #ifndef ${instanceName.toUpperCase()}_H
       
   178 #define ${instanceName.toUpperCase()}_H
       
   179 
       
   180 			</template>
       
   181 			
       
   182 			<defineLocation id="HEADER_INCLUDES" baseLocation="HEADER_FILE"
       
   183 				location="region(Generated Includes)"
       
   184 				filter="unique-includes">
       
   185 			</defineLocation>
       
   186 			
       
   187 			<template location="HEADER_INCLUDES"><![CDATA[
       
   188 #include <aknform.h>
       
   189 ]]>			</template>
       
   190 
       
   191 			<defineLocation id="EVENT_INCLUDES" baseLocation="HEADER_FILE"
       
   192 				owned="false"
       
   193 				filter="unique-includes"
       
   194 				location="region(Event Handler Includes)">
       
   195 			</defineLocation>
       
   196 			
       
   197 			<template location="EVENT_INCLUDES" />
       
   198 		
       
   199 			<defineLocation id="HEADER_FORWARD_DECLARATIONS" baseLocation="HEADER_FILE"
       
   200 				location="region(Generated Forward Declarations)">
       
   201 				<template><![CDATA[
       
   202 class MEikCommandObserver;		
       
   203 ]]>				</template>
       
   204 			</defineLocation>	
       
   205 				
       
   206 			<template location="HEADER_FORWARD_DECLARATIONS"/>
       
   207 			
       
   208 	
       
   209 			<defineLocation id="CLASS" baseLocation="HEADER_FILE"
       
   210 				owned="false"
       
   211 				location="class(${className})">
       
   212 				<template><![CDATA[
       
   213 /**
       
   214  * @class	${className} ${instanceName}.h
       
   215  */
       
   216 class ${className} : public CAknForm
       
   217 	{
       
   218 public: // constructors and destructor
       
   219 
       
   220 	${className}( MEikCommandObserver* aCommandObserver );
       
   221 	static ${className}* NewL( MEikCommandObserver* aCommandObserver );
       
   222 	static ${className}* NewLC( MEikCommandObserver* aCommandObserver );
       
   223 	virtual ~${className}();
       
   224 	
       
   225 	// from CEikDialog
       
   226 	TKeyResponse OfferKeyEventL( 
       
   227 			const TKeyEvent& aKeyEvent, 
       
   228 			TEventCode aType );
       
   229 	
       
   230 protected: 
       
   231 	// from CAknDialog	
       
   232 	void PreLayoutDynInitL();
       
   233 	TBool OkToExitL( TInt aButtonId );
       
   234 
       
   235 	// from CAknForm
       
   236 	void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   237 	TBool QuerySaveChangesL();
       
   238 	TBool SaveFormDataL(); 
       
   239 	void DoNotSaveFormDataL();
       
   240 
       
   241 private:
       
   242 	void LoadFromDataL();
       
   243 	MEikCommandObserver* iCommandObserver;
       
   244 	};
       
   245 ]]>
       
   246 				</template>
       
   247 			</defineLocation>
       
   248 			
       
   249 			<template location="CLASS"/>
       
   250 
       
   251 			<defineLocation id="CLASS_METHODS" baseLocation="CLASS"
       
   252 				filter="unique-prototypes"
       
   253 				location="region(Generated Methods)">
       
   254 				<template><![CDATA[
       
   255 public: <% contrib.indentAdjust(-1); %>
       
   256 ]]>				</template>
       
   257 			</defineLocation>
       
   258 			
       
   259 			<template location="CLASS_METHODS"/>
       
   260 
       
   261 		<defineLocation id="CLASS_TYPES" baseLocation="CLASS"
       
   262 			location="region(Generated Type Declarations)">
       
   263 				<template><![CDATA[
       
   264 public: <% contrib.indentAdjust(-1); %>
       
   265 ]]>				</template>
       
   266 			</defineLocation>
       
   267 
       
   268 			<template location="CLASS_TYPES"/>
       
   269 
       
   270 			<defineLocation id="CLASS_IVARS" baseLocation="CLASS"
       
   271 			location="region(Generated Instance Variables)">
       
   272 				<template><![CDATA[
       
   273 private: <% contrib.indentAdjust(-1); %>
       
   274 ]]>				</template>
       
   275 			</defineLocation>
       
   276 
       
   277 			<template location="CLASS_IVARS"/>
       
   278 
       
   279 			<defineLocation id="BASE_CLASS_LIST" baseLocation="CLASS"
       
   280 				owned="false"
       
   281 				filter="unique-bases"
       
   282 				location="bases()">
       
   283 			</defineLocation>
       
   284 			
       
   285 			<template location="BASE_CLASS_LIST" />
       
   286 			
       
   287 			<defineLocation id="CLASS_OVERRIDES" baseLocation="CLASS"
       
   288 				owned="false"
       
   289 				filter="unique-prototypes"
       
   290 				location="region(Overridden Methods)">
       
   291 				<template><![CDATA[
       
   292 protected: <% contrib.indentAdjust(-1); %>
       
   293 ]]>				</template>
       
   294 				
       
   295 			</defineLocation>			
       
   296 				
       
   297 			<template location="CLASS_OVERRIDES"/>
       
   298 			
       
   299 			<defineLocation id="CLASS_USERHANDLERS" baseLocation="CLASS"
       
   300 				owned="false"
       
   301 				filter="unique-prototypes"
       
   302 				location="region(User Handlers)">
       
   303 				<template><![CDATA[
       
   304 protected: <% contrib.indentAdjust(-1); %>
       
   305 ]]>				</template>
       
   306 				
       
   307 			</defineLocation>				
       
   308 			
       
   309 			<template location="CLASS_USERHANDLERS"/>
       
   310 
       
   311 			<template location="HEADER_FILE">
       
   312 #endif // ${instanceName.toUpperCase()}_H
       
   313 			</template>
       
   314 							
       
   315 			<defineLocation id="MAIN_FILE" domain="cpp" dir="${src}" 
       
   316 				file="${instanceName}.cpp"
       
   317 				owned="false"
       
   318 				location="">
       
   319 			</defineLocation>
       
   320 
       
   321 			<template location="MAIN_FILE"/>
       
   322 			
       
   323 			<defineLocation id="MAIN_SYSTEM_INCLUDES" baseLocation="MAIN_FILE"
       
   324 				location="region(Generated System Includes)"
       
   325 				filter="unique-includes">
       
   326 				<template><![CDATA[
       
   327 #include <avkon.hrh>
       
   328 ]]>				</template>
       
   329 				<template><![CDATA[
       
   330 #include <avkon.rsg>
       
   331 ]]>				</template>
       
   332 				<template><![CDATA[
       
   333 #include <eikmenup.h>
       
   334 ]]>				</template>
       
   335 				<template><![CDATA[
       
   336 #include <aknappui.h>
       
   337 ]]>				</template>
       
   338 				<template><![CDATA[
       
   339 #include <eikcmobs.h>
       
   340 ]]>				</template>
       
   341 			</defineLocation>
       
   342 
       
   343 			<template location="MAIN_SYSTEM_INCLUDES"/>
       
   344 	
       
   345 			<defineLocation id="MAIN_USER_INCLUDES" baseLocation="MAIN_FILE"
       
   346 				location="region(Generated User Includes)"
       
   347 				filter="unique-includes">
       
   348 				<template><![CDATA[
       
   349 #include "${instanceName}.h"
       
   350 ]]>				</template>
       
   351 			</defineLocation>		
       
   352 
       
   353 			<template location="MAIN_USER_INCLUDES"/>
       
   354 			
       
   355 			<inline>
       
   356 if (Engine.formMatches(form, [""])) {
       
   357 	this.getHrhFiles(contribs);
       
   358 }
       
   359 			</inline>
       
   360 			
       
   361 			<defineLocation id="CONSTANTS" baseLocation="MAIN_FILE"
       
   362 				location="region(Generated Constants)">
       
   363 			</defineLocation>
       
   364 
       
   365 			<template location="CONSTANTS" />
       
   366 
       
   367 			<defineLocation id="CONSTRUCTOR" baseLocation="MAIN_FILE"
       
   368 				owned="false"
       
   369 				location="function(${className}::${className}(MEikCommandObserver*))">
       
   370 				<template><![CDATA[
       
   371 /**
       
   372  * Construct the ${className} instance
       
   373  * @param aCommandObserver command observer
       
   374  */ 
       
   375 ${className}::${className}( MEikCommandObserver* aCommandObserver )
       
   376 	{
       
   377 	iCommandObserver = aCommandObserver;
       
   378 	}
       
   379 ]]>
       
   380 				</template>			
       
   381 			</defineLocation>
       
   382 			
       
   383 			<template location="CONSTRUCTOR"/>
       
   384 
       
   385 			<defineLocation id="CONSTRUCTOR_BODY" baseLocation="CONSTRUCTOR"
       
   386 				location="region(Generated Contents)">
       
   387 			</defineLocation>
       
   388 
       
   389 			<template location="CONSTRUCTOR_BODY"/>
       
   390 			
       
   391 			<template location="MAIN_FILE"><![CDATA[
       
   392 /**
       
   393  *  Creates an instance and initializes it.
       
   394  *  Instance is not left on cleanup stack.
       
   395  * @param aCommandObserver command observer
       
   396  * @return initialized instance of ${className}
       
   397  */
       
   398 ${className}* ${className}::NewL( MEikCommandObserver* aCommandObserver )
       
   399 	{
       
   400 	${className}* self = ${className}::NewLC( aCommandObserver );
       
   401 	CleanupStack::Pop( self );
       
   402 	return self;
       
   403 	}
       
   404 
       
   405 /**
       
   406  *  Creates an instance and initializes it.
       
   407  *  Instance is left on cleanup stack.
       
   408  * @param aCommandObserver command observer
       
   409  * @return new instance of ${className}
       
   410  */
       
   411 ${className}* ${className}::NewLC( MEikCommandObserver* aCommandObserver )
       
   412 	{
       
   413 	${className}* self = new ( ELeave ) ${className}( aCommandObserver );
       
   414 	CleanupStack::PushL( self );
       
   415 	self->ConstructL();
       
   416 	return self;
       
   417 	}
       
   418 ]]>			
       
   419 			</template>
       
   420 
       
   421 				<defineLocation id="OFFER_KEYEVENTL" baseLocation="MAIN_FILE"
       
   422 					owned="false"
       
   423 					location="function(${handlerClassName}::OfferKeyEventL(const TKeyEvent&amp;,TEventCode))">
       
   424 					<template><![CDATA[
       
   425 /** 
       
   426  * Handle key event (override)
       
   427  * @param aKeyEvent key event
       
   428  * @param aType event code
       
   429  * @return EKeyWasConsumed if the event was handled, else EKeyWasNotConsumed
       
   430  */
       
   431 TKeyResponse ${className}::OfferKeyEventL( 
       
   432 		const TKeyEvent& aKeyEvent, 
       
   433 		TEventCode aType )
       
   434 	{
       
   435 	}
       
   436 ]]>				
       
   437 					</template>
       
   438 				</defineLocation>
       
   439 				
       
   440 			<defineLocation id="OFFER_KEYEVENTL_BODY" baseLocation="OFFER_KEYEVENTL"
       
   441 				location="region(Generated Contents)"/>
       
   442 
       
   443 		<template location="OFFER_KEYEVENTL_BODY"/>
       
   444 			
       
   445 		<template location="OFFER_KEYEVENTL"><![CDATA[
       
   446 <% if (instance.rootContainer.isInstanceOf("com.nokia.sdt.series60.CAknView")) { 
       
   447 %>if ( ( aKeyEvent.iCode == EKeyLeftArrow 
       
   448 	|| aKeyEvent.iCode == EKeyRightArrow )
       
   449 	&& !IsEditable() )
       
   450 	{
       
   451 	// allow the tab control to get the arrow keys
       
   452 	return EKeyWasNotConsumed;
       
   453 	}
       
   454 <% } %>
       
   455 ]]>		</template>
       
   456 
       
   457 			<!-- this is the same template emitted as an event include
       
   458 			from ContainerBase; we need to omit to reduce duplicates -->
       
   459 			<template id="OfferKeyEventOverrideContents" location="OFFER_KEYEVENTL"><![CDATA[
       
   460 <% if (!instance.events["offerKeyEvent"]) {
       
   461 %>return ${instance.attributes["base-container-class"]}::OfferKeyEventL( aKeyEvent, aType );
       
   462 <%}%> ]]>	</template>
       
   463 
       
   464 
       
   465 			<defineLocation id="DESTRUCTOR" baseLocation="MAIN_FILE"
       
   466 				owned="false"
       
   467 				location="function(${className}::~${className}())">
       
   468 				<template><![CDATA[
       
   469 /** 
       
   470  * Destroy any instance variables
       
   471  */
       
   472 ${className}::~${className}()
       
   473 	{
       
   474 	}
       
   475 ]]>
       
   476 				</template>			
       
   477 			</defineLocation>
       
   478 			
       
   479 			<template location="DESTRUCTOR"/>
       
   480 
       
   481 			<defineLocation id="DESTRUCTOR_BODY" baseLocation="DESTRUCTOR"
       
   482 				location="region(Generated Contents)">
       
   483 			</defineLocation>
       
   484 			
       
   485 			<template location="DESTRUCTOR_BODY"/>
       
   486 
       
   487 			
       
   488 			<template location="MAIN_FILE"><![CDATA[
       
   489 /**
       
   490  * Called to handle "Save" menu item. Displays save query.
       
   491  * @return TBool ETrue if the form data is to be saved, EFalse otherwise
       
   492  */
       
   493 TBool ${className}::QuerySaveChangesL()
       
   494 	{
       
   495 	TBool isAnsYes( CAknForm::QuerySaveChangesL() );
       
   496 	
       
   497 	if ( isAnsYes )
       
   498 		{
       
   499 		SaveFormDataL();
       
   500 		}
       
   501 	else
       
   502 		{
       
   503 		DoNotSaveFormDataL();
       
   504 		}
       
   505 
       
   506 	return isAnsYes;
       
   507 	}
       
   508 
       
   509 /**
       
   510  * Called from QuerySaveChangesL when changes made to the form are to be saved.
       
   511  * @return TBool ETrue if the form data has been saved, EFalse otherwise
       
   512  */
       
   513 TBool ${className}::SaveFormDataL()
       
   514 	{
       
   515 	// TODO save values
       
   516 	return ETrue;
       
   517 	}
       
   518 
       
   519 /**
       
   520  * Called from QuerySaveChangesL when changes made to the form are discarded.
       
   521  */
       
   522 void ${className}::DoNotSaveFormDataL()
       
   523 	{
       
   524 	LoadFromDataL();
       
   525 	}
       
   526 
       
   527 /**
       
   528  * Called from DoNotSaveFormDataL when changes are cancelled.
       
   529  * Called from PreLayoutDynInitL to load initial values if needed.
       
   530  */
       
   531 void ${className}::LoadFromDataL()
       
   532 	{
       
   533 	// TODO load saved values	
       
   534 
       
   535 	}
       
   536 ]]>
       
   537 				</template>			
       
   538 			
       
   539 			<defineLocation id="PRELAYOUTDYNINITL" baseLocation="MAIN_FILE"
       
   540 				owned="false"
       
   541 				location="function(${className}::PreLayoutDynInitL())">
       
   542 				<template><![CDATA[
       
   543 /**
       
   544  * Initialize controls and settings before a Form is laid out.  (override)
       
   545  */
       
   546 void ${className}::PreLayoutDynInitL()
       
   547 	{
       
   548 	}
       
   549 ]]>				
       
   550 				</template>			
       
   551 			</defineLocation>
       
   552 			
       
   553 			<template location="PRELAYOUTDYNINITL"/>
       
   554 			
       
   555 			<defineLocation id="PRELAYOUTDYNINITL_BODY" baseLocation="PRELAYOUTDYNINITL"
       
   556 				location="region(Generated Contents)">
       
   557 			</defineLocation>
       
   558 
       
   559 			<template location="PRELAYOUTDYNINITL_BODY"/>
       
   560 
       
   561 			<template location="PRELAYOUTDYNINITL">
       
   562 LoadFromDataL();
       
   563 			</template>
       
   564 
       
   565 			<defineLocation id="DYNINITMENUPANEL" baseLocation="MAIN_FILE"
       
   566 				owned="false"
       
   567 				location="function(${className}::DynInitMenuPaneL(TInt, CEikMenuPane*))">
       
   568 				<template><![CDATA[
       
   569 /**
       
   570  * Called when built-in menu is displayed.  (override)
       
   571  * CAknForm has a built-in menu. In view mode, the only menu item is "Edit" that switches the form to edit mode.
       
   572  * In edit mode, the items are "Add field" "Save" "Edit label" and "Delete field"
       
   573  * The code below removes all edit mode items except for "Save"
       
   574  * To use these items, remove the appropriate lines and override the appropriate CAknForm methods.
       
   575  * (E.g., to handle "Add field" remove the line for EAknFormCmdAdd and override CAknForm::AddItemL())
       
   576  */
       
   577 void ${className}::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   578 	{
       
   579 	CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   580 	
       
   581 	if ( aResourceId == R_AVKON_FORM_MENUPANE )
       
   582 		{
       
   583 		aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue );
       
   584 		aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue );
       
   585 		aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue );
       
   586 
       
   587 		/* 
       
   588 		// sample code to add a custom item with command id 'myCommandId'
       
   589 		TInt pos;
       
   590 		if ( !aMenuPane->MenuItemExists( myCommandId, pos ) )
       
   591 			{
       
   592 			CEikMenuPaneItem::SData menuItem;
       
   593 			menuItem.iCommandId = myCommandId;
       
   594 			menuItem.iCascadeId = 0;	// set for submenus
       
   595 			menuItem.iFlags = 0;		// e.g. EEikMenuItemDimmed
       
   596 			menuItem.iText = KMyCommandIdText;
       
   597 			menuItem.iExtraText = _L("");
       
   598 			aMenuPane->AddMenuItemL( menuItem );
       
   599 			}
       
   600 		*/
       
   601 		}
       
   602 	}
       
   603 ]]>				
       
   604 				</template>			
       
   605 			</defineLocation>
       
   606 			
       
   607 			<template location="DYNINITMENUPANEL"/>
       
   608 			
       
   609 			<defineLocation id="DYNINITMENUPANEL_BODY" baseLocation="DYNINITMENUPANEL"
       
   610 				owned="true"
       
   611 				location="region(Generated Code)"/>
       
   612 				
       
   613 			<template location="DYNINITMENUPANEL_BODY"><![CDATA[
       
   614 <%	var event = instance.events['dynInitMenuPane'];
       
   615 	if (event) {%>
       
   616 ${event.handlerName}( aResourceId, aMenuPane );
       
   617 <% } %>
       
   618 ]]>			</template>
       
   619 			
       
   620 			<defineLocation id="OKTOEXITL" baseLocation="MAIN_FILE"
       
   621 				owned="false"
       
   622 				location="function(${className}::OkToExitL(TInt))">
       
   623 				<template><![CDATA[
       
   624 /**
       
   625  * Handle a button press and tell whether it closes the dialog.  (override)  
       
   626  * @param aButtonId the identifier for the button (avkon.hrh)
       
   627  */
       
   628 TBool ${className}::OkToExitL( TInt aButtonId )
       
   629 	{
       
   630 	}
       
   631 ]]>
       
   632 				</template>			
       
   633 			</defineLocation>
       
   634 			
       
   635 			<template location="OKTOEXITL"/>
       
   636 			
       
   637 			<defineLocation id="OKTOEXITL_BODY" baseLocation="OKTOEXITL"
       
   638 				location="region(Generated Code)">
       
   639 			</defineLocation>
       
   640 		
       
   641 			<inline scope="prototype">
       
   642 include("../cba/cbaLibrary.js")
       
   643 include("containerLibrary.js")
       
   644 			</inline>			
       
   645 
       
   646 			<template location="OKTOEXITL_BODY"><![CDATA[
       
   647 <% if (properties.exitsApp) { 
       
   648 	var id = findCbaRightId(instance.parent.children);
       
   649 %>
       
   650 if ( aButtonId == ${id} )
       
   651 	{
       
   652 	if ( CAknForm::OkToExitL( EAknSoftkeyBack ) )
       
   653 		{
       
   654 		iAvkonAppUi->ProcessCommandL( EEikCmdExit );
       
   655 		}
       
   656 	else
       
   657 		{
       
   658 		return EFalse;
       
   659 		}
       
   660 	}<% } %>
       
   661 ]]>			</template>	
       
   662 
       
   663 			<template location="OKTOEXITL"><![CDATA[
       
   664 // The '${lookupString("exitsApp")}' property automatically adds code to exit the 
       
   665 // application when the right soft key is pressed. If this property is set to false, 
       
   666 // and AddToStackL has been called on the Form object (e.g., it was not shown as a dialog), 
       
   667 // code must be added manually to avoid a panic when exiting the application.
       
   668 return CAknForm::OkToExitL( aButtonId );
       
   669 ]]>			</template>	
       
   670 
       
   671 			<useTemplateGroup ids="GeneratePrepareForFocusTransition GeneratePageChanged GenerateLineChanged"/>
       
   672 			<useTemplateGroup ids="GenerateProcessCommand GenerateOfferKeyToApp"/>
       
   673 			<useTemplateGroup ids="GenerateFocusChanged"/>
       
   674 			<useTemplateGroup ids="GenerateSizeChanged GeneratePositionChanged"/>
       
   675 			<useTemplateGroup ids="GenerateDraw GenerateOfferKeyEvent"/>
       
   676 			<useTemplateGroup ids="GeneratePrepareForFocusLoss GeneratePrepareForFocusGain"/>
       
   677 
       
   678 <!-- BEGIN EVENT resourceChanged -->
       
   679 			<templateGroup id="GenerateResourceChanged" ifEvents="resourceChanged">
       
   680 				<template id="DeclareResourceChangedOverride" phase="OverriddenMethods"><![CDATA[
       
   681 void HandleResourceChange( TInt aType );
       
   682 ]]>				</template>
       
   683 
       
   684 				<defineLocation id="ResourceChangedOverride" baseLocation="MAIN_FILE"
       
   685 					owned="false"
       
   686 					location="function(${handlerClassName}::HandleResourceChange(TInt))">
       
   687 					<template><![CDATA[
       
   688 /** 
       
   689  * Handle global resource changes, such as scalable UI or skin events (override)
       
   690  */
       
   691 void ${handlerClassName}::HandleResourceChange( TInt aType )
       
   692 	{
       
   693 	${instance.attributes["base-container-class"]}::HandleResourceChange( aType );
       
   694 	}
       
   695 ]]>				
       
   696 					</template>
       
   697 				</defineLocation>
       
   698 				
       
   699 			<defineLocation id="ResourceChangedBody" baseLocation="ResourceChangedOverride"
       
   700 				location="region(Generated Contents)">
       
   701 				<template/>
       
   702 			</defineLocation>
       
   703 			
       
   704 			<template id="InvokeResourceChangedHandler" location="ResourceChangedBody">
       
   705 ${event.handlerName}( aType );
       
   706 			</template>
       
   707 
       
   708 			<template id="DeclareResourceChangedHandler" phase="UserHandlers">
       
   709 void ${event.handlerName}( TInt aType );
       
   710 			</template>
       
   711 
       
   712 			<defineLocation id="ResourceChangedHandlerMethod" baseLocation="MAIN_FILE"
       
   713 				owned="false"
       
   714 				isEventHandler="true"
       
   715 				location="function(${handlerClassName}::${event.handlerName}(TInt))">
       
   716 			<template><![CDATA[
       
   717 /** 
       
   718  * Handle the ${event.eventName} event.
       
   719  */
       
   720 void ${handlerClassName}::${event.handlerName}( TInt aType )
       
   721 	{
       
   722 	// TODO: implement ${event.eventName} event handler
       
   723 	}
       
   724 ]]>				
       
   725 				</template>
       
   726 			</defineLocation>
       
   727 			
       
   728 			<template id="RealizeResourceChangedHandler" location="ResourceChangedHandlerMethod" />
       
   729 			</templateGroup>
       
   730 <!-- END EVENT resourceChanged -->		
       
   731 
       
   732 <!-- BEGIN EVENT dynInitMenuPane -->
       
   733 			<templateGroup id="GenerateDynInitMenuPaneForForm" ifEvents="dynInitMenuPane">
       
   734 
       
   735 			<template id="DeclareDynInitMenuPaneHandler" phase="UserHandlers">
       
   736 void ${event.handlerName}( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   737 			</template>
       
   738 
       
   739 			<defineLocation id="DynInitMenuPaneHandlerMethod" baseLocation="MAIN_FILE"
       
   740 				owned="false"
       
   741 				isEventHandler="true"
       
   742 				location="function(${handlerClassName}::${event.handlerName}(TInt, CEikMenuPane*))">
       
   743 			<template><![CDATA[
       
   744 /** 
       
   745  * Handle the ${event.eventName} event.
       
   746  */
       
   747 void ${handlerClassName}::${event.handlerName}( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   748 	{
       
   749 	// TODO: implement ${event.eventName} event handler
       
   750 	}
       
   751 ]]>				
       
   752 				</template>
       
   753 			</defineLocation>
       
   754 			
       
   755 			<template id="RealizeDynInitMenuPaneHandler" location="DynInitMenuPaneHandlerMethod" />
       
   756 			</templateGroup>
       
   757 <!-- END EVENT dynInitMenuPane -->
       
   758 
       
   759 			
       
   760 			<!-- gather child contributions -->
       
   761 
       
   762 			<inline scope="prototype">
       
   763 			include("../srcgenLibrary.js");
       
   764 			</inline>
       
   765 
       
   766 			<inline scope="prototype"><![CDATA[
       
   767 ${jsObject}.prototype.gatherFormLineImageContribs = function(contribs, instance) {
       
   768 	var contrib;
       
   769 
       
   770 	var any = false;	
       
   771 	for (var c in instance.children) {
       
   772 		var child = instance.children[c];
       
   773 		if (!child.component.attributes["is-form-content"])
       
   774 			continue;
       
   775 		var enm = Engine.findBuiltinOrGeneratedEnumeratorForAlgorithm(
       
   776 			child, ".", "com.nokia.sdt.component.symbian.NAME_ALG_DIALOG_LINE_ID");
       
   777 		if (enm != null && isImagePropertySet(child.properties.promptImage)) {
       
   778 
       
   779 			if (!any) {
       
   780 				contrib = Engine.createContributionForPhase("MainSystemIncludes");
       
   781 				contrib.setText("#include <eikcapc.h>\n");
       
   782 				contribs.add(contrib);
       
   783 			
       
   784 				contrib = Engine.createContributionForPhase("PostInitialize");
       
   785 				contrib.setText("CEikCaptionedControl* theLine;\n");
       
   786 				contribs.add(contrib);
       
   787 			
       
   788 				any = true;
       
   789 			}
       
   790 		
       
   791 			contrib = Engine.createContributionForPhase("PostInitialize");
       
   792 			contrib.setFormattedText("theLine = Line( {1} );\n",
       
   793 				[ instance.memberName, enm ]);
       
   794 			contribs.add(contrib);
       
   795 			
       
   796 			setupImageFromPropertyViaTuple(contribs, child,	"PostInitialize", null, 0,
       
   797 				child.properties.promptImage,
       
   798 				"theLine->SetBitmapFromFileL( {0}, {1} );\n",
       
   799 				"theLine->SetBitmapFromFileL( {0}, {1}, {2} );\n");
       
   800 		}
       
   801 	}		
       
   802 }
       
   803 
       
   804 ]]>			</inline>
       
   805 
       
   806 			<inline>
       
   807 
       
   808 
       
   809 			if (form != 'RootAppUi') {
       
   810 				
       
   811 				if (Engine.formMatches(form, [ "AknView", "AppUi" ])) {
       
   812 					// clear out any image stuff
       
   813 					resetImagePropertyState(instance);
       
   814 
       
   815 					// get default and dialog-specific contributions
       
   816 					contribs.addAll(Engine.generateChildContributions(form+"|Dialog"))
       
   817 			
       
   818 					// set images dynamically		
       
   819 					this.gatherFormLineImageContribs(contribs, instance);
       
   820 					
       
   821 				} else {
       
   822 					// get specific desired contributions
       
   823 					contribs.addAll(Engine.generateChildContributions(form))
       
   824 				}
       
   825 				
       
   826 				Engine.collateContributionsByPhase(contribs, ["Initialize", "PostInitialize"]);
       
   827 				
       
   828 				// fix up the phases so they point to real locations
       
   829 				Engine.assignLocationsForPhase(contribs, "ClassSource", "MAIN_FILE");
       
   830 				Engine.assignLocationsForPhase(contribs, "ClassHeader", "HEADER_FILE");
       
   831 
       
   832 				Engine.assignLocationsForPhase(contribs, "MainConstants", "CONSTANTS");
       
   833 				Engine.assignLocationsForPhase(contribs, "MainSystemIncludes", "MAIN_SYSTEM_INCLUDES");
       
   834 				Engine.assignLocationsForPhase(contribs, "MainUserIncludes", "MAIN_USER_INCLUDES");
       
   835 				Engine.assignLocationsForPhase(contribs, "Construct", "CONSTRUCTOR_BODY");
       
   836 				Engine.assignLocationsForPhase(contribs, "Initialize", "PRELAYOUTDYNINITL_BODY");
       
   837 				Engine.assignLocationsForPhase(contribs, "PostInitialize", "PRELAYOUTDYNINITL_BODY");
       
   838 				Engine.assignLocationsForPhase(contribs, "Destroy", "DESTRUCTOR_BODY");
       
   839 				Engine.assignLocationsForPhase(contribs, "ClassTypeDeclarations", "CLASS_TYPES");
       
   840 				Engine.assignLocationsForPhase(contribs, "BaseClassList", "BASE_CLASS_LIST");
       
   841 				Engine.assignLocationsForPhase(contribs, "OverriddenMethods", "CLASS_OVERRIDES");
       
   842 				Engine.assignLocationsForPhase(contribs, "UserHandlers", "CLASS_USERHANDLERS");
       
   843 				Engine.assignLocationsForPhase(contribs, "EventIncludes", "EVENT_INCLUDES");
       
   844 				
       
   845 				Engine.assignLocationsForPhase(contribs, "HeaderIncludes", "HEADER_INCLUDES");
       
   846 				Engine.assignLocationsForPhase(contribs, "ForwardDeclarations", "HEADER_FORWARD_DECLARATIONS");
       
   847 				Engine.assignLocationsForPhase(contribs, "InstanceVariables", "CLASS_IVARS");
       
   848 				Engine.assignLocationsForPhase(contribs, "ClassMethods", "CLASS_METHODS");
       
   849 	
       
   850 				//Engine.removeDuplicateContributionsForLocation(contribs, "HEADER_INCLUDES");
       
   851 				Engine.removeDuplicateContributionsForLocation(contribs, "HEADER_FORWARD_DECLARATIONS");
       
   852 				//Engine.removeDuplicateContributionsForLocation(contribs, "MAIN_SYSTEM_INCLUDES");
       
   853 				//Engine.removeDuplicateContributionsForLocation(contribs, "MAIN_USER_INCLUDES");
       
   854 				Engine.removeDuplicateContributionsForLocation(contribs, "DESTRUCTOR_BODY");
       
   855 			}
       
   856 						
       
   857 			</inline>
       
   858 
       
   859 			<template id="IncludeRsgFile" location="MAIN_SYSTEM_INCLUDES"><![CDATA[
       
   860 #include <${resourceFileNameBase}.rsg>
       
   861 ]]>			</template>
       
   862 
       
   863 			<!-- contributions as child  -->
       
   864 
       
   865 			<template form="AknView" phase="MainUserIncludes">
       
   866 #include "${instanceName}.h"
       
   867 			</template>
       
   868 
       
   869 			<template form="AknView" phase="ForwardDeclarations">
       
   870 class ${className};
       
   871 			</template>
       
   872 
       
   873 			<template form="AknView" phase="InstanceVariables">
       
   874 ${className}* ${instanceMemberName};
       
   875 			</template>
       
   876 
       
   877 			<template form="AknView" phase="DoActivateL"><![CDATA[
       
   878 if ( ${instanceMemberName} == NULL )
       
   879 	{
       
   880 	${className}* form = ${className}::NewL( this );
       
   881 	form->SetMopParent( this ); <%
       
   882 if ( properties.wait ) {
       
   883 	var sb = newStatusBuilder();
       
   884 	sb.add(IStatus.ERROR, lookupString("waitPropertySetInView"), [ instanceName ]);
       
   885 	logStatus(sb.createStatus("", null));
       
   886 	} %>
       
   887 	form->ExecuteLD( ${resourceName$upper} );
       
   888 	AppUi()->AddToStackL( *this, form );
       
   889 	${instanceMemberName} = form;
       
   890 	} 
       
   891 ]]>			</template>
       
   892 			
       
   893 			<template form="AknView" phase="DoDeactivate">
       
   894 if ( ${instanceMemberName} != NULL )
       
   895 	{
       
   896 	AppUi()->RemoveFromStack( ${instanceMemberName} );
       
   897 	delete ${instanceMemberName};
       
   898 	${instanceMemberName} = NULL;
       
   899 	}
       
   900 			</template>
       
   901 
       
   902 
       
   903 			<template form="RootAppUi" phase="MainUserIncludes">
       
   904 #include "${instanceName}.h"
       
   905 			</template>
       
   906 
       
   907 			<template form="RootAppUi" phase="ForwardDeclarations">
       
   908 class ${className};
       
   909 			</template>
       
   910 
       
   911 			<template form="RootAppUi" phase="InstanceVariables">
       
   912 ${className}* ${instanceMemberName};
       
   913 			</template>
       
   914 
       
   915 			<template form="RootAppUi" phase="Initialize"><![CDATA[
       
   916 <% if (resourceName != null) { %>
       
   917 ${instanceMemberName} = ${className}::NewL( this );
       
   918 ${instanceMemberName}->SetMopParent( this );
       
   919 ${instanceMemberName}->ExecuteLD( ${resourceName$upper} );
       
   920 AddToStackL( ${instanceMemberName} );
       
   921 <% } %>
       
   922 ]]>			</template>
       
   923 
       
   924 			<template form="RootAppUi" phase="Destroy">
       
   925 if ( ${instanceMemberName} != NULL )
       
   926 	{
       
   927 	RemoveFromStack( ${instanceMemberName} );
       
   928 	delete ${instanceMemberName};
       
   929 	${instanceMemberName} = NULL;
       
   930 	}
       
   931 			</template>
       
   932 
       
   933 		</sourceGen>
       
   934 
       
   935 	</component>
       
   936 </componentDefinition>