idlehomescreen/xmluirendering/renderingplugins/xnmenufactory/src/xnmenufactory.cpp
changeset 0 f72a12da539e
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 factory creating container for a menu
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <coecntrl.h>
       
    21 #include <barsread.h>
       
    22 
       
    23 #include "xnmenuadapter.h"
       
    24 #include "xnmenufactory.h"
       
    25 #include "xnmenu.h"
       
    26 
       
    27 #include "xntype.h"
       
    28 #include "xncomponent.h"
       
    29 #include "xnnodepluginif.h"
       
    30 #include <aisystemuids.hrh>
       
    31 #include "xndomnode.h"
       
    32 
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 MXnComponentFactory::TXnComponentFactoryResponse CXnMenuFactory::MakeXnComponentL( 
       
    37                                         CXnNodePluginIf& aNode,
       
    38                                         CXnComponent*& aTargetComponent
       
    39         										
       
    40 										)
       
    41     {
       
    42     MXnComponentFactory::TXnComponentFactoryResponse retVal = 
       
    43         MXnComponentFactory::EXnFactoryResponseComponentNotSupported;
       
    44     // Check that the given type of a control is parent (or ancestor) of this control
       
    45     if(aNode.Type()->Type() == KXnMenuBar)
       
    46         {
       
    47     	  CXnMenu* container = CXnMenu::NewL();
       
    48         aTargetComponent = static_cast<CXnComponent*>(container);
       
    49    	    retVal = MXnComponentFactory::EXnFactoryResponseComponentConstructed;
       
    50   	    return retVal;
       
    51 	    }
       
    52     return retVal;
       
    53     }
       
    54 
       
    55 CXnControlAdapter* CXnMenuFactory::MakeXnControlAdapterL( 
       
    56                                         CXnNodePluginIf& aNode,
       
    57                                         CXnControlAdapter* aParent
       
    58 										)
       
    59     {
       
    60     CXnControlAdapter* controlAdapter = CXnMenuAdapter::NewL( aParent, aNode );
       
    61     return controlAdapter;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CXnMenuFactory::NewL
       
    66 // Two-phased constructor.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CXnMenuFactory* CXnMenuFactory::NewL()
       
    70     {
       
    71     CXnMenuFactory* self = new( ELeave ) CXnMenuFactory;
       
    72     
       
    73     CleanupStack::PushL( self );
       
    74     self->ConstructL();
       
    75     CleanupStack::Pop();
       
    76 
       
    77     return self;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CXnMenuFactory::CXnMenuFactory
       
    82 // C++ default constructor can NOT contain any code, that
       
    83 // might leave.
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 CXnMenuFactory::CXnMenuFactory()
       
    87     {
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CXnMenuFactory::~CXnMenuFactory
       
    92 // Destructor.
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 CXnMenuFactory::~CXnMenuFactory()
       
    96     {
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CXnMenuFactory::ConstructL
       
   101 // Symbian 2nd phase constructor can leave.
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 void CXnMenuFactory::ConstructL()
       
   105     {
       
   106     }
       
   107 
       
   108 
       
   109 // Define the interface UIDs
       
   110 const TImplementationProxy ImplementationTable[] =
       
   111     {
       
   112 #ifdef __EABI__ 
       
   113 	IMPLEMENTATION_PROXY_ENTRY(AI3_UID_RENDERING_PLUGIN_MENUFACTORY_IMPLEMENTATION, CXnMenuFactory::NewL) 
       
   114 #else
       
   115     {{AI3_UID_RENDERING_PLUGIN_MENUFACTORY_IMPLEMENTATION}, CXnMenuFactory::NewL}
       
   116 #endif
       
   117     };
       
   118 
       
   119 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   120     {
       
   121     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   122 
       
   123     return ImplementationTable;
       
   124     }