mulwidgets/mulcoverflowwidget/src/mulcoverflowwidgetfactoryplugin.cpp
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     1 /*
       
     2 * Copyright (c) 2007-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:  factory plugin Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 //  Include Files
       
    19 
       
    20 #include "mulcoverflowwidgetfactoryplugin.h"
       
    21 #include "mulcoverflowwidget.h"
       
    22 
       
    23 namespace Alf
       
    24     {
       
    25 
       
    26 const TInt KCoverFlowWidgetFactoryPluginUid =
       
    27 	{
       
    28 			0x2000D241
       
    29 	};
       
    30 
       
    31 const int KProductCount = 1;
       
    32 
       
    33 static const char* const KWidget = "mulcoverflowwidget";
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // NewL
       
    37 // ---------------------------------------------------------------------------
       
    38 //    
       
    39 MulCoverFlowWidgetFactoryPlugin* MulCoverFlowWidgetFactoryPlugin::NewL()
       
    40     {
       
    41     return new(ELeave)MulCoverFlowWidgetFactoryPlugin;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // ~MulCoverFlowWidgetFactoryPlugin
       
    46 // ---------------------------------------------------------------------------
       
    47 //    
       
    48 MulCoverFlowWidgetFactoryPlugin::~MulCoverFlowWidgetFactoryPlugin()
       
    49     {   
       
    50     }
       
    51     
       
    52 // ---------------------------------------------------------------------------
       
    53 // createProduct
       
    54 // ---------------------------------------------------------------------------
       
    55 //    
       
    56 IAlfInterfaceBase* MulCoverFlowWidgetFactoryPlugin::createProduct(
       
    57     const char* aProduct,
       
    58     void* aInitData)
       
    59     {
       
    60     IAlfInterfaceBase* ret(0);
       
    61 
       
    62     //Creates the instance of the CoverFlow widget
       
    63     if(!strcmp(aProduct,KWidget))
       
    64         {
       
    65         AlfWidgetInitData* initData = reinterpret_cast<AlfWidgetInitData*>(aInitData);
       
    66         auto_ptr<MulCoverFlowWidget> Widget (new (EMM) MulCoverFlowWidget(*initData->mEnv,
       
    67         		initData->mWidgetId,*initData->mContainerWidget) );
       
    68         ret = Widget->makeInterface(IMulCoverFlowWidget::Type());    
       
    69         Widget.release();
       
    70         }
       
    71     return ret;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // makeInterface
       
    76 // ---------------------------------------------------------------------------
       
    77 //    
       
    78 IAlfInterfaceBase* MulCoverFlowWidgetFactoryPlugin::makeInterface(
       
    79         const IfId& aType)
       
    80     {    
       
    81     if( UString(aType.mImplementationId) == UString(IAlfFactoryPlugin::type().mImplementationId) )
       
    82         {
       
    83         return static_cast<IAlfFactoryPlugin*>(this);            
       
    84         }
       
    85     return NULL;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // productCount
       
    90 // ---------------------------------------------------------------------------
       
    91 //        
       
    92 int MulCoverFlowWidgetFactoryPlugin::productCount()const
       
    93     {
       
    94     return KProductCount;    
       
    95     }
       
    96  
       
    97 // ---------------------------------------------------------------------------
       
    98 // productInfo
       
    99 // ---------------------------------------------------------------------------
       
   100 //        
       
   101 const char* MulCoverFlowWidgetFactoryPlugin::productInfo(int aIndex)const
       
   102     {
       
   103     /// @bug minor:avanhata:3/7/2008 good old if would be clearer
       
   104     /// (Surely it is a caller error to call this function with aIndex >= productCount()
       
   105     /// anyway, so can simply assert)
       
   106     switch(aIndex)
       
   107         {
       
   108 		case 0:
       
   109 			return KWidget;
       
   110 
       
   111 		default:
       
   112 			break;
       
   113         }
       
   114     
       
   115     return 0;
       
   116     }
       
   117     
       
   118     }  //namespace Alf         
       
   119 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   120 
       
   121 using namespace Alf;
       
   122 
       
   123 const TImplementationProxy
       
   124 		ImplementationTable[] =
       
   125     {
       
   126 	#ifdef __EABI__ 
       
   127     
       
   128     IMPLEMENTATION_PROXY_ENTRY(KCoverFlowWidgetFactoryPluginUid, MulCoverFlowWidgetFactoryPlugin::NewL)
       
   129     
       
   130     #else
       
   131 	
       
   132 	{ {KCoverFlowWidgetFactoryPluginUid},MulCoverFlowWidgetFactoryPlugin::NewL }
       
   133 	
       
   134 	#endif
       
   135     };
       
   136 
       
   137 OSN_EXPORT const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   138     {
       
   139     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   140 
       
   141     return ImplementationTable;
       
   142     }
       
   143     
       
   144 //End of File