uidesigner/com.nokia.sdt.series60.componentlibrary/components/controls/CAknButton.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.series60.ButtonToolbarItemCommands">
       
    13 		<enumElement value="UNIQUE"/>
       
    14 	</enumPropertyDeclaration>
       
    15 	
       
    16 	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.CAknButton.HorizTextAlign" defaultValue="CGraphicsContext::ECenter">
       
    17 		<enumElement value="CGraphicsContext::ECenter" displayValue="center" />
       
    18 		<enumElement value="CGraphicsContext::ELeft" displayValue="left" />
       
    19 		<enumElement value="CGraphicsContext::ERight" displayValue="right" />
       
    20 	</enumPropertyDeclaration>
       
    21 	
       
    22 	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.CAknButton.ToolTipPosition" defaultValue="CAknButton::EPositionTop">
       
    23 		<enumElement value="CAknButton::EPositionTop" displayValue="top" />
       
    24 		<enumElement value="CAknButton::EPositionBottom" displayValue="bottom" />
       
    25 		<enumElement value="CAknButton::EPositionLeft" displayValue="left" />
       
    26 		<enumElement value="CAknButton::EPositionRight" displayValue="right" />
       
    27 	</enumPropertyDeclaration>
       
    28 	
       
    29 	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.CAknButton.TextAndIconAlignment" defaultValue="CAknButton::EIconBeforeText">
       
    30 		<enumElement value="CAknButton::EIconBeforeText" displayValue="icon before text" />
       
    31 		<enumElement value="CAknButton::EIconAfterText" displayValue="icon after text" />
       
    32 		<enumElement value="CAknButton::EIconUnderText" displayValue="icon under text" />
       
    33 		<enumElement value="CAknButton::EIconOverText" displayValue="icon over text" />
       
    34 		<enumElement value="CAknButton::EOverlay" displayValue="overlay" />
       
    35 	</enumPropertyDeclaration>
       
    36 	
       
    37 	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.CAknButton.VertTextAlign" defaultValue="CAknButton::ECenter">
       
    38 		<enumElement value="CAknButton::ECenter" displayValue="center" />
       
    39 		<enumElement value="CAknButton::ETop" displayValue="top" />
       
    40 		<enumElement value="CAknButton::EBottom" displayValue="bottom" />
       
    41 	</enumPropertyDeclaration>
       
    42 	
       
    43 	<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.CAknButton.Font" defaultValue="normal">
       
    44 		<enumElement value="normal" displayValue="normal" />
       
    45 		<enumElement value="CEikonEnv::Static()-&gt;LegendFont()" displayValue="legend" />
       
    46 		<enumElement value="CEikonEnv::Static()-&gt;DenseFont()" displayValue="dense" />
       
    47 		<enumElement value="CEikonEnv::Static()-&gt;SymbolFont()" displayValue="symbol" />
       
    48 		<enumElement value="CEikonEnv::Static()-&gt;TitleFont()" displayValue="title" />
       
    49 		<enumElement value="CEikonEnv::Static()-&gt;AnnotationFont()" displayValue="annotation" />
       
    50 	</enumPropertyDeclaration>
       
    51 	
       
    52 	<compoundPropertyDeclaration 
       
    53 		qualifiedName="com.nokia.sdt.series60.CAknButtonMultiImageProperty"
       
    54 		editorClass="com.nokia.sdt.symbian.ui.editors.ImageEditorFactory"
       
    55 		converterClass="com.nokia.sdt.series60.component.CAknButtonMultiImagePropertyConverter">
       
    56 		<property name="bmpfile" descriptionKey="bmpfileDescription" type="string"/>
       
    57 		<property name="bmpid" descriptionKey="bmpidDescription" type="string"/>
       
    58 		<property name="bmpmask" descriptionKey="bmpmaskDescription" type="string"/>
       
    59 		<property name="bmpidDimmed" descriptionKey="bmpidDimmedDescription" type="string"/>
       
    60 		<property name="bmpmaskDimmed" descriptionKey="bmpmaskDimmedDescription" type="string"/>
       
    61 		<property name="bmpidPressed" descriptionKey="bmpidPressedDescription" type="string"/>
       
    62 		<property name="bmpmaskPressed" descriptionKey="bmpmaskPressedDescription" type="string"/>
       
    63 		<property name="bmpidHover" descriptionKey="bmpidHoverDescription" type="string"/>
       
    64 		<property name="bmpmaskHover" descriptionKey="bmpmaskHoverDescription" type="string"/>
       
    65 	</compoundPropertyDeclaration>
       
    66 	
       
    67 	
       
    68 	<component baseComponent="com.nokia.sdt.series60.CCoeControlBase" 
       
    69 		friendlyName="%friendlyName" 
       
    70 		qualifiedName="com.nokia.sdt.series60.CAknButton"
       
    71 		category="Controls"
       
    72 		instanceNameRoot="button"
       
    73 		version="1.0">
       
    74 		<documentation>
       
    75 			<information>%information</information>
       
    76 		</documentation>
       
    77 		<symbian sdkName="com.nokia.series60" minSDKVersion="5.0" 
       
    78 			className="CAknButton" classHelpTopic=""
       
    79 			resourceType="" resourceHelpTopic="" />
       
    80 		<designerImages smallIconFile="CAknButton_sm.png" 
       
    81 			largeIconFile="CAknButton.png" />
       
    82 			
       
    83 		<attributes>
       
    84 			<attribute key="cpp-class-name">CAknButton</attribute>
       
    85 			<attribute key="is-ccoecontrol-content">true</attribute>
       
    86 			<attribute key="editable-array-property">items</attribute>
       
    87 		</attributes>
       
    88 		
       
    89 		<properties>
       
    90 			
       
    91 			<property category="Text" name="buttonText" type="localizedString" default="Button"
       
    92 				 editorClass="com.nokia.sdt.symbian.ui.editors.ScalableTextEditorFactory"
       
    93 			     descriptionKey="buttonTextDescription" displayName="%buttonTextDisplay"/>
       
    94 			 <property category="Text" name="buttonHelpText" type="localizedString" default="Button Hover Text"
       
    95 				 editorClass="com.nokia.sdt.symbian.ui.editors.ScalableTextEditorFactory"
       
    96 			     descriptionKey="buttonHelpTextDescription" displayName="%buttonHelpTextDisplay"/>
       
    97 			 <enumProperty category="Text" name="horizTextAlign" type="com.nokia.sdt.series60.CAknButton.HorizTextAlign"
       
    98 				descriptionKey="horizTextAlignDescr" displayName="%horizTextAlign" />
       
    99 			<enumProperty category="Text" name="vertTextAlign" type="com.nokia.sdt.series60.CAknButton.VertTextAlign"
       
   100 				descriptionKey="vertTextAlignDescr" displayName="%vertTextAlign" />
       
   101 			<enumProperty category="Text" name="toolTipPosition" type="com.nokia.sdt.series60.CAknButton.ToolTipPosition"
       
   102 				descriptionKey="toolTipPositionDescr" displayName="%toolTipPosition" />
       
   103 			<enumProperty category="Text" name="textAndIconAlignment" type="com.nokia.sdt.series60.CAknButton.TextAndIconAlignment"
       
   104 				descriptionKey="textAndIconAlignmentDescr" displayName="%textAndIconAlignment" />
       
   105 			<enumProperty category="Text" name="textFont" type="com.nokia.sdt.series60.CAknButton.Font"
       
   106 				descriptionKey="textFontDescr" displayName="%textFont" />
       
   107 			<compoundProperty category="Image" name="images"  
       
   108 				type="com.nokia.sdt.series60.CAknButtonMultiImageProperty"
       
   109 				descriptionKey="imagesDescription" />
       
   110 			
       
   111 			<property category="Flags" name="buttonTextLeft" type="boolean" descriptionKey="buttonTextLeftDescr" />
       
   112 			<property category="Flags" name="buttonSizeFitText" type="boolean" descriptionKey="buttonSizeFitTextDescr" />
       
   113 			<property category="Flags" name="buttonNoFrame" type="boolean" descriptionKey="buttonNoFrameDescr" />
       
   114 			<property category="Flags" name="buttonKeyRepeat" type="boolean" descriptionKey="buttonKeyRepeatDescr" />
       
   115 			<property category="Flags" name="buttonReportOnKeyDown" type="boolean" descriptionKey="buttonReportOnKeyDownDescr" />
       
   116 			<property category="Flags" name="buttonNoFramePressEvent" type="boolean" descriptionKey="buttonNoFramePressEventDescr" />
       
   117 			<property category="Flags" name="buttonRequestExitOnButtonUpEvent" type="boolean" descriptionKey="buttonRequestExitOnButtonUpEventDescr" />
       
   118 			<property category="Flags" name="buttonReportOnLongPress" type="boolean" descriptionKey="buttonReportOnLongPressDescr" />
       
   119 			
       
   120 			<!-- Hidden commands used to fill out the TBAR_CTRL 'type' and 'id' members -->
       
   121 			<property category="Hidden" name="toolBarType" type="string" default="EAknCtButton"/>
       
   122 			<enumProperty category="Hidden" name="command" 
       
   123 				type="com.nokia.sdt.series60.ButtonToolbarItemCommands" 
       
   124 				descriptionKey="commandDescription" />
       
   125 							
       
   126 		</properties>
       
   127 		
       
   128 		<implementations>
       
   129 			<implementation>
       
   130 				<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
       
   131 				<interface id="com.nokia.sdt.datamodel.adapter.IDirectImageEdit"/>
       
   132 				<interface id="com.nokia.sdt.datamodel.adapter.IDirectLabelEdit"/>
       
   133 				<interface id="com.nokia.sdt.datamodel.adapter.IComponentEventInfo"/>
       
   134 				<interface id="com.nokia.sdt.datamodel.adapter.IImagePropertyRenderingInfo"/>
       
   135 				<script file="CAknButton.js" prototype="CAknButton"/>
       
   136 			</implementation>
       
   137 		</implementations>
       
   138 		
       
   139 		<events defaultEventName="selected">
       
   140 			<event name="selected" displayName="%selected" category="ToolbarEvent"
       
   141 				group="ToolbarEvent" 
       
   142 			    handlerNameTemplate="Handle{title(name)}SelectedL"
       
   143 			    descriptionKey="selectedDescription"
       
   144 			/>
       
   145 		</events>
       
   146 		
       
   147 		<sourceMapping>
       
   148 		
       
   149 			<mapResource struct="AVKON_BUTTON" headers="eikon.rh">
       
   150 				
       
   151 				<mapBitmaskMember property="." member="flags"
       
   152 				  includedProperties="buttonTextLeft buttonSizeFitText buttonNoFrame buttonKeyRepeat buttonReportOnKeyDown buttonNoFramePressEvent buttonRequestExitOnButtonUpEvent buttonReportOnLongPress">
       
   153 					<mapBitmaskValue properties="buttonTextLeft" value="KAknButtonTextLeft" />
       
   154 					<mapBitmaskValue properties="buttonSizeFitText" value="KAknButtonSizeFitText" />
       
   155 					<mapBitmaskValue properties="buttonNoFrame" value="KAknButtonNoFrame" />
       
   156 					<mapBitmaskValue properties="buttonKeyRepeat" value="KAknButtonKeyRepeat" />
       
   157 					<mapBitmaskValue properties="buttonReportOnKeyDown" value="KAknButtonReportOnKeyDown" />
       
   158 					<mapBitmaskValue properties="buttonNoFramePressEvent" value="KAknButtonNoFramePressEvent" />
       
   159 					<mapBitmaskValue properties="buttonRequestExitOnButtonUpEvent" value="KAknButtonRequestExitOnButtonUpEvent" />
       
   160 					<mapBitmaskValue properties="buttonReportOnLongPress" value="KAknButtonReportOnLongPress" />
       
   161 				</mapBitmaskMember>
       
   162 				
       
   163 				 <mapResourceMember property="." member="states[0]" 
       
   164 		        		struct="AVKON_BUTTON_STATE" headers="eikon.rh" id="multi$states[0]" >
       
   165 		        		
       
   166 		        		<mapSimpleMember property="buttonText" member="txt"/>
       
   167 						<mapSimpleMember property="buttonHelpText" member="helptxt"/>
       
   168 						<mapSimpleMember property="images.bmpfile" member="bmpfile"/>
       
   169 						
       
   170 						<mapIdentifierMember property="images.bmpid" member="bmpid"/>
       
   171 						<mapIdentifierMember property="images.bmpmask" member="bmpmask"/>
       
   172     					
       
   173     					// stupid header doesn't initialize bmpmask to -1
       
   174 						<select property="images.bmpmask">
       
   175 							<choice value="">
       
   176 								<mapFixedMember member="bmpmask" value="-1"/>
       
   177 							</choice>
       
   178 							<choice>
       
   179 								<mapIdentifierMember property="images.bmpmask" member="bmpmask"/>
       
   180 							</choice>
       
   181 						</select>
       
   182     				
       
   183 					 	<select property="images.bmpmaskDimmed">
       
   184 							<choice value="">
       
   185 								<mapFixedMember member="dim_bmpmask" value="-1"/>
       
   186 							</choice>
       
   187 							<choice>
       
   188 								<mapIdentifierMember property="images.bmpmaskDimmed" member="dim_bmpmask"/>
       
   189 							</choice>
       
   190 						</select>
       
   191 					 
       
   192 					 	<select property="images.bmpmaskPressed">
       
   193 							<choice value="">
       
   194 								<mapFixedMember member="press_bmpmask" value="-1"/>
       
   195 							</choice>
       
   196 							<choice>
       
   197 								<mapIdentifierMember property="images.bmpmaskPressed" member="press_bmpmask"/>
       
   198 							</choice>
       
   199 						</select>
       
   200 					 
       
   201 					 	<select property="images.bmpmaskHover">
       
   202 							<choice value="">
       
   203 								<mapFixedMember member="hover_bmpmask" value="-1"/>
       
   204 							</choice>
       
   205 							<choice>
       
   206 								<mapIdentifierMember property="images.bmpmaskHover" member="hover_bmpmask"/>
       
   207 							</choice>
       
   208 						</select>
       
   209 
       
   210 				</mapResourceMember>
       
   211 				
       
   212 			</mapResource>
       
   213 		</sourceMapping>
       
   214 		
       
   215 		<sourceGen>
       
   216 			<useTemplateGroup ids="CLASS_CONTRIBS" />
       
   217 			<useTemplateGroup ids="CONTAINER_CHILD_CONTRIBS" />
       
   218 			
       
   219 			<inline scope="prototype">
       
   220 include("../containers/containerLibrary.js")
       
   221 			</inline>
       
   222 			
       
   223 			<template form="Container" phase="HeaderIncludes"><![CDATA[
       
   224 #include <aknbutton.h>
       
   225 #include <stringloader.h>
       
   226 ]]>			</template>
       
   227 			
       
   228 			<template form="Container" phase="ForwardDeclarations">
       
   229 class CAknButton;
       
   230 			</template>
       
   231 
       
   232 			<template form="Container" phase="Destroy"><![CDATA[
       
   233 delete ${instanceMemberName};
       
   234 ${instanceMemberName} = NULL;
       
   235 ]]>			</template>
       
   236 		
       
   237 <template id="INIT_FROM_CONTAINER" form="Container" phase="Initialize"><![CDATA[
       
   238 
       
   239 ${instanceMemberName} = static_cast< CAknButton* >
       
   240 				( EikControlFactory::CreateByTypeL( EAknCtButton ).iControl );
       
   241 ${instanceMemberName}->ConstructFromResourceL ( ${resourceName$upper} );
       
   242 
       
   243 ${instanceMemberName}->SetContainerWindowL ( *this );
       
   244 ${instanceMemberName}->SetRect ( TRect ( 
       
   245 							TPoint ( ${properties.location.x}, ${properties.location.y} ) , 
       
   246 							TSize ( ${properties.size.width}, ${properties.size.height} ) )  
       
   247 							 ) ; 
       
   248 ${instanceMemberName}->SetObserver( ( MCoeControlObserver* ) iCommandObserver ); 
       
   249 <% if (properties.horizTextAlign != "CGraphicsContext::ECenter") { %>${instanceMemberName}->SetTextHorizontalAlignment( ${properties.horizTextAlign} );<% } %>
       
   250 <% if (properties.vertTextAlign != "CAknButton::ECenter") { %> ${instanceMemberName}->SetTextVerticalAlignment( ${properties.vertTextAlign} );<% } %>
       
   251 <% if (properties.textAndIconAlignment != "CAknButton::EIconBeforeText") { %> ${instanceMemberName}->SetTextAndIconAlignment( ${properties.textAndIconAlignment} );<% } %>
       
   252 <% if (properties.toolTipPosition != "CAknButton::EPositionTop") { %>${instanceMemberName}->SetTooltipPosition( ${properties.toolTipPosition} );<% } %>
       
   253 <% if (properties.textFont != "normal") { %>${instanceMemberName}->SetTextFont( ${properties.textFont} );<% } %>
       
   254 
       
   255 ]]>			</template>
       
   256 
       
   257 		<templateGroup id="HandleSelectedEvent" ifEvents="selected">
       
   258 			<template id="0" phase="UserHandlers">
       
   259 TBool ${event.handlerName}( TInt aCommand );
       
   260 			</template>
       
   261 
       
   262 			<defineLocation id="SelectedMethod" baseLocation="MAIN_FILE"
       
   263 					owned="false"
       
   264 					isEventHandler="true"
       
   265 					location="function(${handlerClassName}::${event.handlerName}(TInt))">
       
   266 					<template id="2"><![CDATA[
       
   267 /** 
       
   268  * Handle the ${event.eventName} event.
       
   269  * @param aCommand the command id invoked
       
   270  * @return ETrue if the command was handled, EFalse if not
       
   271  */
       
   272 TBool ${handlerClassName}::${event.handlerName}( TInt aCommand )
       
   273 	{
       
   274 	// TODO: implement ${event.eventName} event handler
       
   275 	return ETrue;
       
   276 	}
       
   277 ]]>				
       
   278 					</template>
       
   279 				</defineLocation>
       
   280 			
       
   281 			<template id="3" location="SelectedMethod" />
       
   282 	
       
   283 			<template id="4" form="HandleCommandSwitchDispatch" phase="SwitchContents" ifEvents="selected"><![CDATA[
       
   284 <% var commandId =  Engine.findOrCreateEnumeratorForAlgorithm(instance, "command", 
       
   285 		"com.nokia.sdt.component.symbian.NAME_ALG_COMMANDS");
       
   286 	//println("commandId = " + commandId);
       
   287 	if (commandId != null) { 
       
   288 %>	case ${commandId}:
       
   289 		commandHandled = ${event.handlerName}( aCommand );
       
   290 		break;
       
   291 <% } %> ]]>	</template>
       
   292 		</templateGroup>
       
   293 		
       
   294 		<useTemplateGroup ids="GenerateCommonControlEvents GenerateStateChangedEvent"/>
       
   295 		<useTemplateGroup ids="GenerateRequestingFocusEvent GenerateRequestingExitEvent"/>
       
   296 		<useTemplateGroup ids="GenerateRequestingCancelEvent GenerateInteractionRefusedEvent"/>
       
   297 		<useTemplateGroup ids="GeneratePrepareFocusTransitionEvent"/>
       
   298 		
       
   299 		</sourceGen>
       
   300 		
       
   301 	</component>
       
   302 </componentDefinition>