diff -r 55d60436f00b -r d68a4b5d5885 clock2/clockui/uilayer/src/clockappui.cpp --- a/clock2/clockui/uilayer/src/clockappui.cpp Tue May 11 16:12:24 2010 +0300 +++ b/clock2/clockui/uilayer/src/clockappui.cpp Tue May 25 12:41:10 2010 +0300 @@ -29,6 +29,8 @@ #include #include #include +#include +#include // User includes #include "clock.h" @@ -53,6 +55,13 @@ EChangesFreeMemory | EChangesOutOfMemory ); +// constants for control effects +const TInt KGfxControlPageSwitchDisappear = 4; +const TInt KGfxControlPageSwitchAppear = 3; + +const TUid KControlUid1 = {0x2000B47C}; +const TUid KControlUid2 = {0x2000B47D}; + // Literals _LIT( KIconFileName, "\\resource\\apps\\clockapp_tab.mif" ); _LIT( KIAParamExec, "clock.exe" ); @@ -133,7 +142,9 @@ CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue ); AddViewL( dateTimeView ); CleanupStack::Pop( dateTimeView ); - + + iTactileFeedbackSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); + // Start the model. alarmModel->Start(); @@ -296,6 +307,8 @@ case EClockAppMainViewId: { // The main view. + iTransitionOngoing = ETrue; + iTransitionDirection = ETransitionLeft; ActivateLocalViewL( KClockAppMainViewId ); } break; @@ -303,6 +316,8 @@ case EClockAppWorldViewId: { // The clockworld view. + iTransitionOngoing = ETrue; + iTransitionDirection = ETransitionRight; ActivateLocalViewL( KClockAppWorldViewId ); } break; @@ -504,7 +519,10 @@ { // Set the title pane text first SetTitlePaneTextL( R_CLOCK_TITLE_SETTINGS ); - + + // Activate the date and time settings view + ActivateLocalViewL( KClkDateTimeViewId ); + // Don't display the navigation pane when switching to settings view. if( iNavigationDecorator ) { @@ -546,9 +564,16 @@ viewId.iViewUid = KClockAppMainViewId; // Switch to the main view - // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() ); - TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ; - + if( iTabGroup->ActiveTabId() == EClockAppWorldViewId ) + { + ActivateLocalViewL( KClockAppMainViewId, TUid::Uid(KClockHideInBackground), KNullDesC8() ); + //TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ; + } + else + { + // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() ); + TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ; + } // Update the tab. iTabGroup->SetActiveTabById( EClockAppMainViewId ); } @@ -697,4 +722,84 @@ } __PRINTS( "CClockAppUi::HandleIADUpdateL - Exit" ); } + +TBool CClockAppUi::TransitionOngoing() const + { + return iTransitionOngoing; + } + +void CClockAppUi::SetTransitionOngoing( TBool aTransitionOngoing ) + { + iTransitionOngoing = aTransitionOngoing; + } + +void CClockAppUi::SetTransitionGroupId( TInt aId ) + { + iTransitionGroupId = aId; + } + +TInt CClockAppUi::TransitionGroupId() const + { + return iTransitionGroupId; + } + +CClockAppUi::TTransitionDirection CClockAppUi::TransitionDirection() const + { + return iTransitionDirection; + } + +void CClockAppUi::SetTransitionDirection( CClockAppUi::TTransitionDirection aDirection ) + { + iTransitionDirection = aDirection; + } + +void CClockAppUi::DoDisappearTransition( CCoeControl* aControl ) + { + if( aControl && iTransitionOngoing ) + { + if( iTransitionDirection == ETransitionLeft ) + { + GfxTransEffect::Register( aControl, KControlUid2 ); + } + else + { + GfxTransEffect::Register( aControl, KControlUid1 ); + } + GfxTransEffect::Begin( aControl, KGfxControlPageSwitchDisappear ); + aControl->MakeVisible( EFalse ); + GfxTransEffect::SetDemarcation( aControl, aControl->Rect() ); + GfxTransEffect::End( aControl ); + GfxTransEffect::EndGroup( iTransitionGroupId ); + iTransitionOngoing = EFalse; + } + } + +void CClockAppUi::DoAppearTransition( CCoeControl* aControl ) + { + if( aControl && iTransitionOngoing ) + { + if( iTransitionDirection == ETransitionLeft ) + { + GfxTransEffect::Register( aControl, KControlUid2 ); + } + else + { + GfxTransEffect::Register( aControl, KControlUid1 ); + } + iTransitionGroupId = GfxTransEffect::BeginGroup(); + GfxTransEffect::Begin( aControl, KGfxControlPageSwitchAppear ); + aControl->MakeVisible( ETrue ); + GfxTransEffect::SetDemarcation( aControl, aControl->Rect() ); + GfxTransEffect::End( aControl ); + } + } + +MTouchFeedback* CClockAppUi::GetFeedback() + { + if( !iFeedback && iTactileFeedbackSupported ) + { + iFeedback = MTouchFeedback::Instance(); + } + return iFeedback; + } // End of file