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> |
|
33 |
31 |
34 #ifdef RD_TACTILE_FEEDBACK |
32 #ifdef RD_TACTILE_FEEDBACK |
35 #include <touchfeedback.h> |
33 #include <touchfeedback.h> |
36 #include <featmgr.h> |
34 #include <featmgr.h> |
37 #endif //RD_TACTILE_FEEDBACK |
35 #endif //RD_TACTILE_FEEDBACK |
50 TPixelsTwipsAndRotation ptSize; |
48 TPixelsTwipsAndRotation ptSize; |
51 CCoeEnv::Static()->ScreenDevice()-> |
49 CCoeEnv::Static()->ScreenDevice()-> |
52 GetDefaultScreenSizeAndRotation(ptSize); |
50 GetDefaultScreenSizeAndRotation(ptSize); |
53 //set the screen size in case any one need use it. |
51 //set the screen size in case any one need use it. |
54 iScreenSize = ptSize.iPixelSize; |
52 iScreenSize = ptSize.iPixelSize; |
|
53 #ifdef RD_TACTILE_FEEDBACK |
|
54 iTactileSupported = EFalse; |
|
55 #endif // RD_TACTILE_FEEDBACK |
55 } |
56 } |
56 |
57 |
57 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
58 // CFepUiLayout::~CFepUiLayout |
59 // CFepUiLayout::~CFepUiLayout |
59 // Destructor |
60 // Destructor |
63 { |
64 { |
64 #ifdef RD_TACTILE_FEEDBACK |
65 #ifdef RD_TACTILE_FEEDBACK |
65 //remove all registered area |
66 //remove all registered area |
66 SignalOwner(ESignalDeRegisterAllFeedbackArea); |
67 SignalOwner(ESignalDeRegisterAllFeedbackArea); |
67 #endif // RD_TACTILE_FEEDBACK |
68 #endif // RD_TACTILE_FEEDBACK |
68 delete iRootCtrl; |
69 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; |
|
88 } |
81 } |
89 |
82 |
90 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
91 // CFepUiLayout::HandleEventL |
84 // CFepUiLayout::HandleEventL |
92 // handle event from window server |
85 // handle event from window server |
174 case ECmdPenInputSendEditorTextAndCurPos: |
167 case ECmdPenInputSendEditorTextAndCurPos: |
175 { |
168 { |
176 TRAP_IGNORE(SendEditorTextAndCursorPosL(aData)); |
169 TRAP_IGNORE(SendEditorTextAndCursorPosL(aData)); |
177 } |
170 } |
178 break; |
171 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; |
|
197 default: |
172 default: |
198 { |
173 { |
199 ret = -1; |
174 ret = -1; |
200 } |
175 } |
201 break; |
176 break; |
471 EXPORT_C void CFepUiLayout::OnActivate() |
446 EXPORT_C void CFepUiLayout::OnActivate() |
472 { |
447 { |
473 iLayoutReady = ETrue; |
448 iLayoutReady = ETrue; |
474 iRootCtrl->OnActivate(); |
449 iRootCtrl->OnActivate(); |
475 #ifdef RD_TACTILE_FEEDBACK |
450 #ifdef RD_TACTILE_FEEDBACK |
476 iExtension->iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); |
451 iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); |
477 #endif // RD_TACTILE_FEEDBACK |
452 #endif // RD_TACTILE_FEEDBACK |
478 } |
453 } |
479 |
454 |
480 // --------------------------------------------------------------------------- |
455 // --------------------------------------------------------------------------- |
481 // CFepUiLayout::OnDeActivate |
456 // CFepUiLayout::OnDeActivate |
485 // |
460 // |
486 EXPORT_C void CFepUiLayout::OnDeActivate() |
461 EXPORT_C void CFepUiLayout::OnDeActivate() |
487 { |
462 { |
488 iLayoutReady = EFalse; |
463 iLayoutReady = EFalse; |
489 iRootCtrl->OnDeActivate(); |
464 iRootCtrl->OnDeActivate(); |
490 TBool enableLayoutRedraw = ETrue; |
|
491 TPtrC data(reinterpret_cast<TUint16*>(&enableLayoutRedraw),sizeof(TBool)/2); |
|
492 SignalOwner(ESignalEnableLayoutRedrawWhenActive,data); |
|
493 } |
465 } |
494 // --------------------------------------------------------------------------- |
466 // --------------------------------------------------------------------------- |
495 // CFepUiLayout::SetLayoutPos |
467 // CFepUiLayout::SetLayoutPos |
496 // Set layout position |
468 // Set layout position |
497 // (other items were commented in a header). |
469 // (other items were commented in a header). |
592 // |
564 // |
593 EXPORT_C void CFepUiLayout::UpdateArea(const CFepUiBaseCtrl* aCtrl, |
565 EXPORT_C void CFepUiLayout::UpdateArea(const CFepUiBaseCtrl* aCtrl, |
594 const TRect& aRect,TBool aUpdateFlag,TBool aImmedFlag) |
566 const TRect& aRect,TBool aUpdateFlag,TBool aImmedFlag) |
595 { |
567 { |
596 //do nothing if it's locked and aCtrl is not the owner. |
568 //do nothing if it's locked and aCtrl is not the owner. |
597 if(!iLayoutReady || iExtension->iDisableDrawing) |
|
598 return; |
|
599 TBool bUpdate = ETrue; |
569 TBool bUpdate = ETrue; |
600 if(!iLockedArea.IsEmpty() ) |
570 if(!iLockedArea.IsEmpty() ) |
601 { |
571 { |
602 bUpdate = EFalse; |
572 bUpdate = EFalse; |
603 if( iLockedAreaOwner == aCtrl ) |
573 if( iLockedAreaOwner == aCtrl ) |
819 // |
789 // |
820 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback() |
790 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback() |
821 { |
791 { |
822 TBool tactileSupported; |
792 TBool tactileSupported; |
823 #ifdef RD_TACTILE_FEEDBACK |
793 #ifdef RD_TACTILE_FEEDBACK |
824 tactileSupported = iExtension->iTactileSupported; |
794 tactileSupported = iTactileSupported; |
825 #endif // RD_TACTILE_FEEDBACK |
795 #endif // RD_TACTILE_FEEDBACK |
826 return tactileSupported; |
796 return tactileSupported; |
827 } |
797 } |
828 |
798 |
829 // --------------------------------------------------------------------------- |
799 // --------------------------------------------------------------------------- |
832 // --------------------------------------------------------------------------- |
802 // --------------------------------------------------------------------------- |
833 // |
803 // |
834 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType) |
804 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType) |
835 { |
805 { |
836 #ifdef RD_TACTILE_FEEDBACK |
806 #ifdef RD_TACTILE_FEEDBACK |
837 iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType); |
807 MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType); |
838 #endif // RD_TACTILE_FEEDBACK |
808 #endif // RD_TACTILE_FEEDBACK |
839 } |
809 } |
840 |
810 |
841 // --------------------------------------------------------------------------- |
811 // --------------------------------------------------------------------------- |
842 // CFepUiLayout::DoTactileFeedback |
812 // CFepUiLayout::DoTactileFeedback |
846 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable) |
816 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable) |
847 { |
817 { |
848 #ifdef RD_TACTILE_FEEDBACK |
818 #ifdef RD_TACTILE_FEEDBACK |
849 if (aAudioEnable && aVibraEnable) |
819 if (aAudioEnable && aVibraEnable) |
850 { |
820 { |
851 iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType); |
821 MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType); |
852 } |
822 } |
853 else |
823 else |
854 { |
824 { |
855 TBool vibraEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackVibra ); |
825 TBool vibraEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackVibra ); |
856 TBool audioEnabled = iExtension->iTouchFeedbackInstance->FeedbackEnabledForThisApp( ETouchFeedbackAudio ); |
826 TBool audioEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackAudio ); |
857 |
827 |
858 iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable); |
828 MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable); |
859 iExtension->iTouchFeedbackInstance->InstantFeedback((TTouchLogicalFeedback)aType); |
829 MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType); |
860 iExtension->iTouchFeedbackInstance->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled); |
830 MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled); |
861 } |
831 } |
862 #endif // RD_TACTILE_FEEDBACK |
832 #endif // RD_TACTILE_FEEDBACK |
863 } |
833 } |
864 |
834 |
865 // --------------------------------------------------------------------------- |
835 // --------------------------------------------------------------------------- |
898 |
868 |
899 EXPORT_C CFepUiCursor* CFepUiLayout::CreateCursor() |
869 EXPORT_C CFepUiCursor* CFepUiLayout::CreateCursor() |
900 { |
870 { |
901 return iRootCtrl->CreateCursor(); |
871 return iRootCtrl->CreateCursor(); |
902 } |
872 } |
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 |
|
926 //end of file |
873 //end of file |