textinput/peninputarc/src/peninputlayoutcontrol/peninputuilayout.cpp
branchRCL_3
changeset 9 e6a39382bb9c
parent 0 eb1f2e154e89
child 12 5e18d8c489d6
equal deleted inserted replaced
8:4eb1ae11334f 9:e6a39382bb9c
    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();
    81     }
    87     }
    82 
    88 
    83 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    84 // CFepUiLayout::HandleEventL
    90 // CFepUiLayout::HandleEventL
    85 // handle event from window server
    91 // handle event from window server
   446 EXPORT_C void CFepUiLayout::OnActivate()
   452 EXPORT_C void CFepUiLayout::OnActivate()
   447     {
   453     {
   448     iLayoutReady = ETrue;
   454     iLayoutReady = ETrue;
   449     iRootCtrl->OnActivate();
   455     iRootCtrl->OnActivate();
   450 #ifdef RD_TACTILE_FEEDBACK  
   456 #ifdef RD_TACTILE_FEEDBACK  
   451     iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
   457     iExtension->iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
   452 #endif // RD_TACTILE_FEEDBACK      
   458 #endif // RD_TACTILE_FEEDBACK      
   453     }
   459     }
   454     
   460     
   455 // ---------------------------------------------------------------------------
   461 // ---------------------------------------------------------------------------
   456 // CFepUiLayout::OnDeActivate
   462 // CFepUiLayout::OnDeActivate
   789 //      
   795 //      
   790 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback()
   796 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback()
   791     {
   797     {
   792     TBool tactileSupported;
   798     TBool tactileSupported;
   793 #ifdef RD_TACTILE_FEEDBACK
   799 #ifdef RD_TACTILE_FEEDBACK
   794     tactileSupported = iTactileSupported;
   800     tactileSupported = iExtension->iTactileSupported;
   795 #endif // RD_TACTILE_FEEDBACK
   801 #endif // RD_TACTILE_FEEDBACK
   796 	return tactileSupported;
   802 	return tactileSupported;
   797     }
   803     }
   798     
   804     
   799 // ---------------------------------------------------------------------------
   805 // ---------------------------------------------------------------------------
   802 // ---------------------------------------------------------------------------
   808 // ---------------------------------------------------------------------------
   803 //   
   809 //   
   804 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType)
   810 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType)
   805     {
   811     {
   806 #ifdef RD_TACTILE_FEEDBACK
   812 #ifdef RD_TACTILE_FEEDBACK
   807     MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
   813 	iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
   808 #endif // RD_TACTILE_FEEDBACK    
   814 #endif // RD_TACTILE_FEEDBACK    
   809     }
   815     }
   810 
   816 
   811 // ---------------------------------------------------------------------------
   817 // ---------------------------------------------------------------------------
   812 // CFepUiLayout::DoTactileFeedback
   818 // CFepUiLayout::DoTactileFeedback
   816 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable)
   822 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable)
   817 	{
   823 	{
   818 #ifdef RD_TACTILE_FEEDBACK
   824 #ifdef RD_TACTILE_FEEDBACK
   819 	if (aAudioEnable && aVibraEnable)
   825 	if (aAudioEnable && aVibraEnable)
   820 		{
   826 		{
   821 		MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
   827 	    iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
   822 		}
   828 		}
   823 	else
   829 	else
   824 		{
   830 		{
   825 		TBool vibraEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackVibra );
   831 		TBool vibraEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackVibra );
   826 		TBool audioEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackAudio );
   832 		TBool audioEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackAudio );
   827 		
   833 		
   828 		MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable);
   834 		iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable);
   829 		MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType);
   835 		iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType);
   830 		MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled);
   836 		iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled);
   831 		}
   837 		}
   832 #endif // RD_TACTILE_FEEDBACK  
   838 #endif // RD_TACTILE_FEEDBACK  
   833 	}
   839 	}
   834 
   840 
   835 // ---------------------------------------------------------------------------
   841 // ---------------------------------------------------------------------------