idlehomescreen/xmluirendering/uiengine/src/xnuienginepluginif.cpp
changeset 0 f72a12da539e
child 2 08c6ee43b396
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Xuikon layout engine plugin interface
       
    15 *
       
    16 */
       
    17 
       
    18 // User includes
       
    19 #include "xnuienginepluginif.h"
       
    20 #include "xnuiengine.h"
       
    21 #include "xnnode.h"
       
    22 #include "xnnodepluginif.h"
       
    23 #include "xnproperty.h"
       
    24 #include "xnpointerarray.h"
       
    25 #include "xnodt.h"
       
    26 #include "xndomdocument.h"
       
    27 #include "xneditmode.h"
       
    28 #include "xneditor.h"
       
    29 #include "xnviewdata.h"
       
    30 #include "xndomnode.h"
       
    31 #include "xnhittest.h"
       
    32 #include "xnpanic.h"
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // TXnUiEnginePluginIf::TXnUiEnginePluginIf
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 TXnUiEnginePluginIf::TXnUiEnginePluginIf( CXnUiEngine& aUiEngine )
       
    43     {
       
    44     iUiEngine = &aUiEngine;
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // TXnUiEnginePluginIf::RootNode
       
    49 // Forwards the call to the ui engine implementation
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CXnNodePluginIf& TXnUiEnginePluginIf::RootNodeL()
       
    53     {
       
    54     CXnNode* node = iUiEngine->RootNode();
       
    55     return node->PluginIfL();
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // TXnUiEnginePluginIf::FindNodeByIdL
       
    60 // Forwards the call to the ui engine implementation
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CXnNodePluginIf* TXnUiEnginePluginIf::FindNodeByIdL(
       
    64     const TDesC& aNodeId,
       
    65     const TDesC& aNamespace )
       
    66     {
       
    67     CXnNode* node = iUiEngine->FindNodeByIdL( aNodeId, aNamespace );
       
    68     if ( !node )
       
    69         {
       
    70         return NULL;
       
    71         }
       
    72     return &( node->PluginIfL() );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // TXnUiEnginePluginIf::FindNodeByIdL
       
    77 // Forwards the call to the ui engine implementation
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C CXnNodePluginIf* TXnUiEnginePluginIf::FindNodeByIdL(
       
    81     const TDesC8& aNodeId,
       
    82     const TDesC8& aNamespace )
       
    83     {
       
    84     CXnNode* node = iUiEngine->FindNodeByIdL( aNodeId, aNamespace );
       
    85     if ( !node )
       
    86         {
       
    87         return NULL;
       
    88         }
       
    89     return &( node->PluginIfL() );
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // TXnUiEnginePluginIf::FindNodeByClassL
       
    94 // Forwards the call to the ui engine implementation
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C RPointerArray< CXnNodePluginIf > TXnUiEnginePluginIf::FindNodeByClassL(
       
    98     const TDesC& aClassId )
       
    99     {
       
   100     CXnPointerArray* array = iUiEngine->FindNodeByClassL( aClassId );
       
   101     CleanupStack::PushL( array );
       
   102     RPointerArray< CXnNodePluginIf > interfaceArray;
       
   103     // Push interfaceArray.Close() on cleanup stack to free the array buffer in
       
   104     // case of a leave
       
   105     CleanupClosePushL( interfaceArray );
       
   106     const TInt count = array->Container().Count();
       
   107     // Reserve the needed array buffer in one allocation to increase
       
   108     // excution speed and decrease heap fragmentation
       
   109     interfaceArray.ReserveL( count );
       
   110     for ( TInt i = 0; i < count; ++i )
       
   111         {
       
   112         CXnNode* node = static_cast< CXnNode* >( array->Container()[i] );
       
   113         // Append cannot fail because ReserveL call before this loop has
       
   114         // allocated the array buffer
       
   115         interfaceArray.Append( &( node->PluginIfL() ) );
       
   116         }
       
   117     CleanupStack::Pop( &interfaceArray );
       
   118     CleanupStack::PopAndDestroy( array );
       
   119     return interfaceArray;
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // TXnUiEnginePluginIf::RenderUIL
       
   124 // Forwards the call to the ui engine implementation
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 EXPORT_C void TXnUiEnginePluginIf::RenderUIL( CXnNodePluginIf* aNode )
       
   128     {
       
   129     CXnNode* node = NULL;
       
   130     if ( aNode )
       
   131         {
       
   132         node = &( aNode->Node() );
       
   133         }
       
   134     iUiEngine->RenderUIL( node );
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // TXnUiEnginePluginIf::Resources
       
   139 // Forwards the call to the ui engine implementation
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 EXPORT_C CArrayPtrSeg< CXnResource >& TXnUiEnginePluginIf::Resources()
       
   143     {
       
   144     return iUiEngine->Resources();
       
   145     }
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // TXnUiEnginePluginIf::FocusedNode
       
   149 // Forwards the call to the ui engine implementation
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 EXPORT_C CXnNodePluginIf* TXnUiEnginePluginIf::FocusedNodeL()
       
   153     {
       
   154     CXnNodePluginIf* ret = NULL;
       
   155     if ( iUiEngine->FocusedNode() )
       
   156         {
       
   157         ret = &( iUiEngine->FocusedNode()->PluginIfL() );
       
   158         }
       
   159     return ret;
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // TXnUiEnginePluginIf::SetFocusedNode
       
   164 // Forwards the call to the ui engine implementation
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 EXPORT_C void TXnUiEnginePluginIf::SetFocusedNode(
       
   168     CXnNodePluginIf* aFocusedNode )
       
   169     {
       
   170     CXnNode* node( NULL );
       
   171 
       
   172     if ( aFocusedNode )
       
   173         {
       
   174         node = &( aFocusedNode->Node() );
       
   175         }
       
   176 
       
   177     TRAP_IGNORE
       
   178         (               
       
   179         node->SetStateWithoutNotificationL(
       
   180             XnPropertyNames::style::common::KFocus );        
       
   181         );
       
   182     }
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // TXnUiEnginePluginIf::RestorePreviousFocusedNode
       
   186 // Forwards the call to the ui engine implementation
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 EXPORT_C void TXnUiEnginePluginIf::RestorePreviousFocusedNode()
       
   190     {    
       
   191     }
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // TXnUiEnginePluginIf::StringPool
       
   195 // Forwards the call to the ui engine implementation
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 EXPORT_C CXnDomStringPool& TXnUiEnginePluginIf::StringPool()
       
   199     {
       
   200     return iUiEngine->ODT()->DomDocument().StringPool();
       
   201     }
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // TXnUiEnginePluginIf::VerticalPixelValueL
       
   205 // Forwards the call to the ui engine implementation
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 EXPORT_C TInt TXnUiEnginePluginIf::VerticalPixelValueL(
       
   209     CXnProperty* aValue, TInt aReferenceValue )
       
   210     {
       
   211     return iUiEngine->VerticalPixelValueL( aValue, aReferenceValue );
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // TXnUiEnginePluginIf::HorizontalPixelValueL
       
   216 // Forwards the call to the ui engine implementation
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 EXPORT_C TInt TXnUiEnginePluginIf::HorizontalPixelValueL(
       
   220     CXnProperty* aValue, TInt aReferenceValue )
       
   221     {
       
   222     return iUiEngine->HorizontalPixelValueL( aValue, aReferenceValue );
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // TXnUiEnginePluginIf::VerticalTwipValueL
       
   227 // Forwards the call to the ui engine implementation
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 EXPORT_C TInt TXnUiEnginePluginIf::VerticalTwipValueL(
       
   231     CXnProperty* aValue, TInt aReferenceValue )
       
   232     {
       
   233     return iUiEngine->VerticalTwipValueL( aValue, aReferenceValue );
       
   234     }
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // TXnUiEnginePluginIf::HorizontalTwipValueL
       
   238 // Forwards the call to the ui engine implementation
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 EXPORT_C TInt TXnUiEnginePluginIf::HorizontalTwipValueL(
       
   242     CXnProperty* aValue, TInt aReferenceValue )
       
   243     {
       
   244     return iUiEngine->HorizontalTwipValueL( aValue, aReferenceValue );
       
   245     }
       
   246 
       
   247 // -----------------------------------------------------------------------------
       
   248 // TXnUiEnginePluginIf::ActivateViewL
       
   249 // Activate a view
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 EXPORT_C void TXnUiEnginePluginIf::ActivateViewL( CXnNodePluginIf& aViewNode )
       
   253     {
       
   254     iUiEngine->ActivateViewL( aViewNode.Node() );
       
   255     }
       
   256 
       
   257 // -----------------------------------------------------------------------------
       
   258 // TXnUiEnginePluginIf::ScreenDeviceSize
       
   259 // Get the size of the current screen device
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 EXPORT_C TSize TXnUiEnginePluginIf::ScreenDeviceSize()
       
   263     {
       
   264     return iUiEngine->ScreenDeviceSize();
       
   265     }
       
   266 
       
   267 // -----------------------------------------------------------------------------
       
   268 // TXnUiEnginePluginIf::IsDialogDisplaying
       
   269 // Checks whether the dialog is displaying or not.
       
   270 // -----------------------------------------------------------------------------
       
   271 //
       
   272 EXPORT_C TBool TXnUiEnginePluginIf::IsDialogDisplaying()
       
   273     {
       
   274     return iUiEngine->IsDialogDisplaying();
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // TXnUiEnginePluginIf::AddDirtyNodeL
       
   279 // Sets the given node dirty.
       
   280 // -----------------------------------------------------------------------------
       
   281 //
       
   282 EXPORT_C void TXnUiEnginePluginIf::AddDirtyNodeL( CXnNodePluginIf& aNode )
       
   283     {
       
   284     aNode.SetDirtyL();
       
   285     }
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // TXnUiEnginePluginIf::IsMenuDisplaying
       
   289 // Checks whether the menu is displaying or not.
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 EXPORT_C TBool TXnUiEnginePluginIf::IsMenuDisplaying()
       
   293     {
       
   294     return iUiEngine->IsMenuDisplaying();
       
   295     }
       
   296 
       
   297 // -----------------------------------------------------------------------------
       
   298 // TXnUiEnginePluginIf::LayoutUIL
       
   299 // Forwards the call to the ui engine implementation
       
   300 // -----------------------------------------------------------------------------
       
   301 //
       
   302 EXPORT_C void TXnUiEnginePluginIf::LayoutUIL( CXnNodePluginIf* aNode )
       
   303     {
       
   304     CXnNode* node = NULL;
       
   305     if ( aNode )
       
   306         {
       
   307         node = &( aNode->Node() );
       
   308         }
       
   309     iUiEngine->LayoutUIL( node );
       
   310     }
       
   311 
       
   312 // -----------------------------------------------------------------------------
       
   313 // TXnUiEnginePluginIf::EditState
       
   314 // Checks wheter editmode is active or not
       
   315 // -----------------------------------------------------------------------------
       
   316 //
       
   317 EXPORT_C TInt TXnUiEnginePluginIf::EditMode()
       
   318     {
       
   319     return iUiEngine->EditMode()->EditState();
       
   320     }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // TXnUiEnginePluginIf::WidgetsVisible
       
   324 // Checks widgets' visibility state
       
   325 // -----------------------------------------------------------------------------
       
   326 //
       
   327 EXPORT_C TBool TXnUiEnginePluginIf::WidgetsVisible() const
       
   328     {
       
   329     return iUiEngine->Editor()->WidgetsVisible();
       
   330     }
       
   331 
       
   332 // -----------------------------------------------------------------------------
       
   333 // TXnUiEnginePluginIf::HitRegion
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 EXPORT_C CXnControlAdapter* TXnUiEnginePluginIf::HitRegion() const
       
   337     {
       
   338     return iUiEngine->HitTest().HitRegion();
       
   339     }
       
   340 
       
   341 // -----------------------------------------------------------------------------
       
   342 // TXnUiEnginePluginIf::DeactivateFocusedNodeL
       
   343 // Deactivates focused node
       
   344 // -----------------------------------------------------------------------------
       
   345 //
       
   346 EXPORT_C void TXnUiEnginePluginIf::DeactivateFocusedNodeL()
       
   347     {    
       
   348     }
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // TXnUiEnginePluginIf::ShowFocus
       
   352 // Queries wheter focus is visible
       
   353 // -----------------------------------------------------------------------------
       
   354 //
       
   355 EXPORT_C TBool TXnUiEnginePluginIf::ShowFocus()
       
   356     {
       
   357     return EFalse;
       
   358     }
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // TXnUiEnginePluginIf::PluginNodeL
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 EXPORT_C CXnNodePluginIf& TXnUiEnginePluginIf::PluginNodeL(
       
   365     CXnNodePluginIf* aNode )
       
   366     {
       
   367     CXnViewManager* manager( iUiEngine->ViewManager() );
       
   368     
       
   369     CXnNode* node( NULL );
       
   370     
       
   371     if ( manager )
       
   372         {
       
   373         CXnPluginData& pluginData( 
       
   374             manager->ActiveViewData().Plugin( &aNode->Node() ) );
       
   375             
       
   376         CXnDomNode* domNode( pluginData.Owner() );
       
   377         
       
   378         if ( domNode )
       
   379             {
       
   380             node = domNode->LayoutNode();
       
   381             }
       
   382         }
       
   383     
       
   384     if( !node )
       
   385         {
       
   386         User::Leave( KErrNotFound );
       
   387         }
       
   388      
       
   389     return node->PluginIfL();
       
   390     }
       
   391 
       
   392 // -----------------------------------------------------------------------------
       
   393 // TXnUiEnginePluginIf::SetFocusVisibleL
       
   394 // Sets focus visibility of active view
       
   395 // -----------------------------------------------------------------------------
       
   396 //               
       
   397 EXPORT_C void TXnUiEnginePluginIf::SetFocusVisibleL( TBool /*aVisible*/ )
       
   398     {    
       
   399     }
       
   400 
       
   401 // -----------------------------------------------------------------------------
       
   402 // TXnUiEnginePluginIf::FocusVisible
       
   403 // Gets focus visibility of active view
       
   404 // -----------------------------------------------------------------------------
       
   405 //               
       
   406 EXPORT_C TBool TXnUiEnginePluginIf::FocusVisible()
       
   407     {    
       
   408     return EFalse;    
       
   409     }
       
   410 
       
   411 // -----------------------------------------------------------------------------
       
   412 // TXnUiEnginePluginIf::EnableSwipeL
       
   413 // Sets swipe enabled or disabled
       
   414 // -----------------------------------------------------------------------------
       
   415 //               
       
   416 EXPORT_C void TXnUiEnginePluginIf::EnableSwipeL( TBool /*aEnable*/ )
       
   417     {    
       
   418     }
       
   419 
       
   420 // -----------------------------------------------------------------------------
       
   421 // TXnUiEnginePluginIf::SwipeEnabledL
       
   422 // queries whether swipe is enabled or not
       
   423 // -----------------------------------------------------------------------------
       
   424 //               
       
   425 EXPORT_C TBool TXnUiEnginePluginIf::SwipeEnabledL()
       
   426     {    
       
   427     return EFalse;    
       
   428     }
       
   429 
       
   430 // -----------------------------------------------------------------------------
       
   431 // TXnUiEnginePluginIf::DisableRenderUiLC
       
   432 // 
       
   433 // -----------------------------------------------------------------------------
       
   434 //               
       
   435 EXPORT_C void TXnUiEnginePluginIf::DisableRenderUiLC()
       
   436     {
       
   437     iUiEngine->DisableRenderUiLC();
       
   438     }
       
   439 
       
   440 // End of file
       
   441