mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfinterfacebase.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     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:  The base class for interfaces provided by widget classes.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef I_ALFINTERFACEBASE_H
       
    20 #define I_ALFINTERFACEBASE_H
       
    21 
       
    22 
       
    23 
       
    24 namespace Alf
       
    25     {
       
    26 
       
    27 struct IfId;
       
    28 /**
       
    29  *  The base class for interfaces provided by
       
    30  *  widget classes, including CAlfWidget, CAlfModel,
       
    31  *  CAlfWidgetControl, MAlfWidgetEventHandler,
       
    32  *  MAlfElement and derived classes.
       
    33  *
       
    34  *  @lib alfwidgetmodel.lib
       
    35  *  @since S60 ?S60_version
       
    36  *  @status Draft
       
    37  */
       
    38 class IAlfInterfaceBase
       
    39     {
       
    40 public:
       
    41     /**
       
    42      * Default virtual destructor.
       
    43      */
       
    44     virtual ~IAlfInterfaceBase() {}
       
    45 
       
    46     /**
       
    47      * Interface getter with casting.
       
    48      *
       
    49      * @since S60 ?S60_version
       
    50      * @param aType The type id of the queried interface.
       
    51      * @return The queried interface, or NULL if the interface is not
       
    52      *         supported or available.
       
    53      */
       
    54     template <class T>
       
    55     static T* makeInterface(IAlfInterfaceBase* aBase)
       
    56         {
       
    57         return (aBase? static_cast<T*>(aBase->makeInterface(T::type())): 0);
       
    58         }
       
    59 
       
    60 
       
    61     /**
       
    62      * Interface getter.
       
    63      * Derived classes should always call the base class method
       
    64      * from the overridden MakeInterface.
       
    65      *
       
    66      * @since S60 ?S60_version
       
    67      * @param aType The type id of the queried interface.
       
    68      * @return The queried interface, or NULL if the interface is not
       
    69      *         supported or available.
       
    70      */
       
    71     virtual IAlfInterfaceBase* makeInterface( const IfId& aType ) = 0;
       
    72 
       
    73 
       
    74     };
       
    75 
       
    76     }
       
    77 
       
    78 #endif // I_ALFINTERFACEBASE_H
       
    79 
       
    80 // End of File