57 iAllowOverlap(EFalse), |
57 iAllowOverlap(EFalse), |
58 iUiLayout(aUiLayout), |
58 iUiLayout(aUiLayout), |
59 iOwnWndCtrl(ETrue), |
59 iOwnWndCtrl(ETrue), |
60 iOrdinalPos(EOrderNomal) |
60 iOrdinalPos(EOrderNomal) |
61 { |
61 { |
62 #ifdef RD_TACTILE_FEEDBACK |
62 //todo code refactoring needed, move to BaseConstructL |
63 iReservered1 = reinterpret_cast<TInt>(new CFepUiBaseCtrlExtension(ETouchFeedbackNone)); |
63 iExtension = new CFepUiBaseCtrlExtension(); |
64 #endif // RD_TACTILE_FEEDBACK |
64 |
65 iPenSize.SetSize(1,1); |
65 iPenSize.SetSize(1,1); |
66 iBorderSize.SetSize(KDefaultFrameWidth,KDefaultFrameWidth); |
66 iBorderSize.SetSize(KDefaultFrameWidth,KDefaultFrameWidth); |
67 iValidRegion.AddRect(iRect); |
67 iValidRegion.AddRect(iRect); |
68 iClipRegion.AddRect(iRect); |
68 iClipRegion.AddRect(iRect); |
69 } |
69 } |
92 iIsActive(EFalse), |
92 iIsActive(EFalse), |
93 iAllowOverlap(EFalse), |
93 iAllowOverlap(EFalse), |
94 iUiLayout(aUiLayout), |
94 iUiLayout(aUiLayout), |
95 iOwnWndCtrl(aOwnership) |
95 iOwnWndCtrl(aOwnership) |
96 { |
96 { |
97 #ifdef RD_TACTILE_FEEDBACK |
97 //todo code refactoring needed, move to BaseConstructL |
98 iReservered1 = reinterpret_cast<TInt>(new CFepUiBaseCtrlExtension(ETouchFeedbackNone)); |
98 iExtension = new CFepUiBaseCtrlExtension(); |
99 #endif // RD_TACTILE_FEEDBACK |
99 |
100 iRect = aControl->Rect(); |
100 iRect = aControl->Rect(); |
101 iControlId = aControl->UniqueHandle(); |
101 iControlId = aControl->UniqueHandle(); |
102 iValidRegion.AddRect(iRect); |
102 iValidRegion.AddRect(iRect); |
103 iClipRegion.AddRect(iRect); |
103 iClipRegion.AddRect(iRect); |
104 } |
104 } |
126 |
126 |
127 #ifdef RD_TACTILE_FEEDBACK |
127 #ifdef RD_TACTILE_FEEDBACK |
128 //de-register the area for tactile feedback |
128 //de-register the area for tactile feedback |
129 //if(aUiLayout) //there must be aUiLayout |
129 //if(aUiLayout) //there must be aUiLayout |
130 UiLayout()->DeRegisterFeedbackArea(reinterpret_cast<TInt>(this), Rect()); |
130 UiLayout()->DeRegisterFeedbackArea(reinterpret_cast<TInt>(this), Rect()); |
131 delete reinterpret_cast<CFepUiBaseCtrlExtension*>(iReservered1); |
|
132 #endif // RD_TACTILE_FEEDBACK |
131 #endif // RD_TACTILE_FEEDBACK |
|
132 |
|
133 delete iExtension; |
133 } |
134 } |
134 |
135 |
135 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
136 // CFepUiBaseCtrl::BaseConstructL |
137 // CFepUiBaseCtrl::BaseConstructL |
137 // Handle UI event |
138 // Handle UI event |
533 // (other items were commented in a header). |
534 // (other items were commented in a header). |
534 // --------------------------------------------------------------------------- |
535 // --------------------------------------------------------------------------- |
535 // |
536 // |
536 EXPORT_C TBool CFepUiBaseCtrl::Contains(const TPoint& aPt) |
537 EXPORT_C TBool CFepUiBaseCtrl::Contains(const TPoint& aPt) |
537 { |
538 { |
|
539 if( iExtension->iExtResponseAreaActive ) |
|
540 { |
|
541 return iExtension->iExtResponseArea.Contains( aPt ); |
|
542 } |
|
543 |
538 return iRect.Contains(aPt); |
544 return iRect.Contains(aPt); |
539 //return iValidRegion.Contains(aPt); |
545 //return iValidRegion.Contains(aPt); |
540 } |
546 } |
541 |
547 |
542 // --------------------------------------------------------------------------- |
548 // --------------------------------------------------------------------------- |
841 // (other items were commented in a header). |
857 // (other items were commented in a header). |
842 // --------------------------------------------------------------------------- |
858 // --------------------------------------------------------------------------- |
843 // |
859 // |
844 EXPORT_C void CFepUiBaseCtrl::CancelPointerDownL() |
860 EXPORT_C void CFepUiBaseCtrl::CancelPointerDownL() |
845 { |
861 { |
|
862 if ( iExtension->iExtResponseAreaActive ) |
|
863 { |
|
864 CancelExtResponseArea(); |
|
865 } |
|
866 |
846 if (PointerDown()) |
867 if (PointerDown()) |
847 { |
868 { |
848 iPointerDown = EFalse; |
869 iPointerDown = EFalse; |
849 iPointerLeft = EFalse; |
870 iPointerLeft = EFalse; |
850 //HandlePointerLeave(TPoint(0, 0)); |
871 //HandlePointerLeave(TPoint(0, 0)); |
998 // Handle pointer enter event |
1024 // Handle pointer enter event |
999 // --------------------------------------------------------------------------- |
1025 // --------------------------------------------------------------------------- |
1000 // |
1026 // |
1001 EXPORT_C void CFepUiBaseCtrl::HandlePointerEnter(const TPoint& aPt) |
1027 EXPORT_C void CFepUiBaseCtrl::HandlePointerEnter(const TPoint& aPt) |
1002 { |
1028 { |
|
1029 if ( iExtension->iExtResponseAreaEnabled ) |
|
1030 { |
|
1031 ActiveExtResponseArea(); |
|
1032 } |
|
1033 |
1003 iPointerDown = ETrue; |
1034 iPointerDown = ETrue; |
1004 iPointerLeft = EFalse; |
1035 iPointerLeft = EFalse; |
1005 TRAP_IGNORE(HandlePointerMoveEventL(aPt)); |
1036 TRAP_IGNORE(HandlePointerMoveEventL(aPt)); |
1006 //report event |
1037 //report event |
1007 ReportEvent(EEventPointerEnterControl); |
1038 ReportEvent(EEventPointerEnterControl); |
1332 if(ParentCtrl()) |
1363 if(ParentCtrl()) |
1333 order += ParentCtrl()->AbsOrderPos(); |
1364 order += ParentCtrl()->AbsOrderPos(); |
1334 return order; |
1365 return order; |
1335 } |
1366 } |
1336 |
1367 |
1337 |
1368 // --------------------------------------------------------------------------- |
|
1369 // CFepUiBaseCtrl::EnableExtResponseArea |
|
1370 // Enable/disable extra response area support |
|
1371 // --------------------------------------------------------------------------- |
|
1372 // |
|
1373 EXPORT_C void CFepUiBaseCtrl::EnableExtResponseArea( TBool aEnable, |
|
1374 const TRect& aExtMargin ) |
|
1375 { |
|
1376 iExtension->iExtResponseAreaEnabled = aEnable; |
|
1377 iExtension->iExtResponseAreaMargin = aExtMargin; |
|
1378 } |
|
1379 |
|
1380 // --------------------------------------------------------------------------- |
|
1381 // CFepUiBaseCtrl::EnableExtResponseArea |
|
1382 // Active extra response area |
|
1383 // --------------------------------------------------------------------------- |
|
1384 // |
|
1385 EXPORT_C void CFepUiBaseCtrl::ActiveExtResponseArea() |
|
1386 { |
|
1387 if ( iExtension->iExtResponseAreaEnabled ) |
|
1388 { |
|
1389 TRect response = Rect(); |
|
1390 response.iTl -= iExtension->iExtResponseAreaMargin.iTl; |
|
1391 response.iBr += iExtension->iExtResponseAreaMargin.Size(); |
|
1392 |
|
1393 UpdateExtResponseArea( response ); |
|
1394 } |
|
1395 } |
|
1396 |
|
1397 // --------------------------------------------------------------------------- |
|
1398 // CFepUiBaseCtrl::EnableExtResponseArea |
|
1399 // Cancel extra response area |
|
1400 // --------------------------------------------------------------------------- |
|
1401 // |
|
1402 EXPORT_C void CFepUiBaseCtrl::CancelExtResponseArea() |
|
1403 { |
|
1404 iExtension->iExtResponseAreaActive = EFalse; |
|
1405 |
|
1406 CFepUiBaseCtrl* parent = ParentCtrl(); |
|
1407 if( parent && parent->IsKindOfControl(ECtrlControlGroup) ) |
|
1408 { |
|
1409 parent->CancelExtResponseArea(); |
|
1410 } |
|
1411 } |
|
1412 |
|
1413 // --------------------------------------------------------------------------- |
|
1414 // CFepUiBaseCtrl::EnableExtResponseArea |
|
1415 // Update extra response area |
|
1416 // --------------------------------------------------------------------------- |
|
1417 // |
|
1418 void CFepUiBaseCtrl::UpdateExtResponseArea( const TRect& aRect ) |
|
1419 { |
|
1420 if ( aRect.iTl.iX < Rect().iTl.iX || aRect.iTl.iY < Rect().iTl.iY || |
|
1421 aRect.iBr.iX > Rect().iBr.iX || aRect.iBr.iY > Rect().iBr.iY ) |
|
1422 { |
|
1423 iExtension->iExtResponseAreaActive = ETrue; |
|
1424 iExtension->iExtResponseArea = Rect(); |
|
1425 iExtension->iExtResponseArea.BoundingRect( aRect ); |
|
1426 |
|
1427 //update parent |
|
1428 CFepUiBaseCtrl* parent = ParentCtrl(); |
|
1429 if ( parent && parent->IsKindOfControl( ECtrlControlGroup ) ) |
|
1430 { |
|
1431 parent->UpdateExtResponseArea( iExtension->iExtResponseArea ); |
|
1432 } |
|
1433 } |
|
1434 } |
1338 |
1435 |
1339 // --------------------------------------------------------------------------- |
1436 // --------------------------------------------------------------------------- |
1340 // CFepUiBaseCtrl::CFepUiBaseCtrlExtension |
1437 // CFepUiBaseCtrl::CFepUiBaseCtrlExtension |
1341 // |
1438 // |
1342 // --------------------------------------------------------------------------- |
1439 // --------------------------------------------------------------------------- |
1343 // |
1440 // |
1344 |
1441 |
1345 CFepUiBaseCtrl::CFepUiBaseCtrlExtension::CFepUiBaseCtrlExtension(TInt aTactileType) |
1442 CFepUiBaseCtrl::CFepUiBaseCtrlExtension::CFepUiBaseCtrlExtension() |
1346 { |
1443 { |
1347 #ifdef RD_TACTILE_FEEDBACK |
1444 #ifdef RD_TACTILE_FEEDBACK |
1348 iTactileType = aTactileType; |
1445 iTactileType = ETouchFeedbackNone; |
1349 #endif // RD_TACTILE_FEEDBACK |
1446 #endif // RD_TACTILE_FEEDBACK |
|
1447 |
|
1448 //temp code, can be removed after refactoring of CFepUiBaseCtrl::iExtension |
|
1449 iExtResponseAreaActive = EFalse; |
|
1450 iExtResponseArea.SetRect( TPoint(0,0), TSize(0,0) ); |
|
1451 iExtResponseAreaEnabled = EFalse; |
|
1452 iExtResponseAreaMargin.SetRect( TPoint(0,0), TSize(0,0) ); |
1350 } |
1453 } |
1351 |
1454 |
1352 void CFepUiBaseCtrl::CFepUiBaseCtrlExtension::SetTactileFeedbackType(TInt aTactileType) |
1455 void CFepUiBaseCtrl::CFepUiBaseCtrlExtension::SetTactileFeedbackType(TInt aTactileType) |
1353 { |
1456 { |
1354 #ifdef RD_TACTILE_FEEDBACK |
1457 #ifdef RD_TACTILE_FEEDBACK |