vtuis/videotelui/inc/commands/tvtuicmdvalidatorcallback.h
branchRCL_3
changeset 25 779871d1e4f4
parent 0 ed9695c8bcbe
equal deleted inserted replaced
24:f15ac8e65a02 25:779871d1e4f4
       
     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:  Command validator callback class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef T_VTUICMDVALIDATORCALLBACK_H
       
    20 #define T_VTUICMDVALIDATORCALLBACK_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 /**
       
    25  *  MVtUiCmdValidatorCallBack
       
    26  *
       
    27  *  Command validator callback API.
       
    28  *
       
    29  *  @since S60 v3.2
       
    30  */
       
    31 class MVtUiCmdValidatorCallBack
       
    32     {
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Invokes callback call.
       
    38      */
       
    39     virtual TBool Call( TInt ) const = 0;
       
    40 
       
    41     };
       
    42 
       
    43 /**
       
    44  *  TVtUiCmdValidatorCallBack
       
    45  *
       
    46  *  Validator callback wrapper to maintain type safety. Also allows use of
       
    47  *  different types of instances for invocation of callback.
       
    48  *
       
    49  *  @since S60 v3.2
       
    50  */
       
    51 template < class T >
       
    52 NONSHARABLE_CLASS( TVtUiCmdValidatorCallBack )
       
    53 : public MVtUiCmdValidatorCallBack
       
    54     {
       
    55 
       
    56     // Callback method type definition
       
    57     typedef TBool ( T::*TCallBackMethod )( TInt ) const;
       
    58 
       
    59 public:
       
    60 
       
    61     /**
       
    62      * Constructor
       
    63      *
       
    64      * @param aInstance Instance on which callback method will be called.
       
    65      * @param aMethod Callback method to be called.
       
    66      */
       
    67     TVtUiCmdValidatorCallBack( const T& aInstance, TCallBackMethod aMethod );
       
    68 
       
    69     /**
       
    70      * Executes callback.
       
    71      *
       
    72      * @param aParameter Callback parameter, e.g. command Id or resource Id.
       
    73      * @return Callback result.
       
    74      */
       
    75     TBool Call( TInt aParameter ) const;
       
    76 
       
    77 private:
       
    78 
       
    79     // Instance from which callback method will be invoke
       
    80     const T* iInstance;
       
    81 
       
    82     // Callback method pointer
       
    83     TCallBackMethod iMethod;
       
    84 
       
    85     };
       
    86 
       
    87 #include "tvtuicmdvalidatorcallback.inl"
       
    88 
       
    89 #endif // T_VTUICMDVALIDATORCALLBACK_H