--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbasecontrol.cpp Thu Aug 19 10:15:25 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbasecontrol.cpp Tue Aug 31 15:31:50 2010 +0300
@@ -59,9 +59,9 @@
iOwnWndCtrl(ETrue),
iOrdinalPos(EOrderNomal)
{
- //todo code refactoring needed, move to BaseConstructL
- iExtension = new CFepUiBaseCtrlExtension();
-
+#ifdef RD_TACTILE_FEEDBACK
+ iReservered1 = reinterpret_cast<TInt>(new CFepUiBaseCtrlExtension(ETouchFeedbackNone));
+#endif // RD_TACTILE_FEEDBACK
iPenSize.SetSize(1,1);
iBorderSize.SetSize(KDefaultFrameWidth,KDefaultFrameWidth);
iValidRegion.AddRect(iRect);
@@ -94,9 +94,9 @@
iUiLayout(aUiLayout),
iOwnWndCtrl(aOwnership)
{
- //todo code refactoring needed, move to BaseConstructL
- iExtension = new CFepUiBaseCtrlExtension();
-
+#ifdef RD_TACTILE_FEEDBACK
+ iReservered1 = reinterpret_cast<TInt>(new CFepUiBaseCtrlExtension(ETouchFeedbackNone));
+#endif // RD_TACTILE_FEEDBACK
iRect = aControl->Rect();
iControlId = aControl->UniqueHandle();
iValidRegion.AddRect(iRect);
@@ -128,9 +128,8 @@
//de-register the area for tactile feedback
//if(aUiLayout) //there must be aUiLayout
UiLayout()->DeRegisterFeedbackArea(reinterpret_cast<TInt>(this), Rect());
+ delete reinterpret_cast<CFepUiBaseCtrlExtension*>(iReservered1);
#endif // RD_TACTILE_FEEDBACK
-
- delete iExtension;
}
// ---------------------------------------------------------------------------
@@ -185,7 +184,7 @@
EXPORT_C void CFepUiBaseCtrl::SetTactileFeedbackType(TInt aTactileType)
{
#ifdef RD_TACTILE_FEEDBACK
- iExtension->SetTactileFeedbackType(aTactileType);
+ reinterpret_cast<CFepUiBaseCtrlExtension*>(iReservered1)->SetTactileFeedbackType(aTactileType);
#endif // RD_TACTILE_FEEDBACK
}
@@ -322,7 +321,7 @@
//
EXPORT_C void CFepUiBaseCtrl::DrawMaskBackground(TBool aBmpStretchFlag)
{
- DrawBackgroundToDevice(iRect,MaskBitmapDevice(), BkMaskBmp(), iMaskBkCol,
+ DrawBackgroundToDevice(iRect,MaskBitmapDevice(), iBkMaskBmp, iMaskBkCol,
iBorderColor,aBmpStretchFlag);
}
@@ -335,7 +334,7 @@
EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(TBool aBmpStretchFlag)
{
const TRgb KOpaqueMask = TRgb(KOpaqueColor);
- DrawBackgroundToDevice(iRect,MaskBitmapDevice(), BkMaskBmp(), KOpaqueMask,
+ DrawBackgroundToDevice(iRect,MaskBitmapDevice(), iBkMaskBmp, KOpaqueMask,
KOpaqueMask,aBmpStretchFlag);
}
@@ -348,7 +347,7 @@
EXPORT_C void CFepUiBaseCtrl::DrawOpaqueMaskBackground(const TRect aRect, TBool aBmpStretchFlag)
{
const TRgb KOpaqueMask = TRgb(KOpaqueColor);
- DrawBackgroundToDevice(aRect, MaskBitmapDevice(), BkMaskBmp(),
+ DrawBackgroundToDevice(aRect, MaskBitmapDevice(), iBkMaskBmp,
KOpaqueMask, KOpaqueMask, aBmpStretchFlag);
}
@@ -362,7 +361,7 @@
TBool aBmpStretchFlag)
{
const TRgb KOpaqueMask = TRgb(KTransparentColor);
- DrawBackgroundToDevice(aRect, MaskBitmapDevice(), BkMaskBmp(), KTransparentColor,
+ DrawBackgroundToDevice(aRect, MaskBitmapDevice(), iBkMaskBmp, KTransparentColor,
KTransparentColor, aBmpStretchFlag);
}
@@ -536,11 +535,6 @@
//
EXPORT_C TBool CFepUiBaseCtrl::Contains(const TPoint& aPt)
{
- if( iExtension->iExtResponseAreaActive )
- {
- return iExtension->iExtResponseArea.Contains( aPt );
- }
-
return iRect.Contains(aPt);
//return iValidRegion.Contains(aPt);
}
@@ -698,8 +692,9 @@
}
TBool CFepUiBaseCtrl::IsOnTopOf(CFepUiBaseCtrl* aCtrl)
- {
- ASSERT(aCtrl);
+ {
+ __ASSERT_DEBUG(aCtrl,EUiNullParam);
+
return OrderPos() < aCtrl->OrderPos();
}
@@ -772,11 +767,6 @@
//
EXPORT_C CFepUiBaseCtrl* CFepUiBaseCtrl::HandlePointerDownEventL(const TPoint& aPoint)
{
- if ( iExtension->iExtResponseAreaEnabled )
- {
- ActiveExtResponseArea();
- }
-
iPointerDown = ETrue;
if(iWndControl)
{
@@ -801,11 +791,6 @@
EXPORT_C CFepUiBaseCtrl* CFepUiBaseCtrl::HandlePointerUpEventL(
const TPoint& aPoint)
{
- if ( iExtension->iExtResponseAreaActive )
- {
- CancelExtResponseArea();
- }
-
iPointerDown = EFalse;
if(iWndControl)
{
@@ -860,11 +845,6 @@
//
EXPORT_C void CFepUiBaseCtrl::CancelPointerDownL()
{
- if ( iExtension->iExtResponseAreaActive )
- {
- CancelExtResponseArea();
- }
-
if (PointerDown())
{
iPointerDown = EFalse;
@@ -1008,11 +988,6 @@
//
EXPORT_C void CFepUiBaseCtrl::HandlePointerLeave(const TPoint& /*aPt*/)
{
- if ( iExtension->iExtResponseAreaActive )
- {
- CancelExtResponseArea();
- }
-
iPointerDown = EFalse;
iPointerLeft = ETrue;
//report event
@@ -1027,11 +1002,6 @@
//
EXPORT_C void CFepUiBaseCtrl::HandlePointerEnter(const TPoint& aPt)
{
- if ( iExtension->iExtResponseAreaEnabled )
- {
- ActiveExtResponseArea();
- }
-
iPointerDown = ETrue;
iPointerLeft = EFalse;
TRAP_IGNORE(HandlePointerMoveEventL(aPt));
@@ -1258,9 +1228,7 @@
EXPORT_C TBool CFepUiBaseCtrl::AbleToDraw()
{
- return UiLayout()->LayoutReady() && Ready()
- && (!UiLayout()->iExtension->iDisableDrawing)
- && !WholeHiden() && Rect().Size() != TSize(0,0);
+ return UiLayout()->LayoutReady() && Ready() && !WholeHiden() && Rect().Size() != TSize(0,0);
}
// ---------------------------------------------------------------------------
@@ -1268,12 +1236,8 @@
// ---------------------------------------------------------------------------
//
EXPORT_C TInt CFepUiBaseCtrl::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1)
- {
- if( KFepCtrlExtId == aExtensionId)
- {
- a0 = iExtension;
- return KErrNone;
- }
+ {
+ //not implemented, use CBase's
return CBase::Extension_(aExtensionId, a0, a1);
}
@@ -1355,7 +1319,11 @@
EXPORT_C void CFepUiBaseCtrl::SetParent(CFepUiBaseCtrl* aParent)
{
- //ASSERT(aParent == NULL || aParent->IsKindOfControl(ECtrlControlGroup));
+ //parent control must be type of control group.
+ if(aParent)
+ {
+ __ASSERT_DEBUG(aParent->IsKindOfControl(ECtrlControlGroup),EUiLayoutBadParentType);
+ }
iParentCtrl = aParent;
}
@@ -1372,167 +1340,7 @@
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
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFepUiBaseCtrl::EnableExtResponseArea( TBool aEnable,
- const TRect& aExtMargin )
- {
- iExtension->iExtResponseAreaEnabled = aEnable;
- iExtension->iExtResponseAreaMargin = aExtMargin;
- }
-
-// ---------------------------------------------------------------------------
-// CFepUiBaseCtrl::EnableExtResponseArea
-// Active extra response area
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFepUiBaseCtrl::ActiveExtResponseArea()
- {
- if ( iExtension->iExtResponseAreaEnabled )
- {
- TRect response = Rect();
- response.iTl -= iExtension->iExtResponseAreaMargin.iTl;
- response.iBr += iExtension->iExtResponseAreaMargin.Size();
-
- UpdateExtResponseArea( response );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFepUiBaseCtrl::EnableExtResponseArea
-// Cancel extra response area
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CFepUiBaseCtrl::CancelExtResponseArea()
- {
- iExtension->iExtResponseAreaActive = EFalse;
-
- CFepUiBaseCtrl* parent = ParentCtrl();
- if( parent && parent->IsKindOfControl(ECtrlControlGroup) )
- {
- parent->CancelExtResponseArea();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CFepUiBaseCtrl::EnableExtResponseArea
-// Update extra response area
-// ---------------------------------------------------------------------------
-//
-void CFepUiBaseCtrl::UpdateExtResponseArea( const TRect& aRect )
- {
- if ( aRect.iTl.iX < Rect().iTl.iX || aRect.iTl.iY < Rect().iTl.iY ||
- aRect.iBr.iX > Rect().iBr.iX || aRect.iBr.iY > Rect().iBr.iY )
- {
- iExtension->iExtResponseAreaActive = ETrue;
- iExtension->iExtResponseArea = Rect();
- iExtension->iExtResponseArea.BoundingRect( aRect );
-
- //update parent
- CFepUiBaseCtrl* parent = ParentCtrl();
- if ( parent && parent->IsKindOfControl( ECtrlControlGroup ) )
- {
- parent->UpdateExtResponseArea( iExtension->iExtResponseArea );
- }
- }
- }
// ---------------------------------------------------------------------------
// CFepUiBaseCtrl::CFepUiBaseCtrlExtension
@@ -1540,27 +1348,13 @@
// ---------------------------------------------------------------------------
//
-CFepUiBaseCtrl::CFepUiBaseCtrlExtension::CFepUiBaseCtrlExtension()
+CFepUiBaseCtrl::CFepUiBaseCtrlExtension::CFepUiBaseCtrlExtension(TInt aTactileType)
{
#ifdef RD_TACTILE_FEEDBACK
- iTactileType = ETouchFeedbackNone;
+ iTactileType = aTactileType;
#endif // RD_TACTILE_FEEDBACK
-
- //temp code, can be removed after refactoring of CFepUiBaseCtrl::iExtension
- iExtResponseAreaActive = EFalse;
- iExtResponseArea.SetRect( TPoint(0,0), TSize(0,0) );
- iExtResponseAreaEnabled = EFalse;
- 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