menufw/hierarchynavigator/hnpresentationmodel/inc/hnattributebase.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:   abstract base class for attribute models
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_HNATTRIBUTEBASE_H
       
    20 #define C_HNATTRIBUTEBASE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "hniconholder.h"
       
    24 
       
    25 class CGulIcon;
       
    26 
       
    27 /** 
       
    28  * Attribute type. Indicates the text or image attribute. 
       
    29  */
       
    30 enum TAttributeType 
       
    31     {
       
    32     ETextAttribute,
       
    33     EImageAttribute
       
    34     };
       
    35 
       
    36 /**
       
    37  * Attribute base (abstract) class.
       
    38  * 
       
    39  * Base class for attributes providing common functionality 
       
    40  * and defining required abstract methods for the interface.
       
    41  * Attributes are used to logically mediate visual properties, 
       
    42  * such as icons, texts, templates, etc., from the xml to the 
       
    43  * presentation layer. Atributes are used eg., to retrieve content 
       
    44  * of such visual items in the widget library (mmwidgets), 
       
    45  * for display purposes. 
       
    46  *
       
    47  * @lib hnpresentationmodel
       
    48  * @since S60 5.0
       
    49  * @ingroup group_hnpresentationmodel
       
    50  */
       
    51 NONSHARABLE_CLASS( CHnAttributeBase ) : public CBase
       
    52      {
       
    53 public:
       
    54     
       
    55     /**
       
    56      * Standard destructor.
       
    57      * 
       
    58      * @since S60 5.0
       
    59      */
       
    60     ~CHnAttributeBase();
       
    61     
       
    62     /**
       
    63      * Sets the attribute name.
       
    64      *
       
    65      * @since S60 5.0
       
    66      * @param aName Name of the attribute
       
    67      */
       
    68     IMPORT_C void SetNameL( const TDesC8& aName );
       
    69 
       
    70     /**
       
    71      * Gets the name of the attribute.
       
    72      *
       
    73      * @since S60 5.0
       
    74      * @return Attribute name.
       
    75      */
       
    76     IMPORT_C const TDesC8& Name() const;
       
    77 
       
    78     /**
       
    79      * Gets the value of the attribute.
       
    80      *
       
    81      * @since S60 5.0
       
    82      * @return Attribute's value.
       
    83      */
       
    84     IMPORT_C virtual const TDesC8& Value();
       
    85     
       
    86     /**
       
    87      * Gets icon, packed in CGulIcon.
       
    88      * 
       
    89      * @see CGulIcon
       
    90      * @since S60 5.0
       
    91      * @return Icon as a poitner to CGulIcon.
       
    92      */
       
    93     IMPORT_C virtual CGulIcon* GetIcon( TSize* aDesiredIconSize 
       
    94             = NULL );
       
    95     
       
    96     /**
       
    97      * Gets icon holder, which owns the same icon that GetIcon returns.
       
    98      * 
       
    99      * Icon holder should be used when the icon from model needs to
       
   100      * be stored. Please see @c CHnIconHolder description for more
       
   101      * details on how to store icons.
       
   102      * 
       
   103      * @param aDesiredIconSize Desired size of the icon contained in
       
   104      *                         the returned icon holder.
       
   105      * @return An icon holder. You can call GetGulIcon on it to get the
       
   106      *         actual icon (may return NULL).
       
   107      */
       
   108     virtual CHnIconHolder* GetIconHolder( TSize* aDesiredIconSize );
       
   109     
       
   110     /**
       
   111      * Gets attributes's type.
       
   112      * 
       
   113      * @since S60 5.0
       
   114      * @return Attribute's type.
       
   115      */    
       
   116     IMPORT_C TAttributeType Type();
       
   117     
       
   118     /**
       
   119      * Removes all  LIW objects owned by this object.
       
   120      * 
       
   121      * LIW objects owned by non-LIW objects that are owned by
       
   122      * this object are also removed.
       
   123      * @since S60 5.0
       
   124      */
       
   125     virtual void RemoveLiwObjects();
       
   126 
       
   127 protected: // data
       
   128     
       
   129     /**
       
   130      * Attribute type.
       
   131      */
       
   132     TAttributeType iAttributeType;
       
   133     
       
   134 private: // data
       
   135 
       
   136     /**
       
   137      * Attribute name. 
       
   138      */
       
   139     RBuf8 iName;
       
   140     
       
   141     };
       
   142 
       
   143 #endif // C_HNATTRIBUTEBASE_H
       
   144