textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbasecontrol.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 11 c8fb4cf7b3ae
child 13 1bbdde98cc2d
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
   320 // (other items were commented in a header).
   320 // (other items were commented in a header).
   321 // ---------------------------------------------------------------------------
   321 // ---------------------------------------------------------------------------
   322 //    	
   322 //    	
   323 EXPORT_C void CFepUiBaseCtrl::DrawMaskBackground(TBool aBmpStretchFlag)
   323 EXPORT_C void CFepUiBaseCtrl::DrawMaskBackground(TBool aBmpStretchFlag)
   324 	{
   324 	{
   325 	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), iBkMaskBmp, iMaskBkCol,
   325 	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), BkMaskBmp(), iMaskBkCol,
   326 	                       iBorderColor,aBmpStretchFlag);
   326 	                       iBorderColor,aBmpStretchFlag);
   327 	}
   327 	}
   328 
   328 
   329 // ---------------------------------------------------------------------------
   329 // ---------------------------------------------------------------------------
   330 // CFepUiBaseCtrl::DrawOpaqueMaskBackground
   330 // CFepUiBaseCtrl::DrawOpaqueMaskBackground
   333 // ---------------------------------------------------------------------------
   333 // ---------------------------------------------------------------------------
   334 //    		
   334 //    		
   335 EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(TBool aBmpStretchFlag)
   335 EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(TBool aBmpStretchFlag)
   336 	{
   336 	{
   337 	const TRgb KOpaqueMask = TRgb(KOpaqueColor);
   337 	const TRgb KOpaqueMask = TRgb(KOpaqueColor);
   338 	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), iBkMaskBmp, KOpaqueMask,
   338 	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), BkMaskBmp(), KOpaqueMask,
   339 	                       KOpaqueMask,aBmpStretchFlag);
   339 	                       KOpaqueMask,aBmpStretchFlag);
   340 	}
   340 	}
   341 
   341 
   342 // ---------------------------------------------------------------------------
   342 // ---------------------------------------------------------------------------
   343 // CFepUiBaseCtrl::DrawOpaqueMaskBackground
   343 // CFepUiBaseCtrl::DrawOpaqueMaskBackground
   346 // ---------------------------------------------------------------------------
   346 // ---------------------------------------------------------------------------
   347 //    		
   347 //    		
   348 EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(const TRect aRect, TBool aBmpStretchFlag)
   348 EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(const TRect aRect, TBool aBmpStretchFlag)
   349 	{
   349 	{
   350 	const TRgb KOpaqueMask = TRgb(KOpaqueColor);
   350 	const TRgb KOpaqueMask = TRgb(KOpaqueColor);
   351 	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), iBkMaskBmp,
   351 	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), BkMaskBmp(),
   352 	                       KOpaqueMask, KOpaqueMask, aBmpStretchFlag);
   352 	                       KOpaqueMask, KOpaqueMask, aBmpStretchFlag);
   353 	}
   353 	}
   354 
   354 
   355 // ---------------------------------------------------------------------------
   355 // ---------------------------------------------------------------------------
   356 // CFepUiBaseCtrl::DrawTransparentMaskBackground
   356 // CFepUiBaseCtrl::DrawTransparentMaskBackground
   360 //    		
   360 //    		
   361 EXPORT_C void CFepUiBaseCtrl::DrawTransparentMaskBackground(const TRect& aRect,
   361 EXPORT_C void CFepUiBaseCtrl::DrawTransparentMaskBackground(const TRect& aRect,
   362                                                             TBool aBmpStretchFlag)
   362                                                             TBool aBmpStretchFlag)
   363 	{
   363 	{
   364 	const TRgb KOpaqueMask = TRgb(KTransparentColor);
   364 	const TRgb KOpaqueMask = TRgb(KTransparentColor);
   365 	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), iBkMaskBmp, KTransparentColor,
   365 	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), BkMaskBmp(), KTransparentColor,
   366 	                       KTransparentColor, aBmpStretchFlag);
   366 	                       KTransparentColor, aBmpStretchFlag);
   367 	}
   367 	}
   368 	
   368 	
   369 // ---------------------------------------------------------------------------
   369 // ---------------------------------------------------------------------------
   370 // CFepUiBaseCtrl::ClearRect
   370 // CFepUiBaseCtrl::ClearRect
   696     {
   696     {
   697     return IsOnTopOf(aCtrl);
   697     return IsOnTopOf(aCtrl);
   698     }
   698     }
   699 
   699 
   700 TBool CFepUiBaseCtrl::IsOnTopOf(CFepUiBaseCtrl* aCtrl)
   700 TBool CFepUiBaseCtrl::IsOnTopOf(CFepUiBaseCtrl* aCtrl)
   701     {           
   701     {     
       
   702     __ASSERT_DEBUG(aCtrl,EUiNullParam);      
   702     return OrderPos() < aCtrl->OrderPos();
   703     return OrderPos() < aCtrl->OrderPos();
   703     }
   704     }
   704     
   705     
   705     
   706     
   706 TBool CFepUiBaseCtrl::Overlapped(CFepUiBaseCtrl* aCtrl)
   707 TBool CFepUiBaseCtrl::Overlapped(CFepUiBaseCtrl* aCtrl)
  1255     iShadowBmp[aIndex+KShadowBitmapTotalNum] = aMaskBmp;
  1256     iShadowBmp[aIndex+KShadowBitmapTotalNum] = aMaskBmp;
  1256     }
  1257     }
  1257 
  1258 
  1258 EXPORT_C TBool CFepUiBaseCtrl::AbleToDraw()
  1259 EXPORT_C TBool CFepUiBaseCtrl::AbleToDraw()
  1259 	{
  1260 	{
  1260     return UiLayout()->LayoutReady() && Ready() && !WholeHiden() && Rect().Size() != TSize(0,0);
  1261     return UiLayout()->LayoutReady() && Ready()  
       
  1262             && (!UiLayout()->iExtension->iDisableDrawing)
       
  1263                     && !WholeHiden() && Rect().Size() != TSize(0,0);
  1261 	}
  1264 	}
  1262 
  1265 
  1263 // ---------------------------------------------------------------------------
  1266 // ---------------------------------------------------------------------------
  1264 // Get extension
  1267 // Get extension
  1265 // ---------------------------------------------------------------------------
  1268 // ---------------------------------------------------------------------------
  1266 //    
  1269 //    
  1267 EXPORT_C TInt CFepUiBaseCtrl::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1)
  1270 EXPORT_C TInt CFepUiBaseCtrl::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1)
  1268     {
  1271     {    
  1269     //not implemented, use CBase's
  1272     if( KFepCtrlExtId == aExtensionId)
       
  1273         {
       
  1274         a0 = iExtension;
       
  1275         return KErrNone;
       
  1276         }
  1270     return CBase::Extension_(aExtensionId, a0, a1);
  1277     return CBase::Extension_(aExtensionId, a0, a1);
  1271     }
  1278     }
  1272     
  1279     
  1273 // ---------------------------------------------------------------------------
  1280 // ---------------------------------------------------------------------------
  1274 // CFepUiBaseCtrl::WholeHiden
  1281 // CFepUiBaseCtrl::WholeHiden
  1346     }
  1353     }
  1347 
  1354 
  1348 
  1355 
  1349 EXPORT_C void CFepUiBaseCtrl::SetParent(CFepUiBaseCtrl* aParent)
  1356 EXPORT_C void CFepUiBaseCtrl::SetParent(CFepUiBaseCtrl* aParent)
  1350     {
  1357     {
  1351     //parent control must be type of control group.    
  1358     //parent control must be type of control group.
       
  1359     if(aParent)
       
  1360         {
       
  1361         __ASSERT_DEBUG(aParent->IsKindOfControl(ECtrlControlGroup),EUiLayoutBadParentType);
       
  1362         } 
  1352     iParentCtrl = aParent;
  1363     iParentCtrl = aParent;
  1353     }
  1364     }
  1354 
  1365 
  1355 EXPORT_C void CFepUiBaseCtrl::SetOrdinalPos(TInt aPos)
  1366 EXPORT_C void CFepUiBaseCtrl::SetOrdinalPos(TInt aPos)
  1356     {
  1367     {
  1362     TInt order = OrderPos();
  1373     TInt order = OrderPos();
  1363     if(ParentCtrl())
  1374     if(ParentCtrl())
  1364         order += ParentCtrl()->AbsOrderPos();
  1375         order += ParentCtrl()->AbsOrderPos();
  1365     return order;    
  1376     return order;    
  1366     }
  1377     }
       
  1378 
       
  1379 void CFepUiBaseCtrl::CreateOwnDeviceL(CFbsBitmap* aBmp, CFbsBitmap* aMaskBmp)
       
  1380     {
       
  1381     if(iExtension->iBitmap)
       
  1382         return;
       
  1383     User::LeaveIfError( aBmp->Create( Rect().Size(), iLayoutOwner->BitmapDevice()->DisplayMode() ) );
       
  1384     
       
  1385     iExtension->iBitmap = aBmp;
       
  1386     CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(aBmp);
       
  1387     
       
  1388     iExtension->SetBmpDevice(dev); 
       
  1389 
       
  1390     CFbsBitGc* gc = CFbsBitGc::NewL();
       
  1391     gc->Reset();
       
  1392     iExtension->SetGc(gc);
       
  1393     
       
  1394     if(iExtension->iMaskBitmap || !aMaskBmp)
       
  1395         return;
       
  1396     
       
  1397     User::LeaveIfError( aMaskBmp->Create( Rect().Size(), iLayoutOwner->MaskBmpDevice()->DisplayMode() ) );
       
  1398     
       
  1399     iExtension->iMaskBitmap = aMaskBmp;
       
  1400     dev = CFbsBitmapDevice::NewL(aMaskBmp);
       
  1401     
       
  1402     iExtension->SetMaskBmpDevice(dev); 
       
  1403         
       
  1404     }
       
  1405     
       
  1406 void CFepUiBaseCtrl::ResizeDeviceL()
       
  1407     {
       
  1408     if(iExtension->BitmapDevice())
       
  1409         iExtension->BitmapDevice()->Resize( Rect().Size());
       
  1410     //gc must be adjusted
       
  1411     if(iExtension->Gc())
       
  1412         {
       
  1413         iExtension->Gc()->Activate(iExtension->BitmapDevice());
       
  1414         iExtension->Gc()->Resized();
       
  1415         }
       
  1416     }
       
  1417     
       
  1418 // ---------------------------------------------------------------------------
       
  1419 // get graphics context for sprite or window
       
  1420 // ---------------------------------------------------------------------------
       
  1421 //   
       
  1422 EXPORT_C CBitmapContext* CFepUiBaseCtrl::BitGc()
       
  1423     {
       
  1424 
       
  1425 
       
  1426     if(iUiLayout->NotDrawToLayoutDevice() && iExtension->Gc())
       
  1427         return iExtension->Gc();
       
  1428     else
       
  1429 	    return iLayoutOwner->BitmapContext();
       
  1430     }
       
  1431 
       
  1432 // ---------------------------------------------------------------------------
       
  1433 // get Bitmap device for sprite or window
       
  1434 // ---------------------------------------------------------------------------
       
  1435 //
       
  1436 EXPORT_C CFbsBitmapDevice* CFepUiBaseCtrl::BitmapDevice()
       
  1437     {
       
  1438 
       
  1439 
       
  1440     if(iUiLayout->NotDrawToLayoutDevice() && iExtension->BitmapDevice())
       
  1441         return iExtension->BitmapDevice();
       
  1442     else   
       
  1443         return iLayoutOwner->BitmapDevice();
       
  1444     }
       
  1445 
       
  1446 // ---------------------------------------------------------------------------
       
  1447 // get Mask bitmap device for sprite or window
       
  1448 // ---------------------------------------------------------------------------
       
  1449 //
       
  1450 EXPORT_C CFbsBitmapDevice* CFepUiBaseCtrl::MaskBitmapDevice()
       
  1451     {
       
  1452 
       
  1453     if(iUiLayout->NotDrawToLayoutDevice() && iExtension->MaskBitmapDevice())
       
  1454         return iExtension->MaskBitmapDevice();
       
  1455     else    
       
  1456 
       
  1457         return iLayoutOwner->MaskBmpDevice();
       
  1458     }
       
  1459 
       
  1460 // ---------------------------------------------------------------------------
       
  1461 // get control background maks bmp
       
  1462 // ---------------------------------------------------------------------------
       
  1463 //
       
  1464 EXPORT_C  CFbsBitmap* CFepUiBaseCtrl::BkMaskBmp()
       
  1465     {
       
  1466     if(iUiLayout->NotDrawToLayoutDevice() && iExtension->MaskBitmap())
       
  1467         return iExtension->MaskBitmap();
       
  1468     else 
       
  1469         return iBkMaskBmp;
       
  1470     }
       
  1471 
  1367 
  1472 
  1368 // ---------------------------------------------------------------------------
  1473 // ---------------------------------------------------------------------------
  1369 // CFepUiBaseCtrl::EnableExtResponseArea
  1474 // CFepUiBaseCtrl::EnableExtResponseArea
  1370 // Enable/disable extra response area support
  1475 // Enable/disable extra response area support
  1371 // ---------------------------------------------------------------------------
  1476 // ---------------------------------------------------------------------------
  1450     iExtResponseArea.SetRect( TPoint(0,0), TSize(0,0) );
  1555     iExtResponseArea.SetRect( TPoint(0,0), TSize(0,0) );
  1451     iExtResponseAreaEnabled = EFalse;
  1556     iExtResponseAreaEnabled = EFalse;
  1452     iExtResponseAreaMargin.SetRect( TPoint(0,0), TSize(0,0) );
  1557     iExtResponseAreaMargin.SetRect( TPoint(0,0), TSize(0,0) );
  1453 	}
  1558 	}
  1454 
  1559 
       
  1560 CFepUiBaseCtrl::CFepUiBaseCtrlExtension::~CFepUiBaseCtrlExtension()
       
  1561     {
       
  1562     //delete iBitmap;
       
  1563     delete iGc;
       
  1564     delete  iBitmapDevice;
       
  1565     delete iMaskBitmapDevice;
       
  1566     }
       
  1567 	
  1455 void CFepUiBaseCtrl::CFepUiBaseCtrlExtension::SetTactileFeedbackType(TInt aTactileType)
  1568 void CFepUiBaseCtrl::CFepUiBaseCtrlExtension::SetTactileFeedbackType(TInt aTactileType)
  1456 	{
  1569 	{
  1457 #ifdef RD_TACTILE_FEEDBACK
  1570 #ifdef RD_TACTILE_FEEDBACK
  1458 	iTactileType = aTactileType;
  1571 	iTactileType = aTactileType;
  1459 #endif // RD_TACTILE_FEEDBACK 
  1572 #endif // RD_TACTILE_FEEDBACK