idlehomescreen/xmluirendering/uiengine/src/xnuiengine.cpp
changeset 0 f72a12da539e
child 9 f966699dea19
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:  UI Engine class
       
    15 *
       
    16 */
       
    17 
       
    18 // User includes
       
    19 #include "xnuiengine.h"
       
    20 #include "xnuienginepluginif.h"
       
    21 #include "xnuiengineappif.h"
       
    22 #include "xnuiengineimpl.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CXnUiEngine::CXnUiEngine
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CXnUiEngine::CXnUiEngine()
       
    33     {
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CXnUiEngine::ConstructL
       
    38 // Symbian 2nd phase constructor can leave
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 void CXnUiEngine::ConstructL( CXnAppUiAdapter& aAdapter )
       
    42     {
       
    43     iUiEngineImpl = CXnUiEngineImpl::NewL( *this, aAdapter );
       
    44 
       
    45     iUiEngineImpl->ConstructL();
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CXnUiEngine::NewL
       
    50 // Two-phased constructor
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CXnUiEngine* CXnUiEngine::NewL( CXnAppUiAdapter& aAdapter )
       
    54     {
       
    55     CXnUiEngine* self = new ( ELeave ) CXnUiEngine;
       
    56 
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL( aAdapter );
       
    59     CleanupStack::Pop();
       
    60 
       
    61     return self;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CXnUiEngine::~CXnUiEngine
       
    66 // Destructor
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CXnUiEngine::~CXnUiEngine()
       
    70     {
       
    71     delete iUiEngineImpl;
       
    72     delete iPluginIf;
       
    73     delete iAppIf;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CXnUiEngine::AppUiAdapter
       
    78 // Forwards the call to the ui engine implementation
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CXnAppUiAdapter& CXnUiEngine::AppUiAdapter() const
       
    82     {
       
    83     return iUiEngineImpl->AppUiAdapter();
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CXnUiEngine::RootNode
       
    88 // Forwards the call to the ui engine implementation
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 CXnNode* CXnUiEngine::RootNode()
       
    92     {
       
    93     return iUiEngineImpl->RootNode();
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CXnUiEngine::FindNodeByIdL
       
    98 // Forwards the call to the ui engine implementation
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 CXnNode* CXnUiEngine::FindNodeByIdL(
       
   102         const TDesC& aAreaId, const TDesC& aNamespace )
       
   103     {
       
   104     return iUiEngineImpl->FindNodeByIdL( aAreaId, aNamespace );
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CXnUiEngine::FindNodeByIdL
       
   109 // Forwards the call to the ui engine implementation
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 CXnNode* CXnUiEngine::FindNodeByIdL(
       
   113         const TDesC8& aAreaId, const TDesC8& aNamespace )
       
   114     {
       
   115     return iUiEngineImpl->FindNodeByIdL( aAreaId, aNamespace );
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CXnUiEngine::FindNodeByClassL
       
   120 // Forwards the call to the ui engine implementation
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 CXnPointerArray* CXnUiEngine::FindNodeByClassL( const TDesC& aClassId,
       
   124     const TDesC& aNamespace )
       
   125     {
       
   126     return iUiEngineImpl->FindNodeByClassL( aClassId, aNamespace );
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CXnUiEngine::FindNodeByClassL
       
   131 // Forwards the call to the ui engine implementation
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 CXnPointerArray* CXnUiEngine::FindNodeByClassL( const TDesC8& aClassId,
       
   135     const TDesC8& aNamespace )
       
   136     {
       
   137     return iUiEngineImpl->FindNodeByClassL( aClassId, aNamespace );
       
   138     }
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CXnUiEngine::RenderUIL
       
   142 // Forwards the call to the ui engine implementation
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void CXnUiEngine::RenderUIL( CXnNode* aNode )
       
   146     {
       
   147     iUiEngineImpl->LayoutUIL( aNode );
       
   148     iUiEngineImpl->RenderUIL( aNode );
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CXnUiEngine::LayoutUIL
       
   153 // Forwards the call to the ui engine implementation
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 void CXnUiEngine::LayoutUIL( CXnNode* aNode )
       
   157     {
       
   158     iUiEngineImpl->LayoutUIL( aNode );
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CXnUiEngine::Resources
       
   163 // Forwards the call to the ui engine implementation
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 CArrayPtrSeg< CXnResource >& CXnUiEngine::Resources()
       
   167     {
       
   168     return iUiEngineImpl->Resources();
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CXnUiEngine::SetFocusedNodeL
       
   173 // Forwards the call to the ui engine implementation
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 void CXnUiEngine::SetFocusedNodeL( CXnNode* aFocusedNode, TInt aSource )
       
   177     {
       
   178     iUiEngineImpl->SetFocusedNodeL( aFocusedNode, aSource );
       
   179     }
       
   180 
       
   181 // -----------------------------------------------------------------------------
       
   182 // CXnUiEngine::FocusedNode
       
   183 // Forwards the call to the ui engine implementation
       
   184 // -----------------------------------------------------------------------------
       
   185 //
       
   186 CXnNode* CXnUiEngine::FocusedNode()
       
   187     {
       
   188     return iUiEngineImpl->FocusedNode();
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CXnUiEngine::IsEditMode
       
   193 // Returns ETrue if the current mode is edit, otherwise EFalse.
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 TBool CXnUiEngine::IsEditMode()
       
   197     {
       
   198     return iUiEngineImpl->IsEditMode();
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CXnUiEngine::ODT
       
   203 // Forwards the call to the ui engine implementation
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 CXnODT* CXnUiEngine::ODT()
       
   207     {
       
   208     return iUiEngineImpl->ODT();
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CXnUiEngine::VerticalPixelValueL
       
   213 // Forwards the call to the ui engine implementation
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 TInt CXnUiEngine::VerticalPixelValueL(
       
   217         CXnProperty* aValue, TInt aReferenceValue )
       
   218     {
       
   219     return iUiEngineImpl->VerticalPixelValueL( aValue, aReferenceValue );
       
   220     }
       
   221 
       
   222 // -----------------------------------------------------------------------------
       
   223 // CXnUiEngine::HorizontalPixelValueL
       
   224 // Forwards the call to the ui engine implementation
       
   225 // -----------------------------------------------------------------------------
       
   226 //
       
   227 TInt CXnUiEngine::HorizontalPixelValueL(
       
   228         CXnProperty* aValue, TInt aReferenceValue )
       
   229     {
       
   230     return iUiEngineImpl->HorizontalPixelValueL( aValue, aReferenceValue );
       
   231     }
       
   232 
       
   233 // -----------------------------------------------------------------------------
       
   234 // CXnUiEngine::VerticalTwipValueL
       
   235 // Forwards the call to the ui engine implementation
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 TInt CXnUiEngine::VerticalTwipValueL(
       
   239         CXnProperty* aValue, TInt aReferenceValue )
       
   240     {
       
   241     return iUiEngineImpl->VerticalTwipValueL( aValue, aReferenceValue );
       
   242     }
       
   243 
       
   244 // -----------------------------------------------------------------------------
       
   245 // CXnUiEngine::HorizontalTwipValueL
       
   246 // Forwards the call to the ui engine implementation
       
   247 // -----------------------------------------------------------------------------
       
   248 //
       
   249 TInt CXnUiEngine::HorizontalTwipValueL(
       
   250         CXnProperty* aValue, TInt aReferenceValue )
       
   251     {
       
   252     return iUiEngineImpl->HorizontalTwipValueL( aValue, aReferenceValue );
       
   253     }
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 // CXnUiEngine::ActivateViewL
       
   257 // Activate a view
       
   258 // -----------------------------------------------------------------------------
       
   259 //
       
   260 void CXnUiEngine::ActivateViewL( CXnNode& /*aViewNode*/ )
       
   261     {    
       
   262     }
       
   263 
       
   264 // -----------------------------------------------------------------------------
       
   265 // CXnUiEngine::ViewManager
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 CXnViewManager* CXnUiEngine::ViewManager()
       
   269     {
       
   270     return iUiEngineImpl->ViewManager();
       
   271     }
       
   272 
       
   273 // -----------------------------------------------------------------------------
       
   274 // CXnUiEngine::ActiveView
       
   275 // Returns the active view
       
   276 // -----------------------------------------------------------------------------
       
   277 //
       
   278 CXnNode* CXnUiEngine::ActiveView()
       
   279     {
       
   280     return iUiEngineImpl->ActiveView();
       
   281     }
       
   282 
       
   283 // -----------------------------------------------------------------------------
       
   284 // CXnUiEngine::RefreshMenuL
       
   285 // Refresh current menu
       
   286 // -----------------------------------------------------------------------------
       
   287 //
       
   288 void CXnUiEngine::RefreshMenuL()
       
   289     {
       
   290     iUiEngineImpl->RefreshMenuL();
       
   291     }
       
   292 
       
   293 // -----------------------------------------------------------------------------
       
   294 // CXnUiEngine::AddDirtyNodeL
       
   295 // Add a dirty node
       
   296 // -----------------------------------------------------------------------------
       
   297 //
       
   298 void CXnUiEngine::AddDirtyNodeL( CXnNode* aNode, TInt aLevel )
       
   299     {
       
   300     iUiEngineImpl->AddDirtyNodeL( aNode, aLevel );
       
   301     }
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CXnUiEngine::PluginIfL
       
   305 // Get plugin interface
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 TXnUiEnginePluginIf& CXnUiEngine::PluginIfL()
       
   309     {
       
   310     if ( iPluginIf )
       
   311         {
       
   312         return *iPluginIf;
       
   313         }
       
   314     else
       
   315         {
       
   316         iPluginIf = new ( ELeave ) TXnUiEnginePluginIf( *this );
       
   317         return *iPluginIf;
       
   318         }
       
   319     }
       
   320 
       
   321 // -----------------------------------------------------------------------------
       
   322 // CXnUiEngine::AppIfL
       
   323 // Get application interface
       
   324 // -----------------------------------------------------------------------------
       
   325 //
       
   326 TXnUiEngineAppIf& CXnUiEngine::AppIfL()
       
   327     {
       
   328     if ( iAppIf )
       
   329         {
       
   330         return *iAppIf;
       
   331         }
       
   332     else
       
   333         {
       
   334         iAppIf = new ( ELeave ) TXnUiEngineAppIf( *this );
       
   335         return *iAppIf;
       
   336         }
       
   337     }
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CXnUiEngine::ScreenDeviceSize
       
   341 // Get the size of the current screen device
       
   342 // -----------------------------------------------------------------------------
       
   343 //
       
   344 TSize CXnUiEngine::ScreenDeviceSize() const
       
   345     {
       
   346     return iUiEngineImpl->ScreenDeviceSize();        
       
   347     }
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // CXnUiEngine::IsDialogDisplaying
       
   351 // Checks whether the dialog is displaying or not
       
   352 // -----------------------------------------------------------------------------
       
   353 //
       
   354 TBool CXnUiEngine::IsDialogDisplaying()
       
   355     {
       
   356     return iUiEngineImpl->IsDialogDisplaying();
       
   357     }
       
   358 
       
   359 // -----------------------------------------------------------------------------
       
   360 // CXnUiEngine::IsMenuDisplaying
       
   361 // Checks whether the menu is displaying or not
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 TBool CXnUiEngine::IsMenuDisplaying()
       
   365     {
       
   366     return iUiEngineImpl->IsMenuDisplaying();
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // CXnUiEngine::MenuBarNode
       
   371 // Returns menubar node
       
   372 // -----------------------------------------------------------------------------
       
   373 //
       
   374 CXnNode* CXnUiEngine::MenuBarNode() const
       
   375     {
       
   376     return iUiEngineImpl->MenuBarNode();
       
   377     }
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // CXnUiEngine::StylusPopupNode
       
   381 // Returns stylus popup node
       
   382 // -----------------------------------------------------------------------------
       
   383 //
       
   384 CXnNode* CXnUiEngine::StylusPopupNode() const
       
   385     {
       
   386     return iUiEngineImpl->StylusPopupNode();
       
   387     }
       
   388 
       
   389 // -----------------------------------------------------------------------------
       
   390 // CXnUiEngine::AddPassiveFocusedNode
       
   391 // -----------------------------------------------------------------------------
       
   392 //
       
   393 void CXnUiEngine::AddPassiveFocusedNodeL( CXnNode* aNode )
       
   394     {
       
   395     iUiEngineImpl->AddPassiveFocusedNodeL( aNode );
       
   396     }
       
   397 
       
   398 // -----------------------------------------------------------------------------
       
   399 // CXnUiEngine::RemovePassiveFocusedNode
       
   400 // -----------------------------------------------------------------------------
       
   401 //
       
   402 void CXnUiEngine::RemovePassiveFocusedNodeL( CXnNode* aNode )
       
   403     {
       
   404     iUiEngineImpl->RemovePassiveFocusedNodeL( aNode );
       
   405     }
       
   406 
       
   407 // -----------------------------------------------------------------------------
       
   408 // CXnUiEngine::AddPassiveFocusedNode
       
   409 // -----------------------------------------------------------------------------
       
   410 //
       
   411 void CXnUiEngine::ClearPassiveFocusedNodesL()
       
   412     {
       
   413     iUiEngineImpl->ClearPassiveFocusedNodesL();
       
   414     }
       
   415 
       
   416 // -----------------------------------------------------------------------------
       
   417 // CXnUiEngine::SetClientRectL
       
   418 // -----------------------------------------------------------------------------
       
   419 //
       
   420 void CXnUiEngine::SetClientRectL( TRect aRect, TBool aDrawNow )
       
   421     {
       
   422     return iUiEngineImpl->SetClientRectL( aRect, aDrawNow );
       
   423     }
       
   424 
       
   425 // -----------------------------------------------------------------------------
       
   426 // CXnUiEngine::ClientRect
       
   427 // -----------------------------------------------------------------------------
       
   428 //
       
   429 TRect CXnUiEngine::ClientRect() const
       
   430     {
       
   431     return iUiEngineImpl->ClientRect();
       
   432     } 
       
   433 
       
   434 // -----------------------------------------------------------------------------
       
   435 // CXnUiEngine::SetNodeDroppedL
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 void CXnUiEngine::SetNodeDroppedL( CXnNode& aNode, TInt aDropped ) const
       
   439     {
       
   440     iUiEngineImpl->SetNodeDroppedL( aNode, aDropped );
       
   441     }
       
   442 
       
   443 // -----------------------------------------------------------------------------
       
   444 // CXnUiEngine::CheckAdaptiveContentL
       
   445 // -----------------------------------------------------------------------------
       
   446 //
       
   447 void CXnUiEngine::CheckAdaptiveContentL(
       
   448     CXnNode& aNode, TSize aAvailableSize ) const
       
   449     {
       
   450     iUiEngineImpl->CheckAdaptiveContentL( aNode, aAvailableSize );
       
   451     }
       
   452 
       
   453 // -----------------------------------------------------------------------------
       
   454 // CXnUiEngine::AddFocusCandidateL
       
   455 // -----------------------------------------------------------------------------
       
   456 //
       
   457 void CXnUiEngine::AddFocusCandidateL( CXnNode* aNode )
       
   458     {
       
   459     iUiEngineImpl->AddFocusCandidateL( aNode );
       
   460     }
       
   461 
       
   462 // -----------------------------------------------------------------------------
       
   463 // CXnUiEngine::Editor
       
   464 // -----------------------------------------------------------------------------
       
   465 //
       
   466 CXnEditor* CXnUiEngine::Editor() const
       
   467     {
       
   468     return iUiEngineImpl->Editor();
       
   469     }
       
   470 
       
   471 // -----------------------------------------------------------------------------
       
   472 // CXnUiEngine::EditMode
       
   473 // -----------------------------------------------------------------------------
       
   474 //
       
   475 CXnEditMode* CXnUiEngine::EditMode()
       
   476     {
       
   477     return iUiEngineImpl->EditMode();
       
   478     }
       
   479 
       
   480 // -----------------------------------------------------------------------------
       
   481 // CXnUiEngine::Plugins
       
   482 // -----------------------------------------------------------------------------
       
   483 //
       
   484 RPointerArray< CXnNode >* CXnUiEngine::Plugins()
       
   485     {
       
   486     return iUiEngineImpl->Plugins();
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // CXnUiEngine::HitTest
       
   491 // -----------------------------------------------------------------------------
       
   492 //
       
   493 CXnHitTest& CXnUiEngine::HitTest() const
       
   494     {
       
   495     return iUiEngineImpl->HitTest();
       
   496     }
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CXnUiEngine::PositionStylusPopupL
       
   500 // -----------------------------------------------------------------------------
       
   501 //
       
   502 void CXnUiEngine::PositionStylusPopupL( CXnNode& aNode,
       
   503     CXnNode& aReference, const TPoint& aPosition )
       
   504     {
       
   505     iUiEngineImpl->PositionStylusPopupL( aNode, aReference, aPosition );
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // CXnUiEngine::GetThemeResource
       
   510 // -----------------------------------------------------------------------------
       
   511 //
       
   512 TInt CXnUiEngine::GetThemeResource( const TDesC& aPath, RFile& aFile )
       
   513     {
       
   514     return iUiEngineImpl->GetThemeResource( aPath, aFile );
       
   515     }
       
   516 
       
   517 // -----------------------------------------------------------------------------
       
   518 // CXnUiEngine::AnalyseAddedWidgetL
       
   519 // -----------------------------------------------------------------------------
       
   520 //
       
   521 TBool CXnUiEngine::AnalyseAddedWidgetL( CXnNode& aNode )
       
   522     {
       
   523     return iUiEngineImpl->AnalyseAddedWidgetL( aNode );
       
   524     }
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // -----------------------------------------------------------------------------
       
   528 //               
       
   529 void CXnUiEngine::DisableRenderUiLC()
       
   530     {
       
   531     iUiEngineImpl->DisableRenderUiLC();
       
   532     }
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   535 // -----------------------------------------------------------------------------
       
   536 //               
       
   537 void CXnUiEngine::SetEventDispatcher( CXnKeyEventDispatcher* aDispatcher )
       
   538     {
       
   539     iUiEngineImpl->SetEventDispatcher( aDispatcher );
       
   540     }
       
   541 
       
   542 #ifndef EKA2
       
   543 GLDEF_C TInt  E32Dll( TDllReason )
       
   544     {
       
   545     return KErrNone;
       
   546     }
       
   547 #endif