textinput/peninputarc/src/peninputlayoutcontrol/peninputuilayout.cpp
branchRCL_3
changeset 44 ecbabf52600f
parent 43 ebd48d2de13c
child 46 bd83ceabce89
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
    26 
    26 
    27 #include <aknfeppeninputenums.h>
    27 #include <aknfeppeninputenums.h>
    28 #include <AknDef.h>
    28 #include <AknDef.h>
    29 #include <AknsConstants.h>
    29 #include <AknsConstants.h>
    30 #include <coemain.h>
    30 #include <coemain.h>
       
    31 #include <AknsUtils.h> 
       
    32 #include <AknsSkinInstance.h> 
    31 
    33 
    32 #ifdef RD_TACTILE_FEEDBACK
    34 #ifdef RD_TACTILE_FEEDBACK
    33 #include <touchfeedback.h>
    35 #include <touchfeedback.h>
    34 #include <featmgr.h>
    36 #include <featmgr.h>
    35 #endif //RD_TACTILE_FEEDBACK
    37 #endif //RD_TACTILE_FEEDBACK
    48     TPixelsTwipsAndRotation ptSize;             
    50     TPixelsTwipsAndRotation ptSize;             
    49     CCoeEnv::Static()->ScreenDevice()->
    51     CCoeEnv::Static()->ScreenDevice()->
    50                             GetDefaultScreenSizeAndRotation(ptSize);
    52                             GetDefaultScreenSizeAndRotation(ptSize);
    51     //set the screen size in case any one need use it.                            
    53     //set the screen size in case any one need use it.                            
    52     iScreenSize = ptSize.iPixelSize;  
    54     iScreenSize = ptSize.iPixelSize;  
    53 #ifdef RD_TACTILE_FEEDBACK
       
    54     iTactileSupported = EFalse;
       
    55 #endif // RD_TACTILE_FEEDBACK
       
    56     }
    55     }
    57 
    56 
    58 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    59 // CFepUiLayout::~CFepUiLayout
    58 // CFepUiLayout::~CFepUiLayout
    60 // Destructor
    59 // Destructor
    64     {
    63     {
    65 #ifdef RD_TACTILE_FEEDBACK                  
    64 #ifdef RD_TACTILE_FEEDBACK                  
    66     //remove all registered area
    65     //remove all registered area
    67     SignalOwner(ESignalDeRegisterAllFeedbackArea);
    66     SignalOwner(ESignalDeRegisterAllFeedbackArea);
    68 #endif // RD_TACTILE_FEEDBACK 
    67 #endif // RD_TACTILE_FEEDBACK 
    69     delete iRootCtrl;        
    68     delete iRootCtrl;   
       
    69     delete iExtension;
    70     } 
    70     } 
    71 
    71 
    72 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    73 // CFepUiLayout::BaseConstructL
    73 // CFepUiLayout::BaseConstructL
    74 // Do basic contructor
    74 // Do basic contructor
    75 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    76 //
    76 //
    77 EXPORT_C void CFepUiLayout::BaseConstructL()
    77 EXPORT_C void CFepUiLayout::BaseConstructL()
    78     {
    78     {
    79     iRootCtrl = CFepUiLayoutRootCtrl::NewL(this);
    79     iRootCtrl = CFepUiLayoutRootCtrl::NewL(this);
    80     __ASSERT_DEBUG(iLayoutOwner,User::Leave(EUiLayoutNotReady));     
    80     __ASSERT_DEBUG(iLayoutOwner,User::Leave(EUiLayoutNotReady));  
       
    81     iExtension = new(ELeave) CFepUiLayoutExt;
       
    82 #ifdef RD_TACTILE_FEEDBACK
       
    83     iExtension->iTactileSupported = EFalse;
       
    84 #endif // RD_TACTILE_FEEDBACK
       
    85     iExtension->iSkinInstance = AknsUtils::SkinInstance();
       
    86     iExtension->iTouchFeedbackInstance = MTouchFeedback::Instance();
       
    87 	iExtension->iDisableDrawing = EFalse;
    81     }
    88     }
    82 
    89 
    83 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
    84 // CFepUiLayout::HandleEventL
    91 // CFepUiLayout::HandleEventL
    85 // handle event from window server
    92 // handle event from window server
   167         case ECmdPenInputSendEditorTextAndCurPos:
   174         case ECmdPenInputSendEditorTextAndCurPos:
   168             {
   175             {
   169             TRAP_IGNORE(SendEditorTextAndCursorPosL(aData));
   176             TRAP_IGNORE(SendEditorTextAndCursorPosL(aData));
   170             }
   177             }
   171             break;
   178             break;
       
   179         case ECmdPeninputEnableOwnBitmap:
       
   180             {
       
   181             SetSelfBmpDeviceFlag(*(reinterpret_cast<TBool*>(aData)));
       
   182             OnResourceChange(KPenInputOwnDeviceChange);
       
   183             }
       
   184             break;
       
   185         case ECmdPeninputDisableLayoutDrawing:
       
   186             {
       
   187             DisableLayoutDrawing(*(reinterpret_cast<TBool*>(aData)));
       
   188             }
       
   189             break;
       
   190         case ECmdPeninputEnalbeLayoutReDrawWhenActive:
       
   191             {
       
   192             TBool enableLayoutRedraw = ETrue;
       
   193             TPtrC data(reinterpret_cast<TUint16*>(&enableLayoutRedraw),sizeof(TBool)/2);
       
   194             SignalOwner(ESignalEnableLayoutRedrawWhenActive,data);
       
   195             }
       
   196             break;
   172         default: 
   197         default: 
   173             {
   198             {
   174             ret = -1;
   199             ret = -1;
   175             }	
   200             }	
   176             break;
   201             break;
   446 EXPORT_C void CFepUiLayout::OnActivate()
   471 EXPORT_C void CFepUiLayout::OnActivate()
   447     {
   472     {
   448     iLayoutReady = ETrue;
   473     iLayoutReady = ETrue;
   449     iRootCtrl->OnActivate();
   474     iRootCtrl->OnActivate();
   450 #ifdef RD_TACTILE_FEEDBACK  
   475 #ifdef RD_TACTILE_FEEDBACK  
   451     iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
   476     iExtension->iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
   452 #endif // RD_TACTILE_FEEDBACK      
   477 #endif // RD_TACTILE_FEEDBACK      
   453     }
   478     }
   454     
   479     
   455 // ---------------------------------------------------------------------------
   480 // ---------------------------------------------------------------------------
   456 // CFepUiLayout::OnDeActivate
   481 // CFepUiLayout::OnDeActivate
   460 //         
   485 //         
   461 EXPORT_C void CFepUiLayout::OnDeActivate()
   486 EXPORT_C void CFepUiLayout::OnDeActivate()
   462     {
   487     {
   463     iLayoutReady = EFalse;
   488     iLayoutReady = EFalse;
   464     iRootCtrl->OnDeActivate();
   489     iRootCtrl->OnDeActivate();
       
   490     TBool enableLayoutRedraw = ETrue;
       
   491     TPtrC data(reinterpret_cast<TUint16*>(&enableLayoutRedraw),sizeof(TBool)/2);
       
   492     SignalOwner(ESignalEnableLayoutRedrawWhenActive,data);
   465     }    
   493     }    
   466 // ---------------------------------------------------------------------------
   494 // ---------------------------------------------------------------------------
   467 // CFepUiLayout::SetLayoutPos
   495 // CFepUiLayout::SetLayoutPos
   468 // Set layout position
   496 // Set layout position
   469 // (other items were commented in a header).
   497 // (other items were commented in a header).
   564 //       
   592 //       
   565 EXPORT_C void CFepUiLayout::UpdateArea(const CFepUiBaseCtrl* aCtrl,
   593 EXPORT_C void CFepUiLayout::UpdateArea(const CFepUiBaseCtrl* aCtrl,
   566                         const TRect& aRect,TBool aUpdateFlag,TBool aImmedFlag)
   594                         const TRect& aRect,TBool aUpdateFlag,TBool aImmedFlag)
   567     {
   595     {
   568     //do nothing if it's locked and aCtrl is not the owner.
   596     //do nothing if it's locked and aCtrl is not the owner.
       
   597     if(!iLayoutReady || iExtension->iDisableDrawing)
       
   598         return;
   569     TBool bUpdate = ETrue;
   599     TBool bUpdate = ETrue;
   570     if(!iLockedArea.IsEmpty() )
   600     if(!iLockedArea.IsEmpty() )
   571         {
   601         {
   572         bUpdate = EFalse;
   602         bUpdate = EFalse;
   573         if( iLockedAreaOwner == aCtrl )
   603         if( iLockedAreaOwner == aCtrl )
   789 //      
   819 //      
   790 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback()
   820 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback()
   791     {
   821     {
   792     TBool tactileSupported;
   822     TBool tactileSupported;
   793 #ifdef RD_TACTILE_FEEDBACK
   823 #ifdef RD_TACTILE_FEEDBACK
   794     tactileSupported = iTactileSupported;
   824     tactileSupported = iExtension->iTactileSupported;
   795 #endif // RD_TACTILE_FEEDBACK
   825 #endif // RD_TACTILE_FEEDBACK
   796 	return tactileSupported;
   826 	return tactileSupported;
   797     }
   827     }
   798     
   828     
   799 // ---------------------------------------------------------------------------
   829 // ---------------------------------------------------------------------------
   802 // ---------------------------------------------------------------------------
   832 // ---------------------------------------------------------------------------
   803 //   
   833 //   
   804 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType)
   834 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType)
   805     {
   835     {
   806 #ifdef RD_TACTILE_FEEDBACK
   836 #ifdef RD_TACTILE_FEEDBACK
   807     MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
   837 	iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
   808 #endif // RD_TACTILE_FEEDBACK    
   838 #endif // RD_TACTILE_FEEDBACK    
   809     }
   839     }
   810 
   840 
   811 // ---------------------------------------------------------------------------
   841 // ---------------------------------------------------------------------------
   812 // CFepUiLayout::DoTactileFeedback
   842 // CFepUiLayout::DoTactileFeedback
   816 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable)
   846 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable)
   817 	{
   847 	{
   818 #ifdef RD_TACTILE_FEEDBACK
   848 #ifdef RD_TACTILE_FEEDBACK
   819 	if (aAudioEnable && aVibraEnable)
   849 	if (aAudioEnable && aVibraEnable)
   820 		{
   850 		{
   821 		MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
   851 	    iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
   822 		}
   852 		}
   823 	else
   853 	else
   824 		{
   854 		{
   825 		TBool vibraEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackVibra );
   855 		TBool vibraEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackVibra );
   826 		TBool audioEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackAudio );
   856 		TBool audioEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackAudio );
   827 		
   857 		
   828 		MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable);
   858 		iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable);
   829 		MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
   859 		iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
   830 		MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled);
   860 		iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled);
   831 		}
   861 		}
   832 #endif // RD_TACTILE_FEEDBACK  
   862 #endif // RD_TACTILE_FEEDBACK  
   833 	}
   863 	}
   834 
   864 
   835 // ---------------------------------------------------------------------------
   865 // ---------------------------------------------------------------------------
   868     
   898     
   869 EXPORT_C CFepUiCursor* CFepUiLayout::CreateCursor()
   899 EXPORT_C CFepUiCursor* CFepUiLayout::CreateCursor()
   870     {
   900     {
   871     return iRootCtrl->CreateCursor();
   901     return iRootCtrl->CreateCursor();
   872     }
   902     }
       
   903 
       
   904 EXPORT_C TBool CFepUiLayout::NotDrawToLayoutDevice()
       
   905     {
       
   906     return iExtension->iSelfBmpDeviceFlag;
       
   907     }
       
   908 
       
   909 void CFepUiLayout::SetSelfBmpDeviceFlag(TBool aFlag)
       
   910     {
       
   911     iExtension->iSelfBmpDeviceFlag = aFlag;
       
   912     }
       
   913 
       
   914 
       
   915 EXPORT_C void CFepUiLayout::DisableLayoutDrawing(TBool aFlag)
       
   916     {
       
   917     if(iExtension->iDisableDrawing == aFlag)
       
   918         return;
       
   919     iExtension->iDisableDrawing = aFlag;
       
   920     TPtrC ptr;
       
   921     ptr.Set(reinterpret_cast<const TUint16*>(&aFlag),sizeof(aFlag)/sizeof(TUint16));
       
   922     
       
   923     SignalOwner(ESignalDisableUpdating,ptr);
       
   924     }
       
   925 
   873 //end of file
   926 //end of file