uidesigner/com.nokia.sdt.series60.componentlibrary/components/toolbar/Toolbar.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:xsi="http://www.w3.org/2001/XMLSchema-instance">
       
    11 	
       
    12 	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.toolbar.orientation"  defaultValue="Horizontal ">
       
    13 		<enumElement value="Horizontal"/>
       
    14 		<enumElement value="Vertical"/>
       
    15 	</enumPropertyDeclaration>
       
    16 	
       
    17 	<component baseComponent="com.nokia.sdt.series60.ControlBase"
       
    18 		friendlyName="%friendlyName" 
       
    19 		qualifiedName="com.nokia.sdt.series60.Toolbar" 
       
    20 		category="Controls"
       
    21 		instanceNameRoot="toolBar"
       
    22 		version="1.0">
       
    23 		
       
    24 		<documentation>
       
    25 			<information>%information</information>
       
    26 		</documentation>
       
    27 		
       
    28 		<symbian sdkName="com.nokia.series60" minSDKVersion="5.0" 
       
    29 			className="CAknToolbar" classHelpTopic=""
       
    30 			resourceType="AVKON_TOOLBAR" resourceHelpTopic="" />
       
    31 		
       
    32 		<designerImages smallIconFile="Toolbar_sm.png" 
       
    33 			largeIconFile="Toolbar.png" />
       
    34 			
       
    35 		<attributes>
       
    36 			<attribute key="cpp-class-name">CAknToolbar</attribute>
       
    37 			<attribute key="is-layout-container">true</attribute>
       
    38 			<attribute key="layout-type">ordered</attribute>
       
    39 			<attribute key="is-non-resizable-or-moveable-layout-object">true</attribute>
       
    40 		</attributes>	
       
    41 		
       
    42 		<properties>		
       
    43 			<enumProperty category="Appearance" name="orientation" type="com.nokia.sdt.toolbar.orientation" descriptionKey="orientationDescr" default="Horizontal" />
       
    44 			<property category="Appearance" name="smallToolbar" type="boolean" descriptionKey="smallToolbarDescr" />
       
    45 			<property category="Appearance" name="transparent" type="boolean" descriptionKey="transparentDescr" />
       
    46 			<property category="Appearance" name="flexiblePosition" type="boolean" descriptionKey="flexPosDescr" />
       
    47 			<property category="Appearance" name="hasControlPane" type="boolean" descriptionKey="hasControlPaneDescr" default="true" />
       
    48 			<property category="Appearance" name="rememberLastSelection" type="boolean" descriptionKey="memLastSelDescr" />
       
    49 			<property category="Appearance" name="middleItemFocused" type="boolean" descriptionKey="middleItemFocusDescr" />
       
    50 						
       
    51 		</properties>
       
    52 		
       
    53 		<implementations>
       
    54 			<implementation>
       
    55 				<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
       
    56 				<interface id="com.nokia.sdt.datamodel.adapter.ILayout"/>
       
    57 				<interface id="com.nokia.sdt.datamodel.adapter.IQueryContainment"/>
       
    58 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentInstancePropertyListener"/>
       
    59 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentValidator"/>
       
    60 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentInstanceChildListener"/>
       
    61 				<script file="Toolbar.js" prototype="CAknToolbar"/>
       
    62 			</implementation>
       
    63 			<implementation>
       
    64 				<interface id="com.nokia.sdt.displaymodel.adapter.ITargetFeedbackListener"/>
       
    65 				<code class="com.nokia.sdt.series60.component.ToolbarTargetFeedbackListenerImplFactory"/>
       
    66 			</implementation>
       
    67 		</implementations>
       
    68 		
       
    69 		<sourceMapping>
       
    70 			<mapResource struct="AVKON_TOOLBAR" headers="eikon.rh">
       
    71 				<mapBitmaskMember property="." member="flags"
       
    72 				  includedProperties="smallToolbar transparent flexiblePosition hasControlPane middleItemFocused rememberLastSelection">
       
    73 					<mapBitmaskValue properties="smallToolbar" value="KAknToolbarSmall" />
       
    74 					<mapBitmaskValue properties="transparent" value="KAknToolbarTransparent" />
       
    75 					<mapBitmaskValue properties="flexiblePosition" value="KAknToolbarFlexiblePosition" />
       
    76 					<mapBitmaskValue properties="hasControlPane" value="KAknToolbarWithoutCba" />
       
    77 					<mapBitmaskValue properties="middleItemFocused" value="KAknToolbarMiddleItemFocused" />
       
    78 					<mapBitmaskValue properties="rememberLastSelection" value="KAknToolbarLastUsedItemFocused" />
       
    79 				</mapBitmaskMember>
       
    80 				
       
    81 				<!-- Map the toolbar items, if required -->
       
    82 				<mapArrayMember property="." member="items">
       
    83   					<select isComponentInstanceOf="com.nokia.sdt.series60.CAknButton">
       
    84       					<choice value="true">
       
    85       						<!-- map the button to the toolbar -->
       
    86 	      					<mapResource struct="TBAR_CTRL" id="toolBarButton" headers="eikon.rh">
       
    87 	      						<mapSimpleMember property="toolBarType" member="type"/>
       
    88 	      						<mapEnumMember property="command" member="id" uniqueValue="UNIQUE"
       
    89 											nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_COMMANDS"/>
       
    90 	      						<mapResourceMember property="." member="control"/>
       
    91 	      					</mapResource>
       
    92       					</choice>
       
    93       					<choice>
       
    94       						<!-- else, don't map this resource -->
       
    95       					</choice>
       
    96   					</select>
       
    97 				</mapArrayMember>
       
    98 
       
    99 			</mapResource>
       
   100 			
       
   101 		</sourceMapping>
       
   102 		
       
   103 		<sourceGen>
       
   104 			
       
   105 			<template phase="HeaderIncludes"><![CDATA[
       
   106 #include <aknutils.h>
       
   107 #include <akntoolbar.h>
       
   108 ]]>			</template>
       
   109 <template phase="EventIncludes"><![CDATA[
       
   110 #include <AknToolbarObserver.h>
       
   111 ]]>			</template>
       
   112 		
       
   113 			
       
   114 			<template phase="Initialize">
       
   115 if( AknLayoutUtils::PenEnabled() &amp;&amp; Toolbar() ) 
       
   116 	{
       
   117 	//By default keep toolbar invisible        
       
   118 	ShowToolbarOnViewActivation( ETrue ); 
       
   119 	Toolbar()-&gt;SetToolbarObserver( this );
       
   120 	}		
       
   121 				</template>
       
   122 			
       
   123 			<template id="BaseClass" phase="BaseClassList">,MAknToolbarObserver</template>
       
   124 			
       
   125 			<expandMacro name="GenerateMethodWithOwnedBody"
       
   126 					IsOwned="false"
       
   127 					FunctionLocationId="DYNINITTOOLBARL_METHOD"
       
   128 					FunctionName="DynInitToolbarL"
       
   129 					FunctionArgs="TInt aResourceId, CAknToolbar* aToolBar"
       
   130 					IsStatic="false"
       
   131 					DeclPhase="ClassPublic"
       
   132 					DefnLocation="MAIN_FILE">
       
   133 				<expandArgument name="FunctionComment">
       
   134 /**
       
   135  * Should be used to set the properties of some toolbar components 
       
   136  * before it is drawn.
       
   137  * @param aResourceId The resource ID for particular toolbar
       
   138  * @param aToolbar The toolbar object pointer
       
   139  */
       
   140 				</expandArgument>				
       
   141 			</expandMacro>
       
   142 
       
   143 			<template location="DYNINITTOOLBARL_METHOD_BODY"><![CDATA[
       
   144 <% if (properties.orientation == "Vertical") { %>Toolbar()->SetOrientation( EAknOrientationVertical );
       
   145 <% } %>	
       
   146 <%	// generate dynamic initialization for child component
       
   147 	var itemContribs = Engine.generateChildContributions("AknToolbar");
       
   148 	Engine.assignLocationsForPhase(itemContribs, "InitToolbarItems", "DYNINITTOOLBARL_METHOD_BODY");
       
   149 	contribs.addAll(itemContribs);
       
   150 %>
       
   151 ]]>			</template>
       
   152 			<expandMacro name="GenerateMethod"
       
   153 					IsOwned="false"
       
   154 					FunctionLocationId="OFFERTOOLBAREVENTL_METHOD"
       
   155 					FunctionName="OfferToolbarEventL"
       
   156 					FunctionArgs="TInt aCommandId"
       
   157 					IsStatic="false"
       
   158 					DeclPhase="ClassPublic"
       
   159 					DefnLocation="MAIN_FILE">
       
   160 				<expandArgument name="FunctionComment">
       
   161 /**
       
   162  * Handles toolbar events for a certain toolbar item.
       
   163  * @param aCommand The command ID of some toolbar item.
       
   164  */
       
   165 				</expandArgument>				
       
   166 				<expandArgument name="FunctionBody"><![CDATA[
       
   167 HandleCommandL( aCommandId );
       
   168 			]]>	</expandArgument>
       
   169 			</expandMacro>
       
   170 
       
   171 		
       
   172 			<!-- child contributions -->
       
   173 			<inline scope="prototype">
       
   174 include("../containers/containerLibrary.js")
       
   175 			</inline>
       
   176 					
       
   177 			<inline>
       
   178 			
       
   179 				// Emit the toolbar item uids.
       
   180 				for (i in instance.children) {
       
   181 					var view = instance.children[i];
       
   182 					//println(view);
       
   183 					var theEnum = findOrCreateViewUidConstant(view);
       
   184 				}
       
   185 				
       
   186 				// iterate children
       
   187 				contribs.addAll(Engine.generateChildContributions(form))
       
   188 				
       
   189 			</inline>
       
   190 		
       
   191 		</sourceGen>
       
   192 			
       
   193 	</component>
       
   194 
       
   195 </componentDefinition>