mmuifw_plat/alf_widgetmodel_api/inc/alf/ialfmodel.h
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     1 /*
       
     2 * Copyright (c) 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:  This interface defines a generic data type
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef I_ALFMODEL_H
       
    22 #define I_ALFMODEL_H
       
    23 
       
    24 
       
    25 //INCLUDES
       
    26 #include <alf/ialfinterfacebase.h>
       
    27 #include <alf/alftypes.h>
       
    28 
       
    29 namespace osncore
       
    30     {
       
    31 template <class T> class AlfPtrVector;
       
    32     }
       
    33 using namespace osncore;
       
    34 
       
    35 namespace Alf
       
    36     {
       
    37 
       
    38 /* Forward declarations*/
       
    39 class IAlfModelChangeObserver;
       
    40 class IAlfVariantType;
       
    41 class AlfModelOperation;
       
    42 class AlfCustomInitDataBase;
       
    43 
       
    44 
       
    45 namespace alfmodel
       
    46     {
       
    47 static const IfId ident=
       
    48     {
       
    49     0,"alfmodel"
       
    50     };
       
    51     }
       
    52 
       
    53 /**
       
    54  * An interface of the component model.
       
    55  * @lib alfwidgetmodel.lib
       
    56  * @since S60 ?S60_version
       
    57  * @status Draft
       
    58  */
       
    59 
       
    60 class IAlfModel: public IAlfInterfaceBase
       
    61     {
       
    62 public:
       
    63     static inline const IfId& type()
       
    64         {
       
    65         return alfmodel::ident;
       
    66         }
       
    67         
       
    68     /**
       
    69      * Virtual destructor.
       
    70      *
       
    71      * @since S60 ?S60_version
       
    72      */
       
    73     virtual ~IAlfModel() {}
       
    74 
       
    75     /**
       
    76      * Add a new observer to be notified of any changes in the model.
       
    77      *
       
    78      * @exception std::bad_alloc
       
    79      *
       
    80      * @param aObserver The model change observer to be added.
       
    81      * @return void
       
    82      * @since S60 ?S60_version
       
    83      */
       
    84     virtual void addModelChangeObserver(
       
    85                 IAlfModelChangeObserver& aObserver ) = 0;
       
    86 
       
    87 
       
    88     /**
       
    89      * Remove an observer which is added to get notifications.
       
    90      *
       
    91      * @param aObserver The model change observer to be removed.
       
    92      * @return void
       
    93      * @since S60 ?S60_version
       
    94      */
       
    95     virtual void removeModelChangeObserver(
       
    96                 IAlfModelChangeObserver& aObserver )=0;
       
    97 
       
    98     /**
       
    99      * Api to change the model completely at one short. From IAlfModel
       
   100      *
       
   101      * @param aData  The new data.
       
   102      * @since S60 ?S60_version
       
   103      */
       
   104     virtual void setData( IAlfVariantType* aData ) = 0;
       
   105 
       
   106     /**
       
   107      * Change a given  of data fields in the model . All model change
       
   108      * observers are notified about the change.
       
   109      * @param aNumContainerIndices The number of indices in aContainerIndices.
       
   110      * @param aContainerIndices The container indices to find the correct
       
   111      *            location in the data hierarchy. The ownership is transferred.
       
   112      * @param aData - The new data to be set
       
   113      * @since S60 ?S60_version
       
   114      */
       
   115     virtual void updateData(
       
   116                 int aNumContainerIndices,int* aContainerIndices,
       
   117                 IAlfVariantType* aData ) = 0;
       
   118 
       
   119     /**
       
   120      * Add a  number of data fields in the model data. All model change
       
   121      * observers are notified about the change.
       
   122      *
       
   123      * @param aNumContainerIndices The number of indices in aContainerIndices.
       
   124      * @param aContainerIndices The container indices to find the correct
       
   125      *            location in the data hierarchy. The ownership is transferred.
       
   126      * @param aData The new data.
       
   127      * @since S60 ?S60_version
       
   128      */
       
   129     virtual void addData(
       
   130                 int aNumContainerIndices,int* aContainerIndices,
       
   131                 IAlfVariantType* aData ) = 0;
       
   132 
       
   133     /**
       
   134      * Remove a  number of data fields in the model data. All model change
       
   135      * observers are notified about the change.
       
   136      *
       
   137      * @param aNumContainerIndices The number of indices in aContainerIndices.
       
   138      * @param aContainerIndices The container indices to find the correct
       
   139      *            location in the data hierarchy. The ownership is transferred.
       
   140      * @since S60 ?S60_version
       
   141      */
       
   142     virtual void removeData(
       
   143             int aNumContainerIndices,
       
   144             int* aContainerIndices ) = 0;
       
   145 
       
   146     /**
       
   147      * Api for executing batch operations
       
   148      *
       
   149      * @param aOperationsArray  - An RPOinterArray containing the list of 
       
   150      *            operations to be executed in batch.
       
   151      * @since S60 ?S60_version
       
   152      */
       
   153     virtual void executeOperations(
       
   154                 AlfPtrVector<AlfModelOperation>&  aOperationsArray) = 0;
       
   155 
       
   156     /**
       
   157      * Api for executing one operation at a Time
       
   158      *
       
   159      * @param aOperation    - An Operation to be executed on the model.
       
   160      * @since S60 ?S60_version
       
   161      */
       
   162     virtual void executeOperation(AlfModelOperation* aOperation) = 0;
       
   163 
       
   164     /**
       
   165      * Clears the Model.
       
   166      * @return void
       
   167      * @since S60 ?S60_version
       
   168      */
       
   169     virtual void clearModel() = 0;
       
   170     /**
       
   171      * Get the root data object of this model.
       
   172      *
       
   173      * @return The root data object.
       
   174      * @since S60 ?S60_version
       
   175      */
       
   176     virtual IAlfVariantType* data() const = 0;
       
   177 
       
   178     };
       
   179 
       
   180 /**
       
   181  *  Placeholder for information required to instantiate a model
       
   182  *  via the widget factory mechanism.
       
   183  *  A pointer to this structure is casted to a void pointer and sent to the
       
   184  *  factory plugin.
       
   185  *  @lib alfwidgetmodel.lib
       
   186  *  @since S60 ?S60_version
       
   187  */
       
   188 struct AlfModelInitData
       
   189     {
       
   190     /**
       
   191      * Pointer to custom data passed via factory mechanism
       
   192      * Not Owned.
       
   193      */
       
   194     AlfCustomInitDataBase* mCustomData;  
       
   195     };
       
   196     
       
   197     } // namespace Alf
       
   198 
       
   199 #endif // I_ALFMODEL_H
       
   200 
       
   201 // End of File