textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbasecontrol.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 11 c8fb4cf7b3ae
child 13 1bbdde98cc2d
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbasecontrol.cpp	Tue May 11 16:31:42 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbasecontrol.cpp	Tue May 25 13:03:44 2010 +0300
@@ -322,7 +322,7 @@
 //    	
 EXPORT_C void CFepUiBaseCtrl::DrawMaskBackground(TBool aBmpStretchFlag)
 	{
-	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), iBkMaskBmp, iMaskBkCol,
+	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), BkMaskBmp(), iMaskBkCol,
 	                       iBorderColor,aBmpStretchFlag);
 	}
 
@@ -335,7 +335,7 @@
 EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(TBool aBmpStretchFlag)
 	{
 	const TRgb KOpaqueMask = TRgb(KOpaqueColor);
-	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), iBkMaskBmp, KOpaqueMask,
+	DrawBackgroundToDevice(iRect,MaskBitmapDevice(), BkMaskBmp(), KOpaqueMask,
 	                       KOpaqueMask,aBmpStretchFlag);
 	}
 
@@ -348,7 +348,7 @@
 EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(const TRect aRect, TBool aBmpStretchFlag)
 	{
 	const TRgb KOpaqueMask = TRgb(KOpaqueColor);
-	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), iBkMaskBmp,
+	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), BkMaskBmp(),
 	                       KOpaqueMask, KOpaqueMask, aBmpStretchFlag);
 	}
 
@@ -362,7 +362,7 @@
                                                             TBool aBmpStretchFlag)
 	{
 	const TRgb KOpaqueMask = TRgb(KTransparentColor);
-	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), iBkMaskBmp, KTransparentColor,
+	DrawBackgroundToDevice(aRect, MaskBitmapDevice(), BkMaskBmp(), KTransparentColor,
 	                       KTransparentColor, aBmpStretchFlag);
 	}
 	
@@ -698,7 +698,8 @@
     }
 
 TBool CFepUiBaseCtrl::IsOnTopOf(CFepUiBaseCtrl* aCtrl)
-    {           
+    {     
+    __ASSERT_DEBUG(aCtrl,EUiNullParam);      
     return OrderPos() < aCtrl->OrderPos();
     }
     
@@ -1257,7 +1258,9 @@
 
 EXPORT_C TBool CFepUiBaseCtrl::AbleToDraw()
 	{
-    return UiLayout()->LayoutReady() && Ready() && !WholeHiden() && Rect().Size() != TSize(0,0);
+    return UiLayout()->LayoutReady() && Ready()  
+            && (!UiLayout()->iExtension->iDisableDrawing)
+                    && !WholeHiden() && Rect().Size() != TSize(0,0);
 	}
 
 // ---------------------------------------------------------------------------
@@ -1265,8 +1268,12 @@
 // ---------------------------------------------------------------------------
 //    
 EXPORT_C TInt CFepUiBaseCtrl::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1)
-    {
-    //not implemented, use CBase's
+    {    
+    if( KFepCtrlExtId == aExtensionId)
+        {
+        a0 = iExtension;
+        return KErrNone;
+        }
     return CBase::Extension_(aExtensionId, a0, a1);
     }
     
@@ -1348,7 +1355,11 @@
 
 EXPORT_C void CFepUiBaseCtrl::SetParent(CFepUiBaseCtrl* aParent)
     {
-    //parent control must be type of control group.    
+    //parent control must be type of control group.
+    if(aParent)
+        {
+        __ASSERT_DEBUG(aParent->IsKindOfControl(ECtrlControlGroup),EUiLayoutBadParentType);
+        } 
     iParentCtrl = aParent;
     }
 
@@ -1365,6 +1376,100 @@
     return order;    
     }
 
+void CFepUiBaseCtrl::CreateOwnDeviceL(CFbsBitmap* aBmp, CFbsBitmap* aMaskBmp)
+    {
+    if(iExtension->iBitmap)
+        return;
+    User::LeaveIfError( aBmp->Create( Rect().Size(), iLayoutOwner->BitmapDevice()->DisplayMode() ) );
+    
+    iExtension->iBitmap = aBmp;
+    CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(aBmp);
+    
+    iExtension->SetBmpDevice(dev); 
+
+    CFbsBitGc* gc = CFbsBitGc::NewL();
+    gc->Reset();
+    iExtension->SetGc(gc);
+    
+    if(iExtension->iMaskBitmap || !aMaskBmp)
+        return;
+    
+    User::LeaveIfError( aMaskBmp->Create( Rect().Size(), iLayoutOwner->MaskBmpDevice()->DisplayMode() ) );
+    
+    iExtension->iMaskBitmap = aMaskBmp;
+    dev = CFbsBitmapDevice::NewL(aMaskBmp);
+    
+    iExtension->SetMaskBmpDevice(dev); 
+        
+    }
+    
+void CFepUiBaseCtrl::ResizeDeviceL()
+    {
+    if(iExtension->BitmapDevice())
+        iExtension->BitmapDevice()->Resize( Rect().Size());
+    //gc must be adjusted
+    if(iExtension->Gc())
+        {
+        iExtension->Gc()->Activate(iExtension->BitmapDevice());
+        iExtension->Gc()->Resized();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// get graphics context for sprite or window
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C CBitmapContext* CFepUiBaseCtrl::BitGc()
+    {
+
+
+    if(iUiLayout->NotDrawToLayoutDevice() && iExtension->Gc())
+        return iExtension->Gc();
+    else
+	    return iLayoutOwner->BitmapContext();
+    }
+
+// ---------------------------------------------------------------------------
+// get Bitmap device for sprite or window
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFbsBitmapDevice* CFepUiBaseCtrl::BitmapDevice()
+    {
+
+
+    if(iUiLayout->NotDrawToLayoutDevice() && iExtension->BitmapDevice())
+        return iExtension->BitmapDevice();
+    else   
+        return iLayoutOwner->BitmapDevice();
+    }
+
+// ---------------------------------------------------------------------------
+// get Mask bitmap device for sprite or window
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFbsBitmapDevice* CFepUiBaseCtrl::MaskBitmapDevice()
+    {
+
+    if(iUiLayout->NotDrawToLayoutDevice() && iExtension->MaskBitmapDevice())
+        return iExtension->MaskBitmapDevice();
+    else    
+
+        return iLayoutOwner->MaskBmpDevice();
+    }
+
+// ---------------------------------------------------------------------------
+// get control background maks bmp
+// ---------------------------------------------------------------------------
+//
+EXPORT_C  CFbsBitmap* CFepUiBaseCtrl::BkMaskBmp()
+    {
+    if(iUiLayout->NotDrawToLayoutDevice() && iExtension->MaskBitmap())
+        return iExtension->MaskBitmap();
+    else 
+        return iBkMaskBmp;
+    }
+
+
 // ---------------------------------------------------------------------------
 // CFepUiBaseCtrl::EnableExtResponseArea
 // Enable/disable extra response area support
@@ -1452,6 +1557,14 @@
     iExtResponseAreaMargin.SetRect( TPoint(0,0), TSize(0,0) );
 	}
 
+CFepUiBaseCtrl::CFepUiBaseCtrlExtension::~CFepUiBaseCtrlExtension()
+    {
+    //delete iBitmap;
+    delete iGc;
+    delete  iBitmapDevice;
+    delete iMaskBitmapDevice;
+    }
+	
 void CFepUiBaseCtrl::CFepUiBaseCtrlExtension::SetTactileFeedbackType(TInt aTactileType)
 	{
 #ifdef RD_TACTILE_FEEDBACK