textinput/peninputarc/src/peninputlayoutcontrol/peninputuilayout.cpp
branchRCL_3
changeset 44 ecbabf52600f
parent 43 ebd48d2de13c
child 46 bd83ceabce89
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputuilayout.cpp	Tue Aug 31 15:31:50 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputuilayout.cpp	Wed Sep 01 12:23:33 2010 +0100
@@ -28,6 +28,8 @@
 #include <AknDef.h>
 #include <AknsConstants.h>
 #include <coemain.h>
+#include <AknsUtils.h> 
+#include <AknsSkinInstance.h> 
 
 #ifdef RD_TACTILE_FEEDBACK
 #include <touchfeedback.h>
@@ -50,9 +52,6 @@
                             GetDefaultScreenSizeAndRotation(ptSize);
     //set the screen size in case any one need use it.                            
     iScreenSize = ptSize.iPixelSize;  
-#ifdef RD_TACTILE_FEEDBACK
-    iTactileSupported = EFalse;
-#endif // RD_TACTILE_FEEDBACK
     }
 
 // ---------------------------------------------------------------------------
@@ -66,7 +65,8 @@
     //remove all registered area
     SignalOwner(ESignalDeRegisterAllFeedbackArea);
 #endif // RD_TACTILE_FEEDBACK 
-    delete iRootCtrl;        
+    delete iRootCtrl;   
+    delete iExtension;
     } 
 
 // ---------------------------------------------------------------------------
@@ -77,7 +77,14 @@
 EXPORT_C void CFepUiLayout::BaseConstructL()
     {
     iRootCtrl = CFepUiLayoutRootCtrl::NewL(this);
-    __ASSERT_DEBUG(iLayoutOwner,User::Leave(EUiLayoutNotReady));     
+    __ASSERT_DEBUG(iLayoutOwner,User::Leave(EUiLayoutNotReady));  
+    iExtension = new(ELeave) CFepUiLayoutExt;
+#ifdef RD_TACTILE_FEEDBACK
+    iExtension->iTactileSupported = EFalse;
+#endif // RD_TACTILE_FEEDBACK
+    iExtension->iSkinInstance = AknsUtils::SkinInstance();
+    iExtension->iTouchFeedbackInstance = MTouchFeedback::Instance();
+	iExtension->iDisableDrawing = EFalse;
     }
 
 // ---------------------------------------------------------------------------
@@ -169,6 +176,24 @@
             TRAP_IGNORE(SendEditorTextAndCursorPosL(aData));
             }
             break;
+        case ECmdPeninputEnableOwnBitmap:
+            {
+            SetSelfBmpDeviceFlag(*(reinterpret_cast<TBool*>(aData)));
+            OnResourceChange(KPenInputOwnDeviceChange);
+            }
+            break;
+        case ECmdPeninputDisableLayoutDrawing:
+            {
+            DisableLayoutDrawing(*(reinterpret_cast<TBool*>(aData)));
+            }
+            break;
+        case ECmdPeninputEnalbeLayoutReDrawWhenActive:
+            {
+            TBool enableLayoutRedraw = ETrue;
+            TPtrC data(reinterpret_cast<TUint16*>(&enableLayoutRedraw),sizeof(TBool)/2);
+            SignalOwner(ESignalEnableLayoutRedrawWhenActive,data);
+            }
+            break;
         default: 
             {
             ret = -1;
@@ -448,7 +473,7 @@
     iLayoutReady = ETrue;
     iRootCtrl->OnActivate();
 #ifdef RD_TACTILE_FEEDBACK  
-    iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
+    iExtension->iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
 #endif // RD_TACTILE_FEEDBACK      
     }
     
@@ -462,6 +487,9 @@
     {
     iLayoutReady = EFalse;
     iRootCtrl->OnDeActivate();
+    TBool enableLayoutRedraw = ETrue;
+    TPtrC data(reinterpret_cast<TUint16*>(&enableLayoutRedraw),sizeof(TBool)/2);
+    SignalOwner(ESignalEnableLayoutRedrawWhenActive,data);
     }    
 // ---------------------------------------------------------------------------
 // CFepUiLayout::SetLayoutPos
@@ -566,6 +594,8 @@
                         const TRect& aRect,TBool aUpdateFlag,TBool aImmedFlag)
     {
     //do nothing if it's locked and aCtrl is not the owner.
+    if(!iLayoutReady || iExtension->iDisableDrawing)
+        return;
     TBool bUpdate = ETrue;
     if(!iLockedArea.IsEmpty() )
         {
@@ -791,7 +821,7 @@
     {
     TBool tactileSupported;
 #ifdef RD_TACTILE_FEEDBACK
-    tactileSupported = iTactileSupported;
+    tactileSupported = iExtension->iTactileSupported;
 #endif // RD_TACTILE_FEEDBACK
 	return tactileSupported;
     }
@@ -804,7 +834,7 @@
 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType)
     {
 #ifdef RD_TACTILE_FEEDBACK
-    MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
+	iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
 #endif // RD_TACTILE_FEEDBACK    
     }
 
@@ -818,16 +848,16 @@
 #ifdef RD_TACTILE_FEEDBACK
 	if (aAudioEnable && aVibraEnable)
 		{
-		MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
+	    iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
 		}
 	else
 		{
-		TBool vibraEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackVibra );
-		TBool audioEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackAudio );
+		TBool vibraEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackVibra );
+		TBool audioEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackAudio );
 		
-		MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable);
-		MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
-		MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled);
+		iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable);
+		iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
+		iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled);
 		}
 #endif // RD_TACTILE_FEEDBACK  
 	}
@@ -870,4 +900,27 @@
     {
     return iRootCtrl->CreateCursor();
     }
+
+EXPORT_C TBool CFepUiLayout::NotDrawToLayoutDevice()
+    {
+    return iExtension->iSelfBmpDeviceFlag;
+    }
+
+void CFepUiLayout::SetSelfBmpDeviceFlag(TBool aFlag)
+    {
+    iExtension->iSelfBmpDeviceFlag = aFlag;
+    }
+
+
+EXPORT_C void CFepUiLayout::DisableLayoutDrawing(TBool aFlag)
+    {
+    if(iExtension->iDisableDrawing == aFlag)
+        return;
+    iExtension->iDisableDrawing = aFlag;
+    TPtrC ptr;
+    ptr.Set(reinterpret_cast<const TUint16*>(&aFlag),sizeof(aFlag)/sizeof(TUint16));
+    
+    SignalOwner(ESignalDisableUpdating,ptr);
+    }
+
 //end of file