|
1 /* |
|
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 "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 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: definitions of alf built-in visual support |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "alf/alfvisualhandlers.h" |
|
21 #include "alf/alflayouthandlers.h" |
|
22 |
|
23 #include <uiacceltk/HuiGridLayout.h> |
|
24 #include <uiacceltk/HuiDeckLayout.h> |
|
25 #include <uiacceltk/HuiAnchorLayout.h> |
|
26 #include <uiacceltk/HuiFlowLayout.h> |
|
27 #include <uiacceltk/huiviewportlayout.h> |
|
28 #include <uiacceltk/HuiCurvePathLayout.h> |
|
29 #include <uiacceltk/HuiRealPoint.h> |
|
30 #include <uiacceltk/HuiUtil.h> |
|
31 |
|
32 #include "alf/alfconstants.h" |
|
33 #include "alf/alfserverutils.h" |
|
34 #include "alfmappingfunctionhandlers.h" |
|
35 |
|
36 #include <aknlayout2hierarchy.h> |
|
37 |
|
38 //---------------------------- |
|
39 // Layout base |
|
40 //---------------------------- |
|
41 EXPORT_C MAlfExtension* CAlfLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
42 { |
|
43 CAlfVisualHandler* me = new (ELeave) CAlfLayoutHandler(aResolver); |
|
44 CleanupStack::PushL(me); |
|
45 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
46 CleanupStack::Pop(); |
|
47 return me; |
|
48 } |
|
49 |
|
50 EXPORT_C CAlfLayoutHandler::CAlfLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfVisualHandler(aResolver) |
|
51 { |
|
52 } |
|
53 |
|
54 EXPORT_C void CAlfLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
55 { |
|
56 if (!aVisual) |
|
57 { |
|
58 CHuiLayout* layout = CHuiLayout::AddNewL(aOwner, aParentLayout); |
|
59 CAlfVisualHandler::ConstructL(layout, aOwner, aParentLayout); |
|
60 } |
|
61 else |
|
62 { |
|
63 CAlfVisualHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
64 } |
|
65 } |
|
66 |
|
67 EXPORT_C CAlfLayoutHandler::~CAlfLayoutHandler() |
|
68 { |
|
69 } |
|
70 |
|
71 EXPORT_C void CAlfLayoutHandler::Release() |
|
72 { |
|
73 delete this; |
|
74 } |
|
75 |
|
76 |
|
77 EXPORT_C TAny* CAlfLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
78 { |
|
79 switch (aInterface) |
|
80 { |
|
81 case EHuiObjectTypeLayout: |
|
82 return static_cast<CHuiLayout*>(iVisual); |
|
83 default: |
|
84 return CAlfVisualHandler::GetInterface(aInterface); |
|
85 |
|
86 } |
|
87 } |
|
88 |
|
89 |
|
90 EXPORT_C void CAlfLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
91 { |
|
92 CHuiLayout* layout = static_cast<CHuiLayout*>(iVisual); |
|
93 |
|
94 switch (aCommandId) |
|
95 { |
|
96 case EAlfLayoutAppendVisual: |
|
97 { |
|
98 // 1 - visual ID 2 - transition time |
|
99 TInt2* params = (TInt2*) aInputBuffer.Ptr(); |
|
100 CHuiVisual* visual = (CHuiVisual*)iResolver.GetInterfaceL(EHuiObjectTypeVisual, params->iInt1); |
|
101 if (layout->FindVisual(visual) == KErrNotFound) |
|
102 { |
|
103 layout->AppendL(visual, params->iInt2); |
|
104 } |
|
105 else |
|
106 { |
|
107 User::Leave(KErrAlreadyExists); |
|
108 } |
|
109 break; |
|
110 } |
|
111 |
|
112 case EAlfLayoutRemoveVisual: |
|
113 { |
|
114 // 1 - visual ID 2 - transition time |
|
115 TInt2* params = (TInt2*) aInputBuffer.Ptr(); |
|
116 CHuiVisual* visual = NULL; |
|
117 TRAPD( err, visual = (CHuiVisual*)iResolver.GetInterfaceL(EHuiObjectTypeVisual, params->iInt1) ); |
|
118 if ( err != KErrNone ) |
|
119 { |
|
120 // Visual has been deleted already |
|
121 return; |
|
122 } |
|
123 layout->Remove(visual, params->iInt2); |
|
124 |
|
125 // todo: we should do the following, but it panic if this is called in RemoveAndDestroyAlld() loop |
|
126 /* |
|
127 // if visual is showing, we should add it under the host container |
|
128 CHuiControlGroup* childGroup = visual->Owner().ControlGroup(); |
|
129 if ( childGroup && visual->Display() ) |
|
130 { |
|
131 // must be a control |
|
132 CHuiControl* control = static_cast<CHuiControl*>(&visual->Owner()); |
|
133 if ( control->Host() ) // showing if host if host is defined. |
|
134 { |
|
135 CHuiLayout* containerLayout = control->Host()->ContainerLayout( control ); |
|
136 __ASSERT_DEBUG( containerLayout, USER_INVARIANT() ); |
|
137 if ( containerLayout ) |
|
138 { |
|
139 // Should we InsertL instead, so we would have the original |
|
140 // root visual order? |
|
141 containerLayout->AppendL( visual ); |
|
142 } |
|
143 } |
|
144 }*/ |
|
145 break; |
|
146 } |
|
147 |
|
148 case EAlfLayoutReorderVisual: |
|
149 { |
|
150 // 1 - visual ID 2 - position 3 - transition time |
|
151 TInt3* params = (TInt3*) aInputBuffer.Ptr(); |
|
152 CHuiVisual* visual = (CHuiVisual*)iResolver.GetInterfaceL(EHuiObjectTypeVisual, params->iInt1); |
|
153 layout->Reorder(*visual, params->iInt2, params->iInt3); |
|
154 break; |
|
155 } |
|
156 |
|
157 case EAlfLayoutVisualFromIndex: |
|
158 { |
|
159 TInt* index = (TInt*) aInputBuffer.Ptr(); |
|
160 CHuiVisual& visual = layout->Visual(*index); |
|
161 // todo: can handle be negative ? |
|
162 TInt handle = iResolver.GetHandleFromInterface(EHuiObjectTypeVisual, &visual); |
|
163 //User::LeaveIfError(handle); |
|
164 |
|
165 TPckg<TInt> pckg(handle); |
|
166 aResponse = pckg; |
|
167 |
|
168 break; |
|
169 } |
|
170 |
|
171 case EAlfLayoutEnableScrolling: |
|
172 { |
|
173 TBool* enable = (TBool*) aInputBuffer.Ptr(); |
|
174 layout->EnableScrollingL(*enable); |
|
175 break; |
|
176 } |
|
177 |
|
178 case EAlfLayoutScrollOffset: |
|
179 { |
|
180 TAlfTimedPoint point; |
|
181 AlfTimedPointUtility::CopyTimedPoint(layout->ScrollOffset(), point); |
|
182 |
|
183 TPckg<TAlfTimedPoint> buf(point); |
|
184 aResponse = buf; |
|
185 break; |
|
186 } |
|
187 |
|
188 case EAlfLayoutSetScrollOffset: |
|
189 { |
|
190 TAlfTimedPoint* offset = (TAlfTimedPoint*) aInputBuffer.Ptr(); |
|
191 AlfTimedPointUtility::CopyTimedPoint(*offset, layout->ScrollOffset(), iResolver); |
|
192 break; |
|
193 } |
|
194 |
|
195 case EAlfLayoutChildOrdinal: |
|
196 { // client should know this as well |
|
197 const TInt* index = (TInt*) aInputBuffer.Ptr(); |
|
198 TInt ordinal(0); |
|
199 TPckg<TInt> ordinalPckg(ordinal); |
|
200 ordinal = layout->ChildOrdinal(*index); |
|
201 aResponse = ordinalPckg; |
|
202 break; |
|
203 } |
|
204 |
|
205 case EAlfLayoutChildPos: |
|
206 { |
|
207 TAlfPosInt* pos = (TAlfPosInt*) aInputBuffer.Ptr(); |
|
208 TAlfPosInt result = |
|
209 { |
|
210 pos->iPoint, |
|
211 EFalse |
|
212 }; |
|
213 TPckg<TAlfPosInt> resp(result); |
|
214 result.iInt = layout->ChildPos(pos->iInt, result.iPoint); |
|
215 aResponse = resp; |
|
216 break; |
|
217 } |
|
218 |
|
219 case EAlfLayoutChildSize: |
|
220 { |
|
221 TAlfSizeInt* size = (TAlfSizeInt*) aInputBuffer.Ptr(); |
|
222 TAlfSizeInt result = |
|
223 { |
|
224 size->iSize, |
|
225 EFalse |
|
226 }; |
|
227 TPckg<TAlfSizeInt> resp(result); |
|
228 result.iInt = layout->ChildSize(size->iInt, result.iSize); |
|
229 aResponse = resp; |
|
230 break; |
|
231 } |
|
232 case EAlfLayoutSetTransitionTime: |
|
233 { |
|
234 TInt* ttime = (TInt*) aInputBuffer.Ptr(); |
|
235 layout->SetTransitionTime(*ttime); |
|
236 break; |
|
237 } |
|
238 |
|
239 case EAlfLayoutSetInnerPaddingPoint: |
|
240 { |
|
241 TPoint* padding = (TPoint*) aInputBuffer.Ptr(); |
|
242 layout->SetInnerPadding(*padding); |
|
243 break; |
|
244 } |
|
245 |
|
246 case EAlfLayoutSetInnerPaddingMetric: |
|
247 { |
|
248 TAlfXYMetric* metric = (TAlfXYMetric*) aInputBuffer.Ptr(); |
|
249 THuiMetric newMetricX(metric->iX.iMagnitude, metric->iX.iUnit, metric->iX.iReferenceTextStyleId); |
|
250 THuiMetric newMetricY(metric->iY.iMagnitude, metric->iY.iUnit, metric->iY.iReferenceTextStyleId); |
|
251 THuiXYMetric newMetric(newMetricX, newMetricY); |
|
252 layout->SetInnerPadding(newMetric); |
|
253 break; |
|
254 } |
|
255 |
|
256 case EAlfLayoutInnerPaddingInBaseUnits: |
|
257 { |
|
258 THuiRealPoint point = layout->InnerPaddingInBaseUnits(); |
|
259 TAlfRealPoint result(point.iX, point.iY); |
|
260 TPckg<TAlfRealPoint> resp(result); |
|
261 aResponse = resp; |
|
262 break; |
|
263 } |
|
264 |
|
265 case EAlfLayoutVirtualSize: |
|
266 { |
|
267 TSize virtualSize = layout->VirtualSize(); |
|
268 TPckg<TSize> pckg(virtualSize); |
|
269 aResponse = pckg; |
|
270 break; |
|
271 } |
|
272 |
|
273 case EAlfLayoutSetBaseUnit: |
|
274 { |
|
275 TAlfMetric* metric = (TAlfMetric*) aInputBuffer.Ptr(); |
|
276 THuiMetric newMetric(metric->iMagnitude, metric->iUnit, metric->iReferenceTextStyleId); |
|
277 layout->SetBaseUnit(newMetric); |
|
278 break; |
|
279 } |
|
280 |
|
281 case EAlfLayoutSetBaseUnitXY: |
|
282 { |
|
283 TAlfXYMetric* metric = (TAlfXYMetric*) aInputBuffer.Ptr(); |
|
284 THuiMetric newMetricX(metric->iX.iMagnitude, metric->iX.iUnit, metric->iX.iReferenceTextStyleId); |
|
285 THuiMetric newMetricY(metric->iY.iMagnitude, metric->iY.iUnit, metric->iY.iReferenceTextStyleId); |
|
286 THuiXYMetric newMetric(newMetricX, newMetricY); |
|
287 layout->SetBaseUnit(newMetric); |
|
288 break; |
|
289 } |
|
290 |
|
291 case EAlfLayoutBaseUnit: |
|
292 { |
|
293 THuiXYMetric metric = layout->BaseUnit(); |
|
294 TAlfMetric newMetricX(metric.iX.iMagnitude, metric.iX.iUnit, metric.iX.iReferenceTextStyleId); |
|
295 TAlfMetric newMetricY(metric.iY.iMagnitude, metric.iY.iUnit, metric.iY.iReferenceTextStyleId); |
|
296 TAlfXYMetric newMetric(newMetricX, newMetricY); |
|
297 TPckg<TAlfXYMetric> resp(newMetric); |
|
298 aResponse = resp; |
|
299 break; |
|
300 } |
|
301 |
|
302 case EAlfVisualCopyValuesFromOtherVisual: |
|
303 case EAlfVisualPauseProperties: |
|
304 case EAlfVisualResumeProperties: |
|
305 { |
|
306 if (aCommandId == EAlfVisualCopyValuesFromOtherVisual) |
|
307 { |
|
308 TInt3* inptr = (TInt3*) aInputBuffer.Ptr(); |
|
309 CHuiLayout* sourceLayout = (CHuiLayout*) iResolver.GetInterfaceL( EHuiObjectTypeLayout, inptr->iInt1 ); |
|
310 if (inptr->iInt2&AlfVisualProperties::ELayoutScrollOffset) |
|
311 { |
|
312 layout->ScrollOffset().Set(sourceLayout->ScrollOffset().Target(), inptr->iInt3 ); |
|
313 } |
|
314 } |
|
315 else if (aCommandId == EAlfVisualPauseProperties) |
|
316 { |
|
317 TInt* inptr = (TInt*) aInputBuffer.Ptr(); |
|
318 if (*inptr&AlfVisualProperties::ELayoutScrollOffset) |
|
319 { |
|
320 layout->ScrollOffset().iX.Suspend(); |
|
321 layout->ScrollOffset().iY.Suspend(); |
|
322 } |
|
323 } |
|
324 else // EAlfVisualResumeProperties) |
|
325 { |
|
326 TInt* inptr = (TInt*) aInputBuffer.Ptr(); |
|
327 if (*inptr&AlfVisualProperties::ELayoutScrollOffset) |
|
328 { |
|
329 layout->ScrollOffset().iX.Suspend(EFalse); |
|
330 layout->ScrollOffset().iY.Suspend(EFalse); |
|
331 } |
|
332 } |
|
333 |
|
334 } // FALL THROUGH !! |
|
335 |
|
336 default: |
|
337 CAlfVisualHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
338 } |
|
339 |
|
340 } |
|
341 |
|
342 EXPORT_C void CAlfLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
343 { |
|
344 CAlfVisualHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
345 } |
|
346 |
|
347 //---------------------------- |
|
348 // anchor layout |
|
349 //---------------------------- |
|
350 EXPORT_C MAlfExtension* CAlfAnchorLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
351 { |
|
352 CAlfAnchorLayoutHandler* me = new (ELeave) CAlfAnchorLayoutHandler(aResolver); |
|
353 CleanupStack::PushL(me); |
|
354 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
355 CleanupStack::Pop(); |
|
356 return me; |
|
357 } |
|
358 |
|
359 |
|
360 EXPORT_C CAlfAnchorLayoutHandler::CAlfAnchorLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfLayoutHandler(aResolver) |
|
361 { |
|
362 } |
|
363 |
|
364 |
|
365 EXPORT_C void CAlfAnchorLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
366 { |
|
367 if (!aVisual) |
|
368 { |
|
369 CHuiAnchorLayout* layout = CHuiAnchorLayout::AddNewL(aOwner, aParentLayout); |
|
370 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
371 } |
|
372 else |
|
373 { |
|
374 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
375 } |
|
376 } |
|
377 |
|
378 |
|
379 EXPORT_C CAlfAnchorLayoutHandler::~CAlfAnchorLayoutHandler() |
|
380 { |
|
381 } |
|
382 |
|
383 EXPORT_C void CAlfAnchorLayoutHandler::Release() |
|
384 { |
|
385 delete this; |
|
386 } |
|
387 |
|
388 |
|
389 EXPORT_C TAny* CAlfAnchorLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
390 { |
|
391 return CAlfLayoutHandler::GetInterface(aInterface); |
|
392 } |
|
393 |
|
394 |
|
395 EXPORT_C void CAlfAnchorLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
396 { |
|
397 CHuiAnchorLayout* anchorLayout = static_cast<CHuiAnchorLayout*>(iVisual); |
|
398 switch (aCommandId) |
|
399 { |
|
400 case EAlfAnchorLayoutReset: |
|
401 { |
|
402 anchorLayout->Reset(); |
|
403 break; |
|
404 } |
|
405 |
|
406 case EAlfAnchorLayoutSetAnchor: |
|
407 { |
|
408 TAlfLayoutSetAnchorParams* params = (TAlfLayoutSetAnchorParams*) aInputBuffer.Ptr(); |
|
409 |
|
410 THuiTimedPoint tpoint; |
|
411 AlfTimedPointUtility::CopyTimedPoint(params->iOffset, tpoint, iResolver); |
|
412 |
|
413 // Set anchor |
|
414 TInt error = anchorLayout->SetAnchor( |
|
415 THuiAnchor(params->iAnchor), |
|
416 params->iOrdinal, |
|
417 THuiAnchorOrigin(params->iHorizOrigin), |
|
418 THuiAnchorOrigin(params->iVertOrigin), |
|
419 THuiAnchorMetric(params->iHorizMetric), |
|
420 THuiAnchorMetric(params->iVertMetric), |
|
421 tpoint |
|
422 ); |
|
423 |
|
424 User::LeaveIfError( error ); |
|
425 |
|
426 break; |
|
427 } |
|
428 |
|
429 case EAlfAnchorLayoutSetRelativeAnchorRect: |
|
430 { |
|
431 TAlfLayoutSetRelativeAnchorRectParams* params = (TAlfLayoutSetRelativeAnchorRectParams*) aInputBuffer.Ptr(); |
|
432 |
|
433 TInt error = anchorLayout->SetRelativeAnchorRect |
|
434 ( |
|
435 params->iOrdinal, |
|
436 THuiAnchorOrigin(params->iTlHorizOrigin), |
|
437 THuiAnchorOrigin(params->iTlVertOrigin), |
|
438 THuiRealPoint(params->iTopLeftOffset.iX, params->iTopLeftOffset.iY), |
|
439 THuiAnchorOrigin(params->iBrHorizOrigin), |
|
440 THuiAnchorOrigin(params->iBrVertOrigin), |
|
441 THuiRealPoint(params->iBottomRightOffset.iX, params->iBottomRightOffset.iY) |
|
442 ); |
|
443 |
|
444 User::LeaveIfError( error ); |
|
445 break; |
|
446 } |
|
447 |
|
448 case EAlfAnchorLayoutRemoveAnchor: |
|
449 { |
|
450 TInt2* params = (TInt2*) aInputBuffer.Ptr(); |
|
451 anchorLayout->RemoveAnchor( (THuiAnchor)params->iInt1, params->iInt2 ); |
|
452 break; |
|
453 } |
|
454 |
|
455 case EAlfAnchorLayoutAttachEdge: |
|
456 { |
|
457 TAlfLayoutAttachEdgeParams* params = (TAlfLayoutAttachEdgeParams*) aInputBuffer.Ptr(); |
|
458 THuiMetric metric(params->iOffset.iMagnitude, params->iOffset.iUnit, params->iOffset.iReferenceTextStyleId); |
|
459 |
|
460 TInt error = anchorLayout->Attach( |
|
461 params->iOrdinal, |
|
462 THuiAnchorType(params->iType), |
|
463 metric, |
|
464 THuiAnchorAttachmentOrigin(params->iAttachmentOrigin), |
|
465 params->iAttachmentOrdinal); |
|
466 |
|
467 User::LeaveIfError( error ); |
|
468 |
|
469 break; |
|
470 } |
|
471 |
|
472 case EAlfAnchorLayoutAttachCorner: |
|
473 { |
|
474 TAlfLayoutAttachCornerParams* params = (TAlfLayoutAttachCornerParams*) aInputBuffer.Ptr(); |
|
475 |
|
476 THuiMetric metricX(params->iOffset.iX.iMagnitude, params->iOffset.iX.iUnit, params->iOffset.iX.iReferenceTextStyleId); |
|
477 THuiMetric metricY(params->iOffset.iY.iMagnitude, params->iOffset.iY.iUnit, params->iOffset.iY.iReferenceTextStyleId); |
|
478 |
|
479 THuiXYMetric metric(metricX, metricY); |
|
480 |
|
481 TInt error = anchorLayout->Attach( |
|
482 params->iOrdinal, |
|
483 THuiAnchorType(params->iType), |
|
484 metric, |
|
485 THuiAnchorAttachmentOrigin(params->iAttachmentOrigin), |
|
486 params->iAttachmentOrdinal); |
|
487 |
|
488 User::LeaveIfError( error ); |
|
489 |
|
490 break; |
|
491 } |
|
492 |
|
493 case EAlfAnchorLayoutAttachBox: |
|
494 { |
|
495 TAlfLayoutAttachBoxParams* params = (TAlfLayoutAttachBoxParams*) aInputBuffer.Ptr(); |
|
496 |
|
497 THuiMetric metricLeft(params->iOffset.iLeft.iMagnitude, params->iOffset.iLeft.iUnit, params->iOffset.iLeft.iReferenceTextStyleId); |
|
498 THuiMetric metricRight(params->iOffset.iRight.iMagnitude, params->iOffset.iRight.iUnit, params->iOffset.iRight.iReferenceTextStyleId); |
|
499 THuiMetric metricTop(params->iOffset.iTop.iMagnitude, params->iOffset.iTop.iUnit, params->iOffset.iTop.iReferenceTextStyleId); |
|
500 THuiMetric metricBottom(params->iOffset.iBottom.iMagnitude, params->iOffset.iBottom.iUnit, params->iOffset.iBottom.iReferenceTextStyleId); |
|
501 |
|
502 THuiBoxMetric metric(metricLeft, metricRight, metricTop, metricBottom); |
|
503 |
|
504 TInt error = anchorLayout->Attach( |
|
505 params->iOrdinal, |
|
506 metric, |
|
507 THuiAnchorAttachmentOrigin(params->iAttachmentOrigin), |
|
508 params->iAttachmentOrdinal); |
|
509 |
|
510 User::LeaveIfError( error ); |
|
511 |
|
512 break; |
|
513 } |
|
514 |
|
515 case EAlfAnchorLayoutDetachAll: |
|
516 { |
|
517 TInt* params = (TInt*) aInputBuffer.Ptr(); |
|
518 anchorLayout->Detach(*params); |
|
519 break; |
|
520 } |
|
521 |
|
522 case EAlfAnchorLayoutDetach: |
|
523 { |
|
524 TInt2* params = (TInt2*) aInputBuffer.Ptr(); |
|
525 anchorLayout->Detach( params->iInt1, (THuiAnchorType)params->iInt2 ); |
|
526 break; |
|
527 } |
|
528 |
|
529 default: |
|
530 CAlfLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
531 } |
|
532 } |
|
533 |
|
534 EXPORT_C void CAlfAnchorLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
535 { |
|
536 CAlfLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
537 } |
|
538 |
|
539 |
|
540 |
|
541 //---------------------------- |
|
542 // LCT Pane layout |
|
543 //---------------------------- |
|
544 EXPORT_C MAlfExtension* CAlfLCTAnchorLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
545 { |
|
546 CAlfLCTAnchorLayoutHandler* me = new (ELeave) CAlfLCTAnchorLayoutHandler(aResolver); |
|
547 CleanupStack::PushL(me); |
|
548 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
549 CleanupStack::Pop(); |
|
550 return me; |
|
551 } |
|
552 |
|
553 |
|
554 EXPORT_C CAlfLCTAnchorLayoutHandler::CAlfLCTAnchorLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfAnchorLayoutHandler(aResolver) |
|
555 { |
|
556 } |
|
557 |
|
558 |
|
559 EXPORT_C void CAlfLCTAnchorLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
560 { |
|
561 if (!aVisual) |
|
562 { |
|
563 CHuiAnchorLayout* layout = CHuiAnchorLayout::AddNewL(aOwner, aParentLayout); |
|
564 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
565 } |
|
566 else |
|
567 { |
|
568 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
569 } |
|
570 } |
|
571 |
|
572 |
|
573 EXPORT_C CAlfLCTAnchorLayoutHandler::~CAlfLCTAnchorLayoutHandler() |
|
574 { |
|
575 } |
|
576 |
|
577 EXPORT_C void CAlfLCTAnchorLayoutHandler::Release() |
|
578 { |
|
579 delete this; |
|
580 } |
|
581 |
|
582 |
|
583 EXPORT_C TAny* CAlfLCTAnchorLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
584 { |
|
585 return CAlfLayoutHandler::GetInterface(aInterface); |
|
586 } |
|
587 |
|
588 |
|
589 EXPORT_C void CAlfLCTAnchorLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
590 { |
|
591 switch (aCommandId) |
|
592 { |
|
593 case EAlfLCTAnchorLayoutSetAnchors: |
|
594 { |
|
595 #ifdef RD_ALF_IN_PLATFORM |
|
596 CHuiAnchorLayout* anchorLayout = static_cast<CHuiAnchorLayout*>(iVisual); |
|
597 TAlfLCTAnchorSetAnchorsParams* params = (TAlfLCTAnchorSetAnchorsParams*)aInputBuffer.Ptr(); |
|
598 |
|
599 TAknLayoutHierarchyComponentHandle handle; |
|
600 handle.SetApiId(params->iApiId); |
|
601 handle.SetComponentId(params->iComponentId); |
|
602 handle.SetVarietyIndex(params->iVarietyIndex); |
|
603 handle.SetColumn(params->iColumn); |
|
604 handle.SetRow(params->iRow); |
|
605 |
|
606 THuiTimedPoint tpoint; |
|
607 AlfTimedPointUtility::CopyTimedPoint(params->iOffset, tpoint, iResolver); |
|
608 |
|
609 // we can access the layout data as a window line, whatever type component is specified. |
|
610 TAknWindowLineLayout componentLayout = AknLayout2Hierarchy::GetWindowComponentLayout(handle).LayoutLineNoEmptys(); |
|
611 SetAnchors(anchorLayout, params->iOrdinal, componentLayout, tpoint); |
|
612 #endif |
|
613 |
|
614 break; |
|
615 } |
|
616 |
|
617 default: |
|
618 CAlfAnchorLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
619 } |
|
620 } |
|
621 |
|
622 EXPORT_C void CAlfLCTAnchorLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
623 { |
|
624 CAlfAnchorLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
625 } |
|
626 |
|
627 #ifdef RD_ALF_IN_PLATFORM |
|
628 TBool CAlfLCTAnchorLayoutHandler::IsParentRelative(TInt aVal) const |
|
629 { |
|
630 return aVal > ELayoutP-ELayoutPRange && aVal <= ELayoutP; |
|
631 } |
|
632 #else //RD_ALF_IN_PLATFORM |
|
633 TBool CAlfLCTAnchorLayoutHandler::IsParentRelative(TInt /*aVal*/) const |
|
634 { |
|
635 return EFalse; |
|
636 } |
|
637 #endif // RD_ALF_IN_PLATFORM |
|
638 |
|
639 #ifdef RD_ALF_IN_PLATFORM |
|
640 void CAlfLCTAnchorLayoutHandler::SetAnchors(CHuiAnchorLayout* aAnchor, TInt aOrdinal, const TAknWindowLineLayout& aLine, const THuiTimedPoint& aTimedPoint) |
|
641 { |
|
642 DoSetAnchors(aAnchor, aOrdinal, aLine.il, aLine.it, aLine.ir, aLine.ib, aTimedPoint); |
|
643 } |
|
644 #else //RD_ALF_IN_PLATFORM |
|
645 void CAlfLCTAnchorLayoutHandler::SetAnchors(CHuiAnchorLayout* /*aAnchor*/, TInt /*aOrdinal*/, const TAknWindowLineLayout& /*aLine*/, const THuiTimedPoint& /*aTimedPoint*/) |
|
646 { |
|
647 } |
|
648 #endif // RD_ALF_IN_PLATFORM |
|
649 |
|
650 #ifdef RD_ALF_IN_PLATFORM |
|
651 void CAlfLCTAnchorLayoutHandler::DoSetAnchors(CHuiAnchorLayout* aLayout, TInt aOrdinal, TInt aLeft, TInt aTop, TInt aRight, TInt aBottom, const THuiTimedPoint& aTimedPoint) |
|
652 { |
|
653 TInt left = aLeft; |
|
654 TInt top = aTop; |
|
655 TInt right = aRight; |
|
656 TInt bottom = aBottom; |
|
657 THuiAnchorOrigin originLeft = EHuiAnchorOriginLeft; |
|
658 THuiAnchorOrigin originTop = EHuiAnchorOriginTop; |
|
659 THuiAnchorOrigin originRight = EHuiAnchorOriginRight; |
|
660 THuiAnchorOrigin originBottom = EHuiAnchorOriginBottom; |
|
661 |
|
662 // when measuring from the opposite anchor, have to change sign |
|
663 if(IsParentRelative(left)) |
|
664 { |
|
665 left = -(ELayoutP - left); |
|
666 originLeft = EHuiAnchorOriginRight; |
|
667 } |
|
668 if(IsParentRelative(top)) |
|
669 { |
|
670 top = -(ELayoutP - top); |
|
671 originTop = EHuiAnchorOriginBottom; |
|
672 } |
|
673 if(IsParentRelative(right)) |
|
674 { |
|
675 right = -(ELayoutP - right); |
|
676 originRight = EHuiAnchorOriginLeft; |
|
677 } |
|
678 if(IsParentRelative(bottom)) |
|
679 { |
|
680 bottom = -(ELayoutP - bottom); |
|
681 originBottom = EHuiAnchorOriginTop; |
|
682 } |
|
683 THuiTimedPoint point(aTimedPoint); |
|
684 |
|
685 point.iX = left; |
|
686 point.iY = top; |
|
687 aLayout->SetAnchor( |
|
688 EHuiAnchorTopLeft, aOrdinal, |
|
689 originLeft, originTop, |
|
690 EHuiAnchorMetricAbsolute, EHuiAnchorMetricAbsolute, |
|
691 point); |
|
692 |
|
693 // right and bottom anchors are still measured in positive x and y |
|
694 point.iX = -right; |
|
695 point.iY = -bottom; |
|
696 aLayout->SetAnchor( |
|
697 EHuiAnchorBottomRight, aOrdinal, |
|
698 originRight, originBottom, |
|
699 EHuiAnchorMetricAbsolute, EHuiAnchorMetricAbsolute, |
|
700 point); |
|
701 } |
|
702 #else // RD_ALF_IN_PLATFORM |
|
703 void CAlfLCTAnchorLayoutHandler::DoSetAnchors(CHuiAnchorLayout* /*aLayout*/, TInt /*aOrdinal*/, TInt /*aLeft*/, TInt /*aTop*/, TInt /*aRight*/, TInt /*aBottom*/, const THuiTimedPoint& /*aTimedPoint*/) |
|
704 { |
|
705 } |
|
706 #endif // RD_ALF_IN_PLATFORM |
|
707 |
|
708 |
|
709 |
|
710 //---------------------------- |
|
711 // grid layout |
|
712 //---------------------------- |
|
713 EXPORT_C MAlfExtension* CAlfGridLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
714 { |
|
715 CAlfGridLayoutHandler* me = new (ELeave) CAlfGridLayoutHandler(aResolver); |
|
716 CleanupStack::PushL(me); |
|
717 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
718 CleanupStack::Pop(); |
|
719 return me; |
|
720 } |
|
721 |
|
722 |
|
723 EXPORT_C CAlfGridLayoutHandler::CAlfGridLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfLayoutHandler(aResolver) |
|
724 { |
|
725 } |
|
726 |
|
727 |
|
728 EXPORT_C void CAlfGridLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
729 { |
|
730 if (!aVisual) |
|
731 { |
|
732 CHuiGridLayout* layout = CHuiGridLayout::AddNewL(aOwner, 0,0, aParentLayout); |
|
733 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
734 } |
|
735 else |
|
736 { |
|
737 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
738 } |
|
739 } |
|
740 |
|
741 |
|
742 EXPORT_C CAlfGridLayoutHandler::~CAlfGridLayoutHandler() |
|
743 { |
|
744 } |
|
745 |
|
746 |
|
747 EXPORT_C void CAlfGridLayoutHandler::Release() |
|
748 { |
|
749 delete this; |
|
750 } |
|
751 |
|
752 |
|
753 EXPORT_C TAny* CAlfGridLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
754 { |
|
755 return CAlfLayoutHandler::GetInterface(aInterface); |
|
756 } |
|
757 |
|
758 |
|
759 EXPORT_C void CAlfGridLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
760 { |
|
761 CHuiGridLayout* gridLayout = static_cast<CHuiGridLayout*>(iVisual); |
|
762 switch (aCommandId) |
|
763 { |
|
764 case EAlfGridLayoutSetColumns: |
|
765 { |
|
766 TInt* count = (TInt*) aInputBuffer.Ptr(); |
|
767 gridLayout->SetColumnsL(*count); |
|
768 break; |
|
769 } |
|
770 |
|
771 case EAlfGridLayoutSetRows: |
|
772 { |
|
773 TInt* count = (TInt*) aInputBuffer.Ptr(); |
|
774 gridLayout->SetRowsL(*count); |
|
775 break; |
|
776 } |
|
777 |
|
778 case EAlfGridLayoutSetColumnWeights: |
|
779 { |
|
780 RArray<TInt> array; |
|
781 CleanupClosePushL( array ); |
|
782 InternalizeL(aInputBuffer, array); |
|
783 gridLayout->SetColumnsL(array); |
|
784 CleanupStack::PopAndDestroy( &array ); |
|
785 break; |
|
786 } |
|
787 |
|
788 case EAlfGridLayoutSetRowsWeights: |
|
789 { |
|
790 RArray<TInt> array; |
|
791 CleanupClosePushL( array ); |
|
792 InternalizeL(aInputBuffer, array); |
|
793 gridLayout->SetRowsL(array); |
|
794 CleanupStack::PopAndDestroy( &array ); |
|
795 break; |
|
796 } |
|
797 |
|
798 case EAlfGridLayoutSetExpanding: |
|
799 { |
|
800 TInt* flags = (TInt*) aInputBuffer.Ptr(); |
|
801 gridLayout->SetExpanding(*flags); |
|
802 break; |
|
803 } |
|
804 |
|
805 case EAlfGridLayoutOrdinalToBlock: |
|
806 { |
|
807 TInt* ordinal = (TInt*) aInputBuffer.Ptr(); |
|
808 TPoint pos(0,0); |
|
809 TPckg<TPoint> posPckg(pos); |
|
810 pos = gridLayout->OrdinalToBlock(*ordinal); |
|
811 aResponse = posPckg; |
|
812 break; |
|
813 } |
|
814 |
|
815 case EAlfGridLayoutColumnCount: |
|
816 { |
|
817 TInt count(0); |
|
818 TPckg<TInt> countPckg(count); |
|
819 count = gridLayout->DimensionCount(EHuiGridColumn); |
|
820 aResponse = countPckg; |
|
821 break; |
|
822 } |
|
823 |
|
824 case EAlfGridLayoutRowCount: |
|
825 { |
|
826 TInt count(0); |
|
827 TPckg<TInt> countPckg(count); |
|
828 count = gridLayout->DimensionCount(EHuiGridRow); |
|
829 aResponse = countPckg; |
|
830 break; |
|
831 } |
|
832 |
|
833 case EAlfGridLayoutFillWeights: |
|
834 { |
|
835 TAlfGridLayoutFillWeightsParams* params = (TAlfGridLayoutFillWeightsParams*)aInputBuffer.Ptr(); |
|
836 THuiGridDimension dim = (THuiGridDimension)params->iDim; |
|
837 THuiMetric metric(params->iWeight.iMagnitude, params->iWeight.iUnit, params->iWeight.iReferenceTextStyleId); |
|
838 gridLayout->FillWeightsL(dim, params->iCount, metric); |
|
839 break; |
|
840 } |
|
841 |
|
842 case EAlfGridLayoutAppendWeight: |
|
843 { |
|
844 TAlfGridLayoutAppendWeightParams* params = (TAlfGridLayoutAppendWeightParams*)aInputBuffer.Ptr(); |
|
845 THuiGridDimension dim = (THuiGridDimension)params->iDim; |
|
846 THuiMetric metric(params->iWeight.iMagnitude, params->iWeight.iUnit, params->iWeight.iReferenceTextStyleId); |
|
847 gridLayout->AppendWeightL(dim, metric); |
|
848 break; |
|
849 } |
|
850 |
|
851 case EAlfGridLayoutInsertWeight: |
|
852 { |
|
853 TAlfGridLayoutInsertWeightParams* params = (TAlfGridLayoutInsertWeightParams*)aInputBuffer.Ptr(); |
|
854 THuiGridDimension dim = (THuiGridDimension)params->iDim; |
|
855 THuiMetric metric(params->iWeight.iMagnitude, params->iWeight.iUnit, params->iWeight.iReferenceTextStyleId); |
|
856 gridLayout->InsertWeightL(dim, metric, params->iPos); |
|
857 break; |
|
858 } |
|
859 |
|
860 case EAlfGridLayoutReplaceWeight: |
|
861 { |
|
862 TAlfGridLayoutReplaceWeightParams* params = (TAlfGridLayoutReplaceWeightParams*)aInputBuffer.Ptr(); |
|
863 THuiGridDimension dim = (THuiGridDimension)params->iDim; |
|
864 THuiMetric metric(params->iWeight.iMagnitude, params->iWeight.iUnit, params->iWeight.iReferenceTextStyleId); |
|
865 gridLayout->ReplaceWeightL(dim, metric, params->iPos); |
|
866 break; |
|
867 } |
|
868 |
|
869 case EAlfGridLayoutRemoveWeight: |
|
870 { |
|
871 TAlfGridLayoutRemoveWeightParams* params = (TAlfGridLayoutRemoveWeightParams*)aInputBuffer.Ptr(); |
|
872 THuiGridDimension dim = (THuiGridDimension)params->iDim; |
|
873 gridLayout->RemoveWeightL(dim, params->iPos); |
|
874 break; |
|
875 } |
|
876 |
|
877 case EAlfGridLayoutWeight: |
|
878 { |
|
879 TAlfGridLayoutWeightParams* params = (TAlfGridLayoutWeightParams*)aInputBuffer.Ptr(); |
|
880 THuiGridDimension dim = (THuiGridDimension)params->iDim; |
|
881 THuiMetric huiWeight = gridLayout->Weight(dim, params->iPos); |
|
882 |
|
883 TAlfMetric alfWeight(huiWeight.iMagnitude, huiWeight.iUnit, huiWeight.iReferenceTextStyleId);; |
|
884 TPckg<TAlfMetric> weightPckg(alfWeight); |
|
885 aResponse = weightPckg; |
|
886 break; |
|
887 } |
|
888 |
|
889 case EAlfGridLayoutCount: |
|
890 { |
|
891 THuiGridDimension* dim = (THuiGridDimension*) aInputBuffer.Ptr(); |
|
892 TInt count(0); |
|
893 TPckg<TInt> countPckg(count); |
|
894 count = gridLayout->DimensionCount(*dim); |
|
895 aResponse = countPckg; |
|
896 break; |
|
897 } |
|
898 |
|
899 case EAlfGridLayoutSetLayoutModeFlags: |
|
900 { |
|
901 TInt2* params = (TInt2*) aInputBuffer.Ptr(); |
|
902 gridLayout->SetLayoutModeFlags((THuiGridDimension)params->iInt1, (TUint)params->iInt2); |
|
903 break; |
|
904 } |
|
905 |
|
906 case EAlfGridLayoutLayoutModeFlags: |
|
907 { |
|
908 THuiGridDimension* dim = (THuiGridDimension*) aInputBuffer.Ptr(); |
|
909 TInt flags(0); |
|
910 TPckg<TInt> flagsPckg(flags); |
|
911 flags = gridLayout->LayoutModeFlags(*dim); |
|
912 aResponse = flagsPckg; |
|
913 break; |
|
914 } |
|
915 |
|
916 case EAlfGridLayoutClearLayoutModeFlags: |
|
917 { |
|
918 TInt2* params = (TInt2*) aInputBuffer.Ptr(); |
|
919 gridLayout->ClearLayoutModeFlags((THuiGridDimension)params->iInt1, (TUint)params->iInt2); |
|
920 break; |
|
921 } |
|
922 |
|
923 default: |
|
924 CAlfLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
925 } |
|
926 |
|
927 } |
|
928 |
|
929 EXPORT_C void CAlfGridLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
930 { |
|
931 CAlfLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
932 } |
|
933 |
|
934 //---------------------------- |
|
935 // LCT grid layout |
|
936 //---------------------------- |
|
937 EXPORT_C MAlfExtension* CAlfLCTGridLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
938 { |
|
939 CAlfLCTGridLayoutHandler* me = new (ELeave) CAlfLCTGridLayoutHandler(aResolver); |
|
940 CleanupStack::PushL(me); |
|
941 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
942 CleanupStack::Pop(); |
|
943 return me; |
|
944 } |
|
945 |
|
946 |
|
947 EXPORT_C CAlfLCTGridLayoutHandler::CAlfLCTGridLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfGridLayoutHandler(aResolver) |
|
948 { |
|
949 } |
|
950 |
|
951 |
|
952 EXPORT_C void CAlfLCTGridLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
953 { |
|
954 if (!aVisual) |
|
955 { |
|
956 CHuiGridLayout* layout = CHuiGridLayout::AddNewL(aOwner, 1, 1, aParentLayout); |
|
957 CAlfGridLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
958 } |
|
959 else |
|
960 { |
|
961 CAlfGridLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
962 } |
|
963 } |
|
964 |
|
965 |
|
966 EXPORT_C CAlfLCTGridLayoutHandler::~CAlfLCTGridLayoutHandler() |
|
967 { |
|
968 } |
|
969 |
|
970 |
|
971 EXPORT_C void CAlfLCTGridLayoutHandler::Release() |
|
972 { |
|
973 delete this; |
|
974 } |
|
975 |
|
976 |
|
977 EXPORT_C TAny* CAlfLCTGridLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
978 { |
|
979 return CAlfGridLayoutHandler::GetInterface(aInterface); |
|
980 } |
|
981 |
|
982 |
|
983 EXPORT_C void CAlfLCTGridLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
984 { |
|
985 switch (aCommandId) |
|
986 { |
|
987 case EAlfLCTGridLayoutSetColsAndRows: |
|
988 { |
|
989 #ifdef RD_ALF_IN_PLATFORM |
|
990 CHuiGridLayout* gridLayout = static_cast<CHuiGridLayout*>(iVisual); |
|
991 TAlfLCTGridSetColsAndRowsParams* params = (TAlfLCTGridSetColsAndRowsParams*)aInputBuffer.Ptr(); |
|
992 |
|
993 TAknLayoutHierarchyComponentHandle handle; |
|
994 handle.SetApiId(params->iApiId); |
|
995 handle.SetComponentId(params->iComponentId); |
|
996 handle.SetVarietyIndex(params->iVarietyIndex); |
|
997 |
|
998 THuiTimedPoint tpoint; |
|
999 AlfTimedPointUtility::CopyTimedPoint(params->iOffset, tpoint, iResolver); |
|
1000 |
|
1001 // get the cols and rows directly from the param limits |
|
1002 // @todo maybe need to use anchors, or set rows and cols by item height? |
|
1003 TAknLayoutScalableParameterLimits limits = AknLayout2Hierarchy::GetParamLimits(handle); |
|
1004 gridLayout->SetColumnsL(limits.LastColumn()+1); |
|
1005 gridLayout->SetRowsL(limits.LastRow()+1); |
|
1006 #endif |
|
1007 break; |
|
1008 } |
|
1009 default: |
|
1010 CAlfGridLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
1011 } |
|
1012 |
|
1013 } |
|
1014 |
|
1015 EXPORT_C void CAlfLCTGridLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
1016 { |
|
1017 CAlfGridLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
1018 } |
|
1019 |
|
1020 //---------------------------- |
|
1021 // deck layout |
|
1022 //---------------------------- |
|
1023 EXPORT_C MAlfExtension* CAlfDeckLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
1024 { |
|
1025 CAlfDeckLayoutHandler* me = new (ELeave) CAlfDeckLayoutHandler(aResolver); |
|
1026 CleanupStack::PushL(me); |
|
1027 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
1028 CleanupStack::Pop(); |
|
1029 return me; |
|
1030 } |
|
1031 |
|
1032 |
|
1033 EXPORT_C CAlfDeckLayoutHandler::CAlfDeckLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfLayoutHandler(aResolver) |
|
1034 { |
|
1035 } |
|
1036 |
|
1037 |
|
1038 EXPORT_C void CAlfDeckLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
1039 { |
|
1040 if (!aVisual) |
|
1041 { |
|
1042 CHuiDeckLayout* layout = CHuiDeckLayout::AddNewL(aOwner, aParentLayout); |
|
1043 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
1044 } |
|
1045 else |
|
1046 { |
|
1047 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
1048 } |
|
1049 } |
|
1050 |
|
1051 |
|
1052 EXPORT_C CAlfDeckLayoutHandler::~CAlfDeckLayoutHandler() |
|
1053 { |
|
1054 } |
|
1055 |
|
1056 EXPORT_C TAny* CAlfDeckLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
1057 { |
|
1058 return CAlfLayoutHandler::GetInterface(aInterface); |
|
1059 } |
|
1060 |
|
1061 |
|
1062 EXPORT_C void CAlfDeckLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
1063 { |
|
1064 CAlfLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
1065 } |
|
1066 |
|
1067 EXPORT_C void CAlfDeckLayoutHandler::Release() |
|
1068 { |
|
1069 delete this; |
|
1070 } |
|
1071 |
|
1072 EXPORT_C void CAlfDeckLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
1073 { |
|
1074 CAlfLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
1075 } |
|
1076 |
|
1077 |
|
1078 //---------------------------- |
|
1079 // flow layout |
|
1080 //---------------------------- |
|
1081 EXPORT_C MAlfExtension* CAlfFlowLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
1082 { |
|
1083 CAlfFlowLayoutHandler* me = new (ELeave) CAlfFlowLayoutHandler(aResolver); |
|
1084 CleanupStack::PushL(me); |
|
1085 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
1086 CleanupStack::Pop(); |
|
1087 return me; |
|
1088 } |
|
1089 |
|
1090 |
|
1091 EXPORT_C CAlfFlowLayoutHandler::CAlfFlowLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfLayoutHandler(aResolver) |
|
1092 { |
|
1093 } |
|
1094 |
|
1095 |
|
1096 EXPORT_C void CAlfFlowLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
1097 { |
|
1098 if (!aVisual) |
|
1099 { |
|
1100 CHuiFlowLayout* layout = CHuiFlowLayout::AddNewL(aOwner, CHuiFlowLayout::EFlowVertical, aParentLayout); |
|
1101 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
1106 } |
|
1107 } |
|
1108 |
|
1109 |
|
1110 EXPORT_C CAlfFlowLayoutHandler::~CAlfFlowLayoutHandler() |
|
1111 { |
|
1112 } |
|
1113 |
|
1114 |
|
1115 EXPORT_C void CAlfFlowLayoutHandler::Release() |
|
1116 { |
|
1117 delete this; |
|
1118 } |
|
1119 |
|
1120 |
|
1121 EXPORT_C TAny* CAlfFlowLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
1122 { |
|
1123 return CAlfLayoutHandler::GetInterface(aInterface); |
|
1124 } |
|
1125 |
|
1126 |
|
1127 EXPORT_C void CAlfFlowLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
1128 { |
|
1129 CHuiFlowLayout* flowLayout = static_cast<CHuiFlowLayout*>(iVisual); |
|
1130 switch (aCommandId) |
|
1131 { |
|
1132 case EAlfFlowLayoutSetFlowDirection: |
|
1133 { |
|
1134 CHuiFlowLayout::TFlowDirection* params = (CHuiFlowLayout::TFlowDirection*) aInputBuffer.Ptr(); |
|
1135 flowLayout->SetFlowDirection( *params ); |
|
1136 break; |
|
1137 } |
|
1138 case EAlfFlowLayoutSetCentering: |
|
1139 { |
|
1140 TBool* params = (TBool*) aInputBuffer.Ptr(); |
|
1141 flowLayout->SetCentering( *params ); |
|
1142 break; |
|
1143 } |
|
1144 case EAlfFlowLayoutSetMode: |
|
1145 { |
|
1146 TInt* params = (TInt*) aInputBuffer.Ptr(); |
|
1147 flowLayout->SetMode( *params ); |
|
1148 break; |
|
1149 } |
|
1150 |
|
1151 default: |
|
1152 CAlfLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
1153 } |
|
1154 } |
|
1155 |
|
1156 |
|
1157 EXPORT_C void CAlfFlowLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
1158 { |
|
1159 CAlfLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
1160 } |
|
1161 |
|
1162 |
|
1163 // CURVE PATH LAYOUT |
|
1164 |
|
1165 |
|
1166 struct CAlfCurvePathLayoutHandler::TCurvePathLayoutPrivateData |
|
1167 { |
|
1168 }; |
|
1169 |
|
1170 EXPORT_C MAlfExtension* CAlfCurvePathLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
1171 { |
|
1172 CAlfCurvePathLayoutHandler* me = new (ELeave) CAlfCurvePathLayoutHandler(aResolver); |
|
1173 CleanupStack::PushL(me); |
|
1174 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
1175 CleanupStack::Pop(); |
|
1176 return me; |
|
1177 } |
|
1178 |
|
1179 EXPORT_C CAlfCurvePathLayoutHandler::CAlfCurvePathLayoutHandler(MAlfInterfaceProvider& aResolver) |
|
1180 :CAlfLayoutHandler(aResolver) |
|
1181 { |
|
1182 } |
|
1183 |
|
1184 EXPORT_C void CAlfCurvePathLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
1185 { |
|
1186 if (!aVisual) |
|
1187 { |
|
1188 CHuiCurvePathLayout* layout = CHuiCurvePathLayout::AddNewL(aOwner, aParentLayout); |
|
1189 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
1190 } |
|
1191 else |
|
1192 { |
|
1193 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
1194 } |
|
1195 |
|
1196 // Not needed currently |
|
1197 //iCurvePathLayoutPrivateData = new (ELeave) TCurvePathLayoutPrivateData; |
|
1198 } |
|
1199 |
|
1200 EXPORT_C CAlfCurvePathLayoutHandler::~CAlfCurvePathLayoutHandler() |
|
1201 { |
|
1202 if ( iCurvePathLayoutPrivateData ) |
|
1203 { |
|
1204 // Delete private data (not used currently) |
|
1205 } |
|
1206 delete iCurvePathLayoutPrivateData; |
|
1207 iCurvePathLayoutPrivateData = NULL; |
|
1208 } |
|
1209 |
|
1210 EXPORT_C void CAlfCurvePathLayoutHandler::Release() |
|
1211 { |
|
1212 delete this; |
|
1213 } |
|
1214 |
|
1215 EXPORT_C TAny* CAlfCurvePathLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
1216 { |
|
1217 CHuiCurvePathLayout* curvePathLayout = static_cast<CHuiCurvePathLayout*>(iVisual); |
|
1218 |
|
1219 switch ( aInterface ) |
|
1220 { |
|
1221 case EHuiInterfaceMappingFunction: |
|
1222 return static_cast<MHuiMappingFunction*>(curvePathLayout); |
|
1223 case EHuiObjectTypeCurvePathProvider: |
|
1224 return &curvePathLayout->CurvePath(); |
|
1225 default: |
|
1226 return CAlfLayoutHandler::GetInterface(aInterface); |
|
1227 } |
|
1228 } |
|
1229 |
|
1230 EXPORT_C void CAlfCurvePathLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
1231 { |
|
1232 CHuiCurvePathLayout* curvePathLayout = static_cast<CHuiCurvePathLayout*>(iVisual); |
|
1233 |
|
1234 switch( aCommandId ) |
|
1235 { |
|
1236 case EAlfCurvePathLayoutMapValue: |
|
1237 { |
|
1238 TIntTReal* mapValues = (TIntTReal*) aInputBuffer.Ptr(); |
|
1239 const TReal32 returnValue = curvePathLayout->MapValue( mapValues->iReal, mapValues->iInt ); |
|
1240 TPckg<TReal32> returnValuePckg(returnValue); |
|
1241 aResponse = returnValuePckg; |
|
1242 break; |
|
1243 } |
|
1244 default: |
|
1245 CAlfLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
1246 break; |
|
1247 } |
|
1248 } |
|
1249 |
|
1250 EXPORT_C void CAlfCurvePathLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
1251 { |
|
1252 CAlfLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
1253 } |
|
1254 |
|
1255 //---------------------------- |
|
1256 // viewport layout |
|
1257 //---------------------------- |
|
1258 EXPORT_C MAlfExtension* CAlfViewportLayoutHandler::NewL(MAlfInterfaceProvider& aResolver, CHuiControl* aOwner, CHuiLayout* aParentLayout) |
|
1259 { |
|
1260 CAlfViewportLayoutHandler* me = new (ELeave) CAlfViewportLayoutHandler(aResolver); |
|
1261 CleanupStack::PushL(me); |
|
1262 me->ConstructL(NULL, *aOwner, aParentLayout); |
|
1263 CleanupStack::Pop(); |
|
1264 return me; |
|
1265 } |
|
1266 |
|
1267 |
|
1268 EXPORT_C CAlfViewportLayoutHandler::CAlfViewportLayoutHandler(MAlfInterfaceProvider& aResolver):CAlfLayoutHandler(aResolver) |
|
1269 { |
|
1270 } |
|
1271 |
|
1272 |
|
1273 EXPORT_C void CAlfViewportLayoutHandler::ConstructL(CHuiVisual* aVisual, CHuiControl& aOwner, CHuiLayout* aParentLayout) |
|
1274 { |
|
1275 if (!aVisual) |
|
1276 { |
|
1277 CHuiViewportLayout* layout = CHuiViewportLayout::AddNewL(aOwner, aParentLayout); |
|
1278 CAlfLayoutHandler::ConstructL(layout, aOwner, aParentLayout); |
|
1279 } |
|
1280 else |
|
1281 { |
|
1282 CAlfLayoutHandler::ConstructL(aVisual, aOwner, aParentLayout); |
|
1283 } |
|
1284 } |
|
1285 |
|
1286 |
|
1287 EXPORT_C CAlfViewportLayoutHandler::~CAlfViewportLayoutHandler() |
|
1288 { |
|
1289 } |
|
1290 |
|
1291 EXPORT_C void CAlfViewportLayoutHandler::Release() |
|
1292 { |
|
1293 delete this; |
|
1294 } |
|
1295 |
|
1296 |
|
1297 EXPORT_C TAny* CAlfViewportLayoutHandler::GetInterface(const THuiInterfaceSupport& aInterface) |
|
1298 { |
|
1299 return CAlfLayoutHandler::GetInterface(aInterface); |
|
1300 } |
|
1301 |
|
1302 |
|
1303 EXPORT_C void CAlfViewportLayoutHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) |
|
1304 { |
|
1305 CHuiViewportLayout* viewportLayout = static_cast<CHuiViewportLayout*>(iVisual); |
|
1306 switch (aCommandId) |
|
1307 { |
|
1308 case EAlfViewportLayoutSetVirtualSize: |
|
1309 { |
|
1310 TAlfTimedPoint* newSize = (TAlfTimedPoint*) aInputBuffer.Ptr(); |
|
1311 |
|
1312 THuiTimedPoint tpoint; |
|
1313 AlfTimedPointUtility::CopyTimedPoint(*newSize, tpoint, iResolver); |
|
1314 |
|
1315 viewportLayout->SetVirtualSize(tpoint.RealTarget().AsSize(), HUI_ROUND_FLOAT_TO_INT(newSize->TimeToTargetinMilliSeconds().iX)); |
|
1316 break; |
|
1317 } |
|
1318 |
|
1319 case EAlfViewportLayoutSetViewportSize: |
|
1320 { |
|
1321 TAlfTimedPoint* newSize = (TAlfTimedPoint*) aInputBuffer.Ptr(); |
|
1322 |
|
1323 THuiTimedPoint tpoint; |
|
1324 AlfTimedPointUtility::CopyTimedPoint(*newSize, tpoint, iResolver); |
|
1325 viewportLayout->SetViewportSize(tpoint.RealTarget().AsSize(), HUI_ROUND_FLOAT_TO_INT(newSize->TimeToTargetinMilliSeconds().iX)); |
|
1326 break; |
|
1327 } |
|
1328 |
|
1329 case EAlfViewportLayoutSetViewportPos: |
|
1330 { |
|
1331 TAlfTimedPoint* newPos = (TAlfTimedPoint*) aInputBuffer.Ptr(); |
|
1332 |
|
1333 THuiTimedPoint tpoint; |
|
1334 AlfTimedPointUtility::CopyTimedPoint(*newPos, tpoint, iResolver); |
|
1335 viewportLayout->SetViewportPos(tpoint.RealTarget(), HUI_ROUND_FLOAT_TO_INT(newPos->TimeToTargetinMilliSeconds().iX)); |
|
1336 break; |
|
1337 } |
|
1338 |
|
1339 default: |
|
1340 CAlfLayoutHandler::HandleCmdL(aCommandId, aInputBuffer, aResponse); |
|
1341 } |
|
1342 } |
|
1343 |
|
1344 EXPORT_C void CAlfViewportLayoutHandler::VisualHandlerExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
|
1345 { |
|
1346 CAlfLayoutHandler::VisualHandlerExtension(aExtensionUid, aExtensionParameters); |
|
1347 } |
|
1348 |
|
1349 |
|
1350 // end of file |