emailuis/uicomponents/fsscrollbarplugin/src/fsscrollbarfactory.cpp
changeset 0 8466d47a6819
child 4 e7aa27f58ae1
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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: Implements class TFsScrollBarFactory
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "emailtrace.h"
       
    21 #include <implementationproxy.h>
       
    22 //<cmail> SF
       
    23 #include <alf/alfconstants.h>
       
    24 #include <alf/alflayouthandlers.h>
       
    25 //</cmail>
       
    26 #include "fsscrollbarfactory.h"
       
    27 #include "fsscrollbarlayouthandler.h"
       
    28 #include "fsscrollbarpluginconstants.h"
       
    29 
       
    30 
       
    31 // ======== LOCAL FUNCTIONS ========
       
    32 
       
    33 MAlfExtensionFactory* Instance()
       
    34 	{
       
    35     FUNC_LOG;
       
    36 	TFsScrollbarFactory* me = NULL;
       
    37 	me = new TFsScrollbarFactory;
       
    38 	return me;
       
    39 	}
       
    40 
       
    41 
       
    42 const TImplementationProxy ImplementationTable[] =
       
    43 	{
       
    44 	//<cmail>
       
    45     IMPLEMENTATION_PROXY_ENTRY( KFsScrollbarImplementationId,
       
    46 	                            Instance )
       
    47     //</cmail>	                            
       
    48 	};
       
    49 
       
    50 
       
    51 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
       
    52     TInt& aTableCount )
       
    53 	{
       
    54 	aTableCount = sizeof( ImplementationTable )
       
    55         / sizeof( TImplementationProxy ) ;
       
    56 	return ImplementationTable;
       
    57 	}
       
    58 
       
    59 
       
    60 // ======== MEMBER FUNCTIONS ========
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // From class MAlfExtensionFactory.
       
    64 // Creates new instace of required type (unique for factory) Must not take
       
    65 // ownership of created object.
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 MAlfExtension* TFsScrollbarFactory::CreateExtensionL(
       
    69     const TInt aObjectId,
       
    70     const TDesC8& aInitialParams,
       
    71     MAlfInterfaceProvider& aResolver )
       
    72     {
       
    73     FUNC_LOG;
       
    74     MAlfExtension* result( NULL );
       
    75     switch ( aObjectId )
       
    76         {
       
    77         case EFsScrollbarCreateScreenLayout:
       
    78             {
       
    79             TInt2* params = ( TInt2* )aInitialParams.Ptr();
       
    80 
       
    81             CHuiControl* owner( NULL );
       
    82             CHuiLayout* parentLayout( NULL );
       
    83 
       
    84             if ( !params->iInt1 )
       
    85                 {
       
    86                 User::Leave( KErrArgument );
       
    87                 }
       
    88             else
       
    89                 {
       
    90                 // currently we must use concrete owner as interface does not
       
    91                 // provide means to transfer ownership
       
    92                 owner = ( CHuiControl* )aResolver.GetInterfaceL(
       
    93                     EHuiObjectTypeControl, params->iInt1 );
       
    94                 }
       
    95 
       
    96             if (params->iInt2) // not compulsory
       
    97                 {
       
    98                 parentLayout = ( CHuiLayout* )aResolver.GetInterfaceL(
       
    99                     EHuiObjectTypeLayout, params->iInt2 );
       
   100                 }
       
   101 
       
   102             result = CFsScrollbarLayoutHandler::NewL(
       
   103                 aResolver, owner, parentLayout );
       
   104             break;
       
   105             }
       
   106 
       
   107         default:
       
   108             User::Leave( KErrNotSupported );
       
   109         }
       
   110     return result;
       
   111     }
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // From class MAlfExtensionFactory.
       
   116 // Free resources for instance, usually delete this
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void TFsScrollbarFactory::Release()
       
   120     {
       
   121     FUNC_LOG;
       
   122     delete this;
       
   123     }
       
   124