uidesigner/com.nokia.sdt.series60.componentlibrary/components/transient/StylusPopupItem.component
author Deepak Modgil <Deepak.Modgil@Nokia.com>
Fri, 03 Apr 2009 23:33:03 +0100
changeset 0 fb279309251b
permissions -rw-r--r--
DP tools release version Revision: 200912

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -->
<!-- All rights reserved. -->
<!-- This component and the accompanying materials are made available -->
<!-- under the terms of the License "Eclipse Public License v1.0" -->
<!-- which accompanies this distribution, and is available -->
<!-- at the URL "http://www.eclipse.org/legal/epl-v10.html". -->

<componentDefinition xmlns="http://www.nokia.com/sdt/emf/component" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	
	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.StylusPopupMenuItemCommands">
		<enumElement value="UNIQUE"/>
	</enumPropertyDeclaration>
	
	<component baseComponent="com.nokia.sdt.series60.ControlBase" 
		friendlyName="%friendlyName" 
		qualifiedName="com.nokia.sdt.series60.StylusPopupItem" 
		category="Menu"
		instanceNameRoot="stylusPopupItem"
		version="1.0">
		
		<documentation>
			<information>%information</information>
		</documentation>
		
		<symbian sdkName="com.nokia.series60" minSDKVersion="3.2" 
			className="CAknStylusPopUpMenu" classHelpTopic=""
			resourceType="STYLUS_POPUP_MENU_ITEM" resourceHelpTopic="" />
		
		<designerImages 
			smallIconFile="StylusPopupItem_sm.png" 
			largeIconFile="StylusPopupItem.png" />
		
		<attributes>
			<attribute key="never-add-component">true</attribute>
		</attributes>
		
		<properties>
			<property category="Appearance" name="textItem" type="localizedString"
			     descriptionKey="textItemDescription" displayName="%menuItemText"/>
			<!-- no text property -->
			<enumProperty category="Hidden" name="command" 
				type="com.nokia.sdt.series60.StylusPopupMenuItemCommands" 
				descriptionKey="commandDescription" />
		</properties>
		
		<implementations>
			<implementation>
			    <interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
			    <interface id="com.nokia.sdt.datamodel.adapter.IDirectLabelEdit"/>
				<script file="StylusPopupItem.js" prototype="StylusPopupItem"/>
			</implementation>
		</implementations>
		
		<propertyOverrides>
				<propertyOverride name="size" category="Hidden"/>
				<propertyOverride name="location" category="Hidden"/>
		</propertyOverrides>
		
		<events defaultEventName="selected">
		<event name="selected" displayName="%selected" category="Menu" 
		    handlerNameTemplate="Handle{title(name)}SelectedL"
		    descriptionKey="selectedDescription"
		/>
		</events>
		
		<sourceMapping>
			<mapResource struct="STYLUS_POPUP_MENU_ITEM" headers="eikon.rh">
			<select property="[com.nokia.sdt.series60.StylusPopup]">
					<choice value="">
						<select property="command">
							<choice value="NONE" />
								<choice>
									<mapEnumMember property="command" member="command" uniqueValue="UNIQUE"
										nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_COMMANDS"/>
							</choice>
						</select>
					</choice>
			</select>
			<mapSimpleMember property="textItem" member="txt"/>
			</mapResource>
		</sourceMapping>
		
		<sourceGen>	
			
			<templateGroup id="HandleSelectedEvent" ifEvents="selected">
			<template id="0" phase="UserHandlers">
TBool ${event.handlerName}( TInt aCommand );
			</template>

			<defineLocation id="SelectedMethod" baseLocation="MAIN_FILE"
					owned="false"
					isEventHandler="true"
					location="function(${handlerClassName}::${event.handlerName}(TInt))">
					<template id="2"><![CDATA[
/** 
 * Handle the ${event.eventName} event.
 * @param aCommand the command id invoked
 * @return ETrue if the command was handled, EFalse if not
 */
TBool ${handlerClassName}::${event.handlerName}( TInt aCommand )
	{
	// TODO: implement ${event.eventName} event handler
	return ETrue;
	}
]]>				
					</template>
				</defineLocation>
			
			<template id="3" location="SelectedMethod" />
	
			<template id="4" form="HandleCommandSwitchDispatch" phase="SwitchContents" ifEvents="selected"><![CDATA[
<% var commandId = Engine.findBuiltinOrGeneratedEnumeratorForAlgorithm(instance, "command", "com.nokia.sdt.component.symbian.NAME_ALG_COMMANDS");
	if (commandId != null) { 
%>	case ${commandId}:
		commandHandled = ${event.handlerName}( aCommand );
		break;
<% } %> ]]>	</template>
		</templateGroup>
			
		</sourceGen>
		
	</component>
	
	
</componentDefinition>