uiaccelerator_plat/alf_visual_api/inc/alf/alfpropertyowner.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:   Property object for Alfred
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFPROPERTYOWNER_H
       
    21 #define C_ALFPROPERTYOWNER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "alf/alfproperty.h"
       
    26 
       
    27 // Property extension UIDs
       
    28 
       
    29 static const TUid KUidAlfPropOwnerExtControlFocusChainChanged = {0x200110DA};
       
    30 
       
    31 
       
    32 /**
       
    33  *  Value property object base class
       
    34  *
       
    35  *  Manages a list of properties.
       
    36  *  The current policy is that properties must always return a valid pointer, never NULL.
       
    37  * @todo more
       
    38  *
       
    39  */
       
    40 class CAlfPropertyOwner: public CBase
       
    41     {
       
    42     public:
       
    43     /* Constructor and destructor. */
       
    44     IMPORT_C CAlfPropertyOwner();
       
    45     
       
    46     IMPORT_C ~CAlfPropertyOwner();    
       
    47 
       
    48     /**
       
    49      * Remove the property by name, if it exists.
       
    50      *
       
    51      * @param aName the name of the property to remove.
       
    52      * @return ETrue if found.
       
    53      */        
       
    54     IMPORT_C TBool PropertyRemove(const TDesC8& aName);
       
    55     
       
    56     /**
       
    57      * Remove all properties.
       
    58      */            
       
    59     IMPORT_C void PropertyClear();
       
    60 
       
    61 
       
    62     // We have a different registration method for each property type, eg value, string, timedvalue.
       
    63 
       
    64     /**
       
    65      * Set a value property.
       
    66      * This will set a property of type integer. If the property is already set,
       
    67      * it will update the property's value. If not, it will create a new property.
       
    68      * Can be overridden to provide custom handling of properties.
       
    69      *
       
    70      * @param aName the name of the property to set.
       
    71      * @param aVal The value of the property.
       
    72      * @return EFalse if value was set as a different type already, or zero-length name supplied.
       
    73      *         The property was not set.
       
    74      */    
       
    75     IMPORT_C TBool PropertySetIntegerL(const TDesC8& aName, TInt aVal, TInt aMin = INT_MIN, TInt aMax = INT_MAX);
       
    76     
       
    77     /**
       
    78      * Find the property by name.
       
    79      * Can be overridden to provide custom handling of properties.     
       
    80      *
       
    81      * @param aName the name of the property to find.
       
    82      * @param aRet Return parameter for the found value, or NULL if no value required.
       
    83      * @return ETrue if found.
       
    84      */    
       
    85     IMPORT_C TBool PropertyFindInteger(const TDesC8& aName, TInt* aRet = NULL) const;
       
    86 
       
    87     /**
       
    88      * Set a string property.
       
    89      * This will set a property of type string. If the property is already set,
       
    90      * it will update the property's value. If not, it will create a new property.
       
    91      * Can be overridden to provide custom handling of properties.
       
    92      *
       
    93      * @param aName the name of the property to set.
       
    94      * @param aVal The value of the property.
       
    95      * @return EFalse if value was set as a different type already, or zero-length name supplied.
       
    96      *         The property was not set.
       
    97      */    
       
    98     IMPORT_C TBool PropertySetStringL(const TDesC8& aName, const TDesC& aVal);
       
    99     
       
   100     /**
       
   101      * Find the property by name.
       
   102      * Can be overridden to provide custom handling of properties.     
       
   103      *
       
   104      * @param aName the name of the property to find.
       
   105      * @param aRet Return parameter for the found value, or NULL if no value required.
       
   106      * @return ETrue if found.
       
   107      */    
       
   108     IMPORT_C TBool PropertyFindString(const TDesC8& aName, TDesC** aRet = NULL) const;
       
   109 
       
   110     /**
       
   111     * Copies named property from another object
       
   112     * 
       
   113     * @param aOwner        Object which has the property to be copied
       
   114     * @param aPropertyName The name of a property
       
   115     *
       
   116     * @return System wide error codes
       
   117     */
       
   118     IMPORT_C TInt CopyProperty(const CAlfPropertyOwner& aOwner, const TDesC8& aPropertyName);
       
   119     
       
   120     private:
       
   121     
       
   122     /**
       
   123      * Find a generic property object.
       
   124      *
       
   125      * @param aName the name of the property to find.     
       
   126      * @param aIndex Return parameter for index found.
       
   127      * @param aType Return parameter for type found.     
       
   128      * @return ETrue if found.
       
   129      */
       
   130     TBool Find(const TDesC8& aName, TInt* aIndex = NULL, TAlfPropertyType* aType = NULL) const;
       
   131     
       
   132     /**
       
   133      * Find a property object of given type.
       
   134      *
       
   135      * Does type checking to ensure that we got the expected property type.
       
   136      *
       
   137      * @param aName the name of the property to find.     
       
   138      * @param aIndex Return parameter for index found.
       
   139      * @param aRequiredType Type that is expected
       
   140      * @return ETrue if found and correct type, EFalse if not found or wrong type.
       
   141      */    
       
   142     TBool FindOfType(const TDesC8& aName, TInt* aIndex, TAlfPropertyType aRequiredType) const;
       
   143     
       
   144     /**
       
   145     * !Internal util: Find complete ranged value.
       
   146     */
       
   147     TBool PropertyFindInteger(const TDesC8& aName, TRangedValue& aValue) const;
       
   148 
       
   149 protected: // new methods    
       
   150     
       
   151     IMPORT_C virtual void PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
       
   152 
       
   153 private: // data
       
   154     
       
   155     RPointerArray<CAlfProperty> iProperties;
       
   156     
       
   157     TAny* iSpare;
       
   158     };
       
   159 
       
   160 #endif // C_ALFPROPERTYOBJECT_H
       
   161