emailuis/uicomponents/src/fstreerichitemdata.cpp
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Tree item data derived class able to store rich text.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "emailtrace.h"
       
    21 #include <txtrich.h>
       
    22 #include <eikenv.h>
       
    23 // <cmail> SF
       
    24 #include <alf/alftexture.h>
       
    25 // </cmail>
       
    26 #include "fstreerichitemdata.h"
       
    27 #include "fsrichtext.h"
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // C++ constructor.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CFsTreeRichItemData::CFsTreeRichItemData( CFsRichText* aText )
       
    36     : iFsRichText( aText )
       
    37     {
       
    38     FUNC_LOG;
       
    39     }
       
    40 
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // 2nd phase constructor.
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 void CFsTreeRichItemData::ConstructL()
       
    47     {
       
    48     FUNC_LOG;
       
    49     }
       
    50 
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // Two-phase constructor.
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CFsTreeRichItemData* CFsTreeRichItemData::NewL( CFsRichText* aText )
       
    57     {
       
    58     FUNC_LOG;
       
    59     CFsTreeRichItemData* self = new( ELeave ) CFsTreeRichItemData( aText );
       
    60     CleanupStack::PushL(self);
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop(self);
       
    63     return self;
       
    64     }
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Set the FsRichText object. Ownership of this object is gained.
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CFsTreeRichItemData::~CFsTreeRichItemData()
       
    72     {
       
    73     FUNC_LOG;
       
    74     delete iFsRichText;
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // Set the FsRichText object. Ownership of this object is gained.
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void CFsTreeRichItemData::SetText( CFsRichText* aText )
       
    83     {
       
    84     FUNC_LOG;
       
    85     delete iFsRichText;
       
    86     iFsRichText = aText;
       
    87     }
       
    88 
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // Return the FsRichText object.
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C const CFsRichText& CFsTreeRichItemData::Text() const
       
    95     {
       
    96     FUNC_LOG;
       
    97     return *iFsRichText;
       
    98     }
       
    99 
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // Determines if an icon is set.
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 TBool CFsTreeRichItemData::IsIconSet() const
       
   106     {
       
   107     FUNC_LOG;
       
   108     return iIcon ? ETrue : EFalse;
       
   109     }
       
   110 
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // Get the current icon in use.
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 const CAlfTexture& CFsTreeRichItemData::Icon() const
       
   117     {
       
   118     FUNC_LOG;
       
   119     return *iIcon;
       
   120     }
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // Specify an icon to use.
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 void CFsTreeRichItemData::SetIcon(CAlfTexture& aIcon)
       
   128     {
       
   129     FUNC_LOG;
       
   130     iIcon = &aIcon;
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // From class MFsTreeItemData.
       
   136 // Type of the data item.
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 TFsTreeItemDataType CFsTreeRichItemData::Type() const
       
   140     {
       
   141     FUNC_LOG;
       
   142     return KFsTreeRichItemDataType;
       
   143     }
       
   144