2
|
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 |
<enumPropertyDeclaration qualifiedName="com.nokia.sdt.series60.NaviTabs.TabWidth">
|
|
12 |
<enumElement value="EAknTabWidthWithTwoTabs"/>
|
|
13 |
<enumElement value="EAknTabWidthWithTwoLongTabs"/>
|
|
14 |
<enumElement value="EAknTabWidthWithThreeTabs"/>
|
|
15 |
<enumElement value="EAknTabWidthWithThreeLongTabs"/>
|
|
16 |
<enumElement value="EAknTabWidthWithFourTabs"/>
|
|
17 |
<enumElement value="EAknTabWidthWithOneTab"/>
|
|
18 |
</enumPropertyDeclaration>
|
|
19 |
|
|
20 |
<component baseComponent="com.nokia.sdt.series60.NaviBase"
|
|
21 |
friendlyName="%friendlyName"
|
|
22 |
qualifiedName="com.nokia.sdt.series60.NaviTabs"
|
|
23 |
category="System"
|
|
24 |
instanceNameRoot="NaviTabs"
|
|
25 |
version="1.0">
|
|
26 |
<documentation>
|
|
27 |
<information>%information</information>
|
|
28 |
</documentation>
|
|
29 |
<symbian sdkName="com.nokia.series60" minSDKVersion="2.0"
|
|
30 |
className="CAknNavigationControlContainer" classHelpTopic=""
|
|
31 |
resourceType="NAVI_DECORATOR, NAVI_LABEL" resourceHelpTopic="" />
|
|
32 |
<designerImages smallIconFile="NaviTabs_sm.png" largeIconFile="NaviTabs.png"/>
|
|
33 |
<attributes>
|
|
34 |
<attribute key="rss-control-type-enum">EAknCtNaviPane</attribute>
|
|
35 |
<attribute key="model-type-disposition">root</attribute>
|
|
36 |
</attributes>
|
|
37 |
<properties>
|
|
38 |
<enumProperty category="Design" name="tabWidth"
|
|
39 |
type="com.nokia.sdt.series60.NaviTabs.TabWidth" default="EAknTabWidthWithTwoTabs"
|
|
40 |
descriptionKey="tabWidthDescription" />
|
|
41 |
<property category="Hidden" name="active" type="integer"/>
|
|
42 |
</properties>
|
|
43 |
<implementations>
|
|
44 |
<implementation>
|
|
45 |
<interface id="com.nokia.sdt.datamodel.adapter.IVisualAppearance"/>
|
|
46 |
<script file="NaviTabs_visual.js" prototype="NaviTabsVisual"/>
|
|
47 |
</implementation>
|
|
48 |
</implementations>
|
|
49 |
|
|
50 |
<sourceMapping>
|
|
51 |
<mapResource struct="NAVI_DECORATOR" headers="avkon.rh">
|
|
52 |
<mapFixedMember value="ENaviDecoratorControlTabGroup" member="type"/>
|
|
53 |
<mapResourceMember property="." member="control" struct="TAB_GROUP" headers="avkon.rh">
|
|
54 |
<mapEnumMember property="tabWidth" member="tab_width" headers="avkon.hrh" />
|
|
55 |
<!-- <mapSimpleMember property="active" member="active"/> -->
|
|
56 |
<mapArrayMember property="[parent][parent]" member="tabs">
|
|
57 |
<!-- sneaky way of ensuring we only match the view reference children -->
|
|
58 |
<select property="@is-view-reference">
|
|
59 |
<choice value="true">
|
|
60 |
<select property="inTabGroup">
|
|
61 |
<choice value="true">
|
|
62 |
<mapResourceElement struct="TAB" instanceIdentifyingMember="id">
|
|
63 |
<mapEnumMember property="." member="id" uniqueValue="*"
|
|
64 |
nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_VIEW_UID"/>
|
|
65 |
<mapSimpleMember property="tabText" member="txt"/>
|
|
66 |
<!-- set in code
|
|
67 |
<mapSimpleMember property="tabImage.bmpfile" member="bmpfile"/>
|
|
68 |
<mapIdentifierMember property="tabImage.bmpid" member="bmpid"/>
|
|
69 |
<mapIdentifierMember property="tabImage.bmpmask" member="bmpmask"/>
|
|
70 |
-->
|
|
71 |
</mapResourceElement>
|
|
72 |
</choice>
|
|
73 |
<choice />
|
|
74 |
</select>
|
|
75 |
</choice>
|
|
76 |
<choice />
|
|
77 |
</select>
|
|
78 |
</mapArrayMember>
|
|
79 |
</mapResourceMember>
|
|
80 |
</mapResource>
|
|
81 |
</sourceMapping>
|
|
82 |
|
|
83 |
<sourceGen forms="RootAppUi">
|
|
84 |
|
|
85 |
<useTemplateGroup ids="NaviBaseSetup"/>
|
|
86 |
|
|
87 |
<template phase="ForwardDeclarations">
|
|
88 |
class CAknTabGroup;
|
|
89 |
</template>
|
|
90 |
|
|
91 |
<template phase="InstanceVariables">
|
|
92 |
CAknTabGroup* ${instanceMemberName};
|
|
93 |
</template>
|
|
94 |
|
|
95 |
<template phase="MainSystemIncludes"><![CDATA[
|
|
96 |
#include <akntabgrp.h>
|
|
97 |
]]> </template>
|
|
98 |
|
|
99 |
<inline><![CDATA[
|
|
100 |
function getApplicationName(instance) {
|
|
101 |
var application = instance.parent;
|
|
102 |
// find the application object
|
|
103 |
while (application != null && application.componentId != "com.nokia.sdt.series60.CAknApplication")
|
|
104 |
application = application.parent;
|
|
105 |
|
|
106 |
if (application != null)
|
|
107 |
return application.name;
|
|
108 |
|
|
109 |
return "ApplicationNameError";
|
|
110 |
}
|
|
111 |
]]> </inline>
|
|
112 |
|
|
113 |
<template phase="MainUserIncludes"><![CDATA[
|
|
114 |
#include "${getApplicationName(instance)}.h"
|
|
115 |
]]> </template>
|
|
116 |
|
|
117 |
<template phase="Initialize"><![CDATA[
|
|
118 |
CAknNavigationControlContainer* naviPane = ( CAknNavigationControlContainer* )
|
|
119 |
StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
|
|
120 |
iNaviDecorator_ = naviPane->ResourceDecorator();
|
|
121 |
if ( iNaviDecorator_ != NULL )
|
|
122 |
{
|
|
123 |
${instanceMemberName} = ( CAknTabGroup* ) iNaviDecorator_->DecoratedControl();
|
|
124 |
<%
|
|
125 |
include("../containers/containerLibrary.js")
|
|
126 |
include("../srcgenLibrary.js")
|
|
127 |
var index = -1;
|
|
128 |
var appUiChildren = instance.parent.parent.children;
|
|
129 |
for (var i in appUiChildren) {
|
|
130 |
var child = appUiChildren[i];
|
|
131 |
if (child.isInstanceOf("com.nokia.sdt.series60.AvkonViewReference")) {
|
|
132 |
if (child.properties.inTabGroup) {
|
|
133 |
index++;
|
|
134 |
if (isImagePropertySet(child.properties.tabImage)) {
|
|
135 |
var bmpStr = "";
|
|
136 |
var bmpMaskStr = "";
|
|
137 |
var tabIdStr = instanceMemberName + "->TabIdFromIndex( " + index + " )";
|
|
138 |
if ((child.properties.tabText == null) || (child.properties.tabText.length == 0)) {
|
|
139 |
bmpStr += instanceMemberName + "->ReplaceTabL( " + tabIdStr + ", {0} );\\n";
|
|
140 |
bmpMaskStr += instanceMemberName + "->ReplaceTabL( " + tabIdStr + ", {0}, {1} );\\n";
|
|
141 |
}
|
|
142 |
else {
|
|
143 |
var loadStr = "HBufC* text = StringLoader::LoadLC( " +
|
|
144 |
Engine.getGeneratedResource(child, "tabText").toUpperCase() + " );\\n";
|
|
145 |
bmpStr += loadStr;
|
|
146 |
bmpMaskStr += loadStr;
|
|
147 |
bmpStr += instanceMemberName + "->ReplaceTabL( " + tabIdStr + ", *text, {0} );\\n";
|
|
148 |
bmpMaskStr += instanceMemberName + "->ReplaceTabL( " + tabIdStr + ", *text, {0}, {1} );\\n";
|
|
149 |
var cleanupStr = "CleanupStack::PopAndDestroy(text);\\n";
|
|
150 |
bmpStr += cleanupStr;
|
|
151 |
bmpMaskStr += cleanupStr;
|
|
152 |
}
|
|
153 |
setupImageFromPropertyViaCFbsBitmap(contribs, child, "Initialize", null, 1,
|
|
154 |
child.properties["tabImage"],
|
|
155 |
"EAspectRatioPreserved" /*aspect*/, bmpStr, bmpMaskStr, instanceMemberName + "->Size()");
|
|
156 |
}
|
|
157 |
}
|
|
158 |
}
|
|
159 |
} %>
|
|
160 |
}
|
|
161 |
]]>
|
|
162 |
</template>
|
|
163 |
|
|
164 |
<template phase="HandleKeyEventL"><![CDATA[
|
|
165 |
TVwsViewId activeViewId;
|
|
166 |
if ( GetActiveViewId( activeViewId ) == KErrNone
|
|
167 |
&& ${instanceMemberName}->TabIndexFromId( activeViewId.iViewUid.iUid )
|
|
168 |
== KErrNotFound )
|
|
169 |
{
|
|
170 |
return EKeyWasNotConsumed;
|
|
171 |
}
|
|
172 |
|
|
173 |
TInt active = ${instanceMemberName}->ActiveTabIndex();
|
|
174 |
TInt count = ${instanceMemberName}->TabCount();
|
|
175 |
|
|
176 |
switch ( aKeyEvent.iCode )
|
|
177 |
{
|
|
178 |
case EKeyLeftArrow:
|
|
179 |
if ( active > 0 )
|
|
180 |
{
|
|
181 |
active--;
|
|
182 |
ActivateLocalViewL( TUid::Uid( ${instanceMemberName}->TabIdFromIndex( active ) ) );
|
|
183 |
return EKeyWasConsumed;
|
|
184 |
}
|
|
185 |
break;
|
|
186 |
case EKeyRightArrow:
|
|
187 |
if ( active + 1 < count )
|
|
188 |
{
|
|
189 |
active++;
|
|
190 |
ActivateLocalViewL( TUid::Uid( ${instanceMemberName}->TabIdFromIndex( active ) ) );
|
|
191 |
return EKeyWasConsumed;
|
|
192 |
}
|
|
193 |
break;
|
|
194 |
default:
|
|
195 |
return EKeyWasNotConsumed;
|
|
196 |
}
|
|
197 |
|
|
198 |
]]>
|
|
199 |
</template>
|
|
200 |
|
|
201 |
<template phase="ClassMethods">
|
|
202 |
void SetActiveTabByViewId( TUid aViewId );
|
|
203 |
</template>
|
|
204 |
<defineLocation id="MethodLocation" baseLocation="MAIN_FILE"
|
|
205 |
owned="true"
|
|
206 |
location="function(${className}::SetActiveTabByViewId(TUid))">
|
|
207 |
<template>
|
|
208 |
void ${className}::SetActiveTabByViewId( TUid aViewId )
|
|
209 |
{
|
|
210 |
}
|
|
211 |
</template>
|
|
212 |
</defineLocation>
|
|
213 |
<template location="MethodLocation"><![CDATA[
|
|
214 |
if ( ${instanceMemberName} != NULL
|
|
215 |
&& ${instanceMemberName}->TabIndexFromId( aViewId.iUid ) != KErrNotFound )
|
|
216 |
{
|
|
217 |
${instanceMemberName}->SetActiveTabById( aViewId.iUid );
|
|
218 |
}
|
|
219 |
]]> </template>
|
|
220 |
|
|
221 |
<inline>
|
|
222 |
|
|
223 |
</inline>
|
|
224 |
|
|
225 |
<template phase="HandleViewDeactivation"><![CDATA[
|
|
226 |
if ( aNewlyActivatedViewId.iAppUid == KUid${getApplicationName(instance)} )
|
|
227 |
{
|
|
228 |
SetActiveTabByViewId( aNewlyActivatedViewId.iViewUid );
|
|
229 |
}
|
|
230 |
]]> </template>
|
|
231 |
|
|
232 |
</sourceGen>
|
|
233 |
</component>
|
|
234 |
</componentDefinition>
|