lafagnosticuifoundation/graphicseffects/ClientSrc/GfxTransEffect.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32std.h>
       
    17 #include <vwsdef.h> // TVwsViewId
       
    18 
       
    19 #include "GfxTransEffect.h"
       
    20 #include "GfxTransUtils.h"
       
    21 #include "GfxTransEffectPanic.h"
       
    22 
       
    23 #ifndef TRANSITIONS_DISABLED
       
    24 #include "GfxTransImpl.h"
       
    25 #endif
       
    26 
       
    27 #ifdef TRANSITIONS_DISABLED
       
    28 #include <coecntrl.h>
       
    29 #endif
       
    30 
       
    31 EXPORT_C void GfxTransEffect::Register(const CCoeControl * aKey,const TVwsViewId &aView,TUid aType)
       
    32 	{
       
    33 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicRegisterArgument));
       
    34 #ifndef TRANSITIONS_DISABLED
       
    35 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aKey);
       
    36 	if(singleton) 
       
    37 		singleton->Register(aKey,aView,aType);
       
    38 #endif
       
    39 	}
       
    40 	
       
    41 EXPORT_C void GfxTransEffect::Register(const CCoeControl * aKey,TUid aType,TBool aNLayered)
       
    42 	{
       
    43 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicRegisterArgument));
       
    44 #ifndef TRANSITIONS_DISABLED		
       
    45 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aKey);
       
    46 	if(singleton) 
       
    47 		singleton->Register(aKey,aType,aNLayered);
       
    48 #endif
       
    49 	}
       
    50 	
       
    51 EXPORT_C TBool GfxTransEffect::IsRegistered(const CCoeControl * aKey)
       
    52 	{
       
    53 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicIsRegisteredArgument));
       
    54 #ifndef TRANSITIONS_DISABLED
       
    55 	CGfxTransEffect *singleton = CGfxTransEffect::StaticNoCreate(aKey);
       
    56 	if(singleton) 
       
    57 		return singleton->IsRegistered(aKey);
       
    58 	else 
       
    59 		return EFalse;
       
    60 #else
       
    61 	return EFalse;
       
    62 #endif
       
    63 	}
       
    64 	
       
    65 EXPORT_C void GfxTransEffect::Deregister(const CCoeControl * aKey)
       
    66 	{
       
    67 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicDeregisterArgument));
       
    68 #ifndef TRANSITIONS_DISABLED	
       
    69 	CGfxTransEffect *singleton = CGfxTransEffect::StaticNoCreate(aKey);
       
    70 	if(singleton) 
       
    71 		singleton->Deregister(aKey);	
       
    72 #endif
       
    73 	}
       
    74 	
       
    75 EXPORT_C void GfxTransEffect::Begin(const CCoeControl * aKey,TUint aAction)
       
    76 	{
       
    77 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicBeginArgument));
       
    78 #ifndef TRANSITIONS_DISABLED
       
    79 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aKey);
       
    80 	if(singleton) 
       
    81 		singleton->Begin(aKey,aAction);
       
    82 #endif
       
    83 	}
       
    84 
       
    85 EXPORT_C void GfxTransEffect::BeginLC(const CCoeControl * aKey,TUint aAction)
       
    86 	{
       
    87 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicBeginArgument));
       
    88 #ifndef TRANSITIONS_DISABLED	
       
    89 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aKey);
       
    90 	if(singleton) 
       
    91 		singleton->BeginLC(aKey,aAction);
       
    92 #endif
       
    93 	}
       
    94 
       
    95 EXPORT_C void GfxTransEffect::End(const CCoeControl * aKey)
       
    96 	{
       
    97 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicEndArgument));
       
    98 #ifndef TRANSITIONS_DISABLED	
       
    99 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aKey);
       
   100 	if(singleton) 
       
   101 		singleton->End(aKey);
       
   102 	else 
       
   103 		aKey->DrawNow();
       
   104 #else
       
   105 	aKey->DrawNow();
       
   106 #endif
       
   107 	}
       
   108 	
       
   109 EXPORT_C void GfxTransEffect::NotifyExternalState(TInt aState, const TDesC8* aArg)
       
   110 	{
       
   111 #ifndef TRANSITIONS_DISABLED
       
   112 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   113 	if(singleton) 
       
   114 		singleton->NotifyExternalState(aState,aArg);
       
   115 #endif	
       
   116 	}
       
   117 
       
   118 	
       
   119 EXPORT_C void GfxTransEffect::Abort(const CCoeControl * aKey)
       
   120 	{
       
   121 	__ASSERT_DEBUG(aKey,Panic(EGfxTransEffectPanicAbortArgument));
       
   122 #ifndef TRANSITIONS_DISABLED	
       
   123 	CGfxTransEffect *singleton = CGfxTransEffect::StaticNoCreate(aKey);
       
   124 	if(singleton) 
       
   125 		singleton->Abort(aKey);
       
   126 #endif
       
   127 	}
       
   128 
       
   129 EXPORT_C void GfxTransEffect::SetHints(const CCoeControl * aControl,TUint aFlags)
       
   130 	{
       
   131 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicSetHintsArgument));
       
   132 #ifndef TRANSITIONS_DISABLED	
       
   133 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   134 	if(singleton) 
       
   135 		singleton->SetHints(aControl,aFlags);
       
   136 #endif
       
   137 	}
       
   138 	
       
   139 EXPORT_C TUint GfxTransEffect::GetHints(const CCoeControl * aControl)
       
   140 	{
       
   141 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicGetHintsArgument));
       
   142 #ifndef TRANSITIONS_DISABLED
       
   143 	CGfxTransEffect *singleton = CGfxTransEffect::StaticNoCreate(aControl);
       
   144 	if(singleton) 
       
   145 		return singleton->GetHints(aControl);
       
   146 	else 
       
   147 		return 0;
       
   148 #else
       
   149 	return 0;
       
   150 #endif
       
   151 	}
       
   152 	
       
   153 EXPORT_C void GfxTransEffect::SetHints(const CCoeControl * aControl,TUid aLayerType)
       
   154 	{
       
   155 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicSetHintsArgument));
       
   156 #ifndef TRANSITIONS_DISABLED	
       
   157 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   158 	if(singleton) 
       
   159 		singleton->SetHints(aControl,aLayerType);
       
   160 #endif
       
   161 	}
       
   162 
       
   163 EXPORT_C void GfxTransEffect::Invalidate(const CCoeControl * aControl)
       
   164 	{
       
   165 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicInvalidateArgument));
       
   166 #ifndef TRANSITIONS_DISABLED	
       
   167 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   168 	if(singleton) 
       
   169 		singleton->Invalidate(aControl);
       
   170 #endif
       
   171 	}
       
   172 	
       
   173 EXPORT_C void GfxTransEffect::SetDemarcation(const CCoeControl * aControl,TPoint const &aDemarcation)
       
   174 	{
       
   175 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicSetDemarcationArgument));
       
   176 #ifndef TRANSITIONS_DISABLED	
       
   177 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   178 	if(singleton) 
       
   179 		singleton->SetDemarcation(aControl,aDemarcation);
       
   180 #endif
       
   181 	}
       
   182 	
       
   183 EXPORT_C void GfxTransEffect::SetDemarcation(TVwsViewId const &aView,TPoint const &aDemarcation)
       
   184 	{
       
   185 #ifndef TRANSITIONS_DISABLED	
       
   186 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   187 	if(singleton) 
       
   188 		singleton->SetDemarcation(aView,aDemarcation);
       
   189 #endif
       
   190 	}
       
   191 	
       
   192 EXPORT_C void GfxTransEffect::SetDemarcation(const CCoeControl * aControl,TRect const &aDemarcation)
       
   193 	{
       
   194 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicSetDemarcationArgument));
       
   195 #ifndef TRANSITIONS_DISABLED	
       
   196 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   197 	if(singleton) 
       
   198 		singleton->SetDemarcation(aControl,aDemarcation);
       
   199 #endif
       
   200 	}
       
   201 	
       
   202 EXPORT_C void GfxTransEffect::SetDemarcation(TVwsViewId const &aView,TRect const &aDemarcation)
       
   203 	{
       
   204 #ifndef TRANSITIONS_DISABLED	
       
   205 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   206 	if(singleton) 
       
   207 		singleton->SetDemarcation(aView,aDemarcation);
       
   208 #endif
       
   209 	}
       
   210 	
       
   211 EXPORT_C void GfxTransEffect::SetDemarcation(const CCoeControl * aControl,const CCoeControl * aSrc,TRect const &aDemarcation)
       
   212 	{
       
   213 	__ASSERT_DEBUG(aControl,Panic(EGfxTransEffectPanicSetDemarcationArgument));
       
   214 #ifndef TRANSITIONS_DISABLED	
       
   215 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   216 	if(singleton) 
       
   217 		singleton->SetDemarcation(aControl,aSrc,aDemarcation);
       
   218 #endif
       
   219 	}
       
   220 	
       
   221 EXPORT_C void GfxTransEffect::SetDemarcation(TVwsViewId const &aView,const CCoeControl * aSrc,TRect const &aDemarcation)
       
   222 	{
       
   223 #ifndef TRANSITIONS_DISABLED	
       
   224 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   225 	if(singleton) 
       
   226 		singleton->SetDemarcation(aView,aSrc,aDemarcation);
       
   227 #endif
       
   228 	}
       
   229 
       
   230 EXPORT_C void GfxTransEffect::Enable()
       
   231 	{
       
   232 #ifndef TRANSITIONS_DISABLED	
       
   233 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   234 	if(singleton) 
       
   235 		singleton->Enable();
       
   236 #endif
       
   237 	}
       
   238 
       
   239 EXPORT_C void GfxTransEffect::Disable()
       
   240 	{
       
   241 #ifndef TRANSITIONS_DISABLED	
       
   242 	CGfxTransEffect *singleton = CGfxTransEffect::StaticNoCreate();
       
   243 	if(singleton) 
       
   244 		singleton->Disable();
       
   245 #endif
       
   246 	}
       
   247 	
       
   248 EXPORT_C TBool GfxTransEffect::IsEnabled()
       
   249 	{
       
   250 #ifndef TRANSITIONS_DISABLED	
       
   251 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   252 	if(singleton) 
       
   253 		return singleton->IsEnabled();
       
   254 	else 
       
   255 		return EFalse;
       
   256 #else
       
   257 	return EFalse;
       
   258 #endif
       
   259 	}
       
   260 	
       
   261 EXPORT_C void GfxTransEffect::Abort()
       
   262 	{
       
   263 #ifndef TRANSITIONS_DISABLED	
       
   264 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   265 	if(singleton) 
       
   266 		singleton->Abort();
       
   267 #endif
       
   268 	}
       
   269 
       
   270 //API Additions.
       
   271 
       
   272 EXPORT_C void GfxTransEffect::SetEndDemarcation(const CCoeControl* aControl, const TRect& aDemarcation)
       
   273 	{
       
   274 #ifndef TRANSITIONS_DISABLED	
       
   275 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   276 	if(singleton) 
       
   277 		singleton->SetEndDemarcation(aControl, aDemarcation);
       
   278 #endif
       
   279 	}
       
   280 
       
   281 EXPORT_C void GfxTransEffect::SetBeginDemarcation(const CCoeControl* aControl, const TRect& aDemarcation)
       
   282 	{
       
   283 #ifndef TRANSITIONS_DISABLED	
       
   284 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   285 	if(singleton) 
       
   286 		singleton->SetBeginDemarcation(aControl, aDemarcation);
       
   287 #endif
       
   288 	}
       
   289 
       
   290 EXPORT_C TInt GfxTransEffect::BeginGroup()
       
   291 	{
       
   292 #ifndef TRANSITIONS_DISABLED	
       
   293 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   294 	if(singleton) 
       
   295 		return singleton->BeginGroup();
       
   296 	return 0;
       
   297 #else
       
   298 	return 0;
       
   299 #endif
       
   300 	}
       
   301 
       
   302 EXPORT_C void GfxTransEffect::EndGroup(TInt aGroupId)
       
   303 	{
       
   304 #ifndef TRANSITIONS_DISABLED	
       
   305 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   306 	if(singleton) 
       
   307 		singleton->EndGroup(aGroupId);
       
   308 #endif
       
   309 	}
       
   310 
       
   311 EXPORT_C void GfxTransEffect::SetTransitionData(TUint aType, const TDesC8& aData)
       
   312 	{
       
   313 #ifndef TRANSITIONS_DISABLED	
       
   314 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   315 	if(singleton) 
       
   316 		singleton->SetTransitionData(aType, aData);
       
   317 #endif
       
   318 	}
       
   319 
       
   320 EXPORT_C void GfxTransEffect::RegisterDrawItemControl(const CCoeControl* aControl, TUid aType)
       
   321 	{
       
   322 #ifndef TRANSITIONS_DISABLED	
       
   323 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   324 	if(singleton) 
       
   325 		singleton->RegisterDrawItemControl(aControl, aType);
       
   326 #endif
       
   327 	}
       
   328 
       
   329 EXPORT_C void GfxTransEffect::BeginDrawItem(const CCoeControl* aControl, TUint aId, TUid aType,TRect &aDrawRect,const TRect* aFromRect, const TRect* aToRect)
       
   330 	{
       
   331 #ifndef TRANSITIONS_DISABLED	
       
   332 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   333 	if(singleton) 
       
   334 		singleton->BeginDrawItem(aControl, aId, aType, aDrawRect, aFromRect, aToRect);
       
   335 #endif
       
   336 	}
       
   337 
       
   338 EXPORT_C void GfxTransEffect::EndDrawItem(const CCoeControl* aControl)
       
   339 	{
       
   340 #ifndef TRANSITIONS_DISABLED	
       
   341 	CGfxTransEffect *singleton = CGfxTransEffect::Static(aControl);
       
   342 	if(singleton) 
       
   343 		singleton->EndDrawItem(aControl);
       
   344 #endif
       
   345 	}
       
   346 
       
   347 EXPORT_C void GfxTransEffect::BeginFullScreen(TUint aAction, const TRect &aEffectArea)
       
   348 	{
       
   349 #ifndef TRANSITIONS_DISABLED	
       
   350 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   351 	if(singleton) 
       
   352 		singleton->BeginFullScreen(aAction, aEffectArea);
       
   353 #endif
       
   354 	}
       
   355 
       
   356 EXPORT_C void GfxTransEffect::BeginFullScreen(TUint aAction, const TRect &aEffectArea, TUint aType, const TDesC8& aParams)
       
   357 	{
       
   358 #ifndef TRANSITIONS_DISABLED	
       
   359 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   360 	if(singleton) 
       
   361 		singleton->BeginFullScreen(aAction, aEffectArea, aType, aParams);
       
   362 #endif
       
   363 	}
       
   364 
       
   365 EXPORT_C void GfxTransEffect::EndFullScreen()
       
   366 	{
       
   367 #ifndef TRANSITIONS_DISABLED	
       
   368 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   369 	if(singleton) 
       
   370 		singleton->EndFullScreen();
       
   371 #endif
       
   372 	}
       
   373 
       
   374 EXPORT_C void GfxTransEffect::AbortFullScreen()
       
   375 	{
       
   376 #ifndef TRANSITIONS_DISABLED	
       
   377 	CGfxTransEffect *singleton = CGfxTransEffect::StaticNoCreate();
       
   378 	if(singleton) 
       
   379 		singleton->AbortFullScreen();
       
   380 #endif
       
   381 	}
       
   382 
       
   383 EXPORT_C void GfxTransEffect::SetTransitionObserver(MGfxTransEffectObserver *aObserver)
       
   384 	{
       
   385 #ifndef TRANSITIONS_DISABLED
       
   386 	CGfxTransEffect *singleton = CGfxTransEffect::Static();
       
   387 	if(singleton) 
       
   388 		singleton->SetTransitionObserver(aObserver);
       
   389 #endif
       
   390 	}