idlehomescreen/xmluirendering/uiengine/src/xnappuiadapter.cpp
changeset 0 f72a12da539e
child 2 08c6ee43b396
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation for Avkon AppUi adapter
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <aknview.h>
       
    20 #include <akntoolbar.h>
       
    21 
       
    22 // User includes
       
    23 #include "xnappuiadapter.h"
       
    24 #include "xnappuiadapterimpl.h"
       
    25 #include "xnviewadapter.h"
       
    26 #include "xnuiengineappif.h"
       
    27 #include "xnfocuscontrol.h"
       
    28 
       
    29 #include "xuikon_builds_cfg.hrh"
       
    30 
       
    31 #ifdef _XN_PERFORMANCE_TEST_
       
    32 #include "xntimemon.h"
       
    33 #endif
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CXnAppUiAdapter::CXnAppUiAdapter
       
    39 // C++ default constructor can NOT contain any code, that
       
    40 // might leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 EXPORT_C CXnAppUiAdapter::CXnAppUiAdapter( TUid aApplicationUid )
       
    44     : iApplicationUid( aApplicationUid )
       
    45     {    
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CXnAppUiAdapter::ConstructL
       
    50 // Second-phase constructor
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C void CXnAppUiAdapter::ConstructL()
       
    54     {
       
    55 #ifdef _XN_PERFORMANCE_TEST_
       
    56     TInt start( 0 );
       
    57     TInt end( 0 );
       
    58     TInt diff( 0 );
       
    59     CXnTimeMon::PrintUserMem( _L( "CXnAppUiAdapter::ConstructL(): - Calling CAknViewAppUi::BaseConstructL().." ) );
       
    60     User::AllocSize( start );
       
    61 #endif //_XN_PERFORMANCE_TEST_
       
    62 
       
    63     CAknViewAppUi::BaseConstructL( EAknEnableSkin | EAknEnableMSK );
       
    64 
       
    65     CAknToolbar* toolbar( CurrentFixedToolbar() );
       
    66 
       
    67     if ( toolbar )
       
    68         {
       
    69         toolbar->SetToolbarVisibility( EFalse );
       
    70 
       
    71         toolbar->DisableToolbarL( ETrue );
       
    72         }
       
    73     
       
    74 #ifdef _XN_PERFORMANCE_TEST_
       
    75     User::AllocSize( end );
       
    76     diff = end - start;
       
    77     RDebug::Print( _L( "CAknViewAppUi::BaseConstructL allocation: %d" ), diff );
       
    78     CXnTimeMon::PrintUserMem( _L( "CXnAppUiAdapter::ConstructL(): - Calling CXnAppUiAdapterImpl::NewL().." ) );
       
    79     User::AllocSize( start );
       
    80 #endif //_XN_PERFORMANCE_TEST_
       
    81     
       
    82     iImpl = CXnAppUiAdapterImpl::NewL( iApplicationUid, *this );
       
    83     iImpl->ConstructL();
       
    84         
       
    85 #ifdef _XN_PERFORMANCE_TEST_
       
    86     User::AllocSize( end );
       
    87     diff = end-start;
       
    88     RDebug::Print( _L( "Xuikon launch allocation: %d" ), diff );
       
    89     
       
    90     CXnTimeMon::PrintUserMem( _L( "CXnAppUiAdapter::ConstructL() .. all done." ) );
       
    91 #endif //_XN_PERFORMANCE_TEST_
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // Destructor
       
    96 //
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 EXPORT_C CXnAppUiAdapter::~CXnAppUiAdapter()
       
   100     {          
       
   101     delete iUiEngineAppIf;
       
   102     
       
   103     delete iImpl;    
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CXnAppUiAdapter::HandleResourceChangeL
       
   108 // Handles resource changes
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C void CXnAppUiAdapter::HandleResourceChangeL( TInt aType )
       
   112     {
       
   113 #ifdef _XN_PERFORMANCE_TEST_
       
   114     RDebug::Print( _L( "CXnAppUiAdapter::HandleResourceChangeL - start" ) );
       
   115 #endif //_XN_PERFORMANCE_TEST_
       
   116 
       
   117     CAknViewAppUi::HandleResourceChangeL( aType );
       
   118 
       
   119     if ( iImpl )
       
   120         {
       
   121         iImpl->HandleResourceChangeL( aType );
       
   122         }
       
   123 
       
   124 #ifdef _XN_PERFORMANCE_TEST_
       
   125     RDebug::Print( _L( "CXnAppUiAdapter::HandleResourceChangeL - end" ) );
       
   126 #endif //_XN_PERFORMANCE_TEST_
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CXnAppUiAdapter::UiEngine
       
   131 // Get UI engine proxy
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C TXnUiEngineAppIf* CXnAppUiAdapter::UiEngineL()
       
   135     {
       
   136     if ( !iUiEngineAppIf )
       
   137         {
       
   138         iUiEngineAppIf = new ( ELeave ) TXnUiEngineAppIf( UiEngine() );
       
   139         }
       
   140     
       
   141     return iUiEngineAppIf;
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CXnAppUiAdapter::HandleXuikonEventL
       
   146 // Handle callbacks from the engine
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 EXPORT_C void CXnAppUiAdapter::HandleXuikonEventL(
       
   150     CXnNodeAppIf& /*aOrigin*/,
       
   151     CXnNodeAppIf& /*aTrigger*/,
       
   152     CXnDomNode& /*aTriggerDefinition*/,
       
   153     CXnDomNode& /*aEvent*/ )
       
   154     {
       
   155     }
       
   156 
       
   157 // -----------------------------------------------------------------------------
       
   158 // CXnAppUiAdapter::LoadDataPluginsL
       
   159 //
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 EXPORT_C void CXnAppUiAdapter::LoadDataPluginsL(
       
   163     RPointerArray< CXnNodeAppIf >& /*aList*/ )
       
   164     {
       
   165     // Default empty implementation
       
   166     }
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // CXnAppUiAdapter::DestroyDataPluginsL
       
   170 //
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 EXPORT_C void CXnAppUiAdapter::DestroyDataPluginsL(
       
   174     RPointerArray< CXnNodeAppIf >& /*aList*/ )
       
   175     {
       
   176     // Default empty implementation
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CXnAppUiAdapter::DynInitMenuItemL
       
   181 //
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 EXPORT_C TBool CXnAppUiAdapter::DynInitMenuItemL( const TDesC& /*aItemType*/,          
       
   185     RPointerArray< CXnNodeAppIf >* /*aList*/ )
       
   186     {
       
   187     // Default empty implementation
       
   188     return EFalse;
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CXnAppUiAdapter::SetOnlineStateL
       
   193 //
       
   194 // -----------------------------------------------------------------------------
       
   195 //    
       
   196 EXPORT_C void CXnAppUiAdapter::SetOnlineStateL( 
       
   197     RPointerArray< CXnNodeAppIf >& /*aList*/ )
       
   198     {
       
   199     // Default empty implementation
       
   200     }
       
   201 
       
   202 // -----------------------------------------------------------------------------
       
   203 // CXnAppUiAdapter::View
       
   204 //
       
   205 // -----------------------------------------------------------------------------
       
   206 //    
       
   207 EXPORT_C CAknView& CXnAppUiAdapter::View() const
       
   208     {
       
   209     return iImpl->ViewAdapter();
       
   210     }
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // CXnAppUiAdapter::HandlePageSwitch
       
   214 //
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 EXPORT_C void CXnAppUiAdapter::HandlePageSwitch()
       
   218     {
       
   219     // Default empty implementation
       
   220     }
       
   221 
       
   222 // -----------------------------------------------------------------------------
       
   223 // CXnAppUiAdapter::HandleEnterEditModeL
       
   224 //
       
   225 // -----------------------------------------------------------------------------
       
   226 //
       
   227 EXPORT_C void CXnAppUiAdapter::HandleEnterEditModeL( TBool /*aEnter*/ )
       
   228     {
       
   229     // Default empty implementation
       
   230     }
       
   231        
       
   232 // -----------------------------------------------------------------------------
       
   233 // CXnAppUiAdapter::ReloadUiL
       
   234 //
       
   235 // -----------------------------------------------------------------------------
       
   236 //
       
   237 void CXnAppUiAdapter::ReloadUiL()
       
   238     {    
       
   239     iImpl->ReloadUiL();
       
   240     }
       
   241 
       
   242 // -----------------------------------------------------------------------------
       
   243 // CXnAppUiAdapter::UiEngine
       
   244 // 
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 CXnUiEngine& CXnAppUiAdapter::UiEngine() const
       
   248     {
       
   249     return iImpl->UiEngine();
       
   250     }
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // CXnAppUiAdapter::ViewManager
       
   254 // 
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 CXnViewManager& CXnAppUiAdapter::ViewManager() const
       
   258     {
       
   259     return iImpl->ViewManager();
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------------------------
       
   263 // CXnAppUiAdapter::ViewAdapter
       
   264 // 
       
   265 // -----------------------------------------------------------------------------
       
   266 //
       
   267 CXnViewAdapter& CXnAppUiAdapter::ViewAdapter() const
       
   268     {
       
   269     return iImpl->ViewAdapter();
       
   270     }
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CXnAppUiAdapter::UiStateListener
       
   274 // 
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 CXnUiStateListener& CXnAppUiAdapter::UiStateListener() const
       
   278     {
       
   279     return iImpl->UiStateListener();
       
   280     }
       
   281 
       
   282 // -----------------------------------------------------------------------------
       
   283 // CXnAppUiAdapter::HsContentController
       
   284 //
       
   285 // -----------------------------------------------------------------------------
       
   286 //
       
   287 MHsContentControlUi* CXnAppUiAdapter::HsContentController( 
       
   288     const TDesC8& aType ) const
       
   289     {
       
   290     return iImpl->HsContentController( aType );
       
   291     }
       
   292 	
       
   293 // -----------------------------------------------------------------------------
       
   294 // CXnAppUiAdapter::EffectManager
       
   295 //
       
   296 // -----------------------------------------------------------------------------
       
   297 //
       
   298 CXnEffectManager* CXnAppUiAdapter::EffectManager() const
       
   299     {
       
   300     return iImpl->EffectManager();
       
   301     }
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CXnAppUiAdapter::HsContentControlSrv
       
   305 //
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 MHsContentControl* CXnAppUiAdapter::HsContentControlSrv() const
       
   309     {
       
   310     return iImpl->HsContentControlSrv();
       
   311     }
       
   312 
       
   313 // -----------------------------------------------------------------------------
       
   314 // CXnAppUiAdapter::FocusShown
       
   315 //
       
   316 // -----------------------------------------------------------------------------
       
   317 //
       
   318 TBool CXnAppUiAdapter::FocusShown() const
       
   319     {
       
   320     return iImpl->ViewAdapter().FocusControl().IsVisible();
       
   321     }
       
   322 
       
   323 // -----------------------------------------------------------------------------
       
   324 // CXnAppUiAdapter::HideFocus
       
   325 //
       
   326 // -----------------------------------------------------------------------------
       
   327 //
       
   328 void CXnAppUiAdapter::HideFocus() 
       
   329     {
       
   330     return iImpl->ViewAdapter().FocusControl().MakeVisible( EFalse );
       
   331     }
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CXnAppUiAdapter::ShowFocus
       
   335 //
       
   336 // -----------------------------------------------------------------------------
       
   337 //
       
   338 void CXnAppUiAdapter::ShowFocus() 
       
   339     {
       
   340     return iImpl->ViewAdapter().FocusControl().MakeVisible( ETrue );
       
   341     }
       
   342 
       
   343 // End of file