emailcontacts/remotecontactlookup/engine/src/cpbkxrclsearchresultlistbox.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     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:  Definition of the class CPbkxRclSearchResultListBox.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include <AknsUtils.h>
       
    21 #include <eikclbd.h>
       
    22 
       
    23 #include "cpbkxrclsearchresultlistbox.h"
       
    24 
       
    25 ////////////////////////////////////////////////////////////////////////////
       
    26 // CPbkxRclSearchResultListBox
       
    27 ////////////////////////////////////////////////////////////////////////////
       
    28 
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CPbkxRclSearchResultListBox::CPbkxRclSearchResultListBox
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CPbkxRclSearchResultListBox::CPbkxRclSearchResultListBox() :
       
    37     CAknSingleStyleListBox()
       
    38     {
       
    39     FUNC_LOG;
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CPbkxRclSearchResultListBox::~CPbkxRclSearchResultListBox
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CPbkxRclSearchResultListBox::~CPbkxRclSearchResultListBox()
       
    47     {
       
    48     FUNC_LOG;
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CPbkxRclSearchResultListBox::CreateItemDrawerL
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CPbkxRclSearchResultListBox::CreateItemDrawerL()
       
    56     {
       
    57     FUNC_LOG;
       
    58     CColumnListBoxData* data = CColumnListBoxData::NewL();
       
    59     CleanupStack::PushL( data );
       
    60     iItemDrawer = new ( ELeave ) CPbkxRclSearchResultItemDrawer(
       
    61         Model(),
       
    62         iEikonEnv->NormalFont(),
       
    63         data );
       
    64     data->SetSkinEnabledL( ETrue );
       
    65     CleanupStack::Pop( data );
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CPbkxRclSearchResultListBox::MakeViewClassInstanceL
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CListBoxView* CPbkxRclSearchResultListBox::MakeViewClassInstanceL()
       
    73     {
       
    74     return ( new (ELeave) CPbkxRclSearchResultListView() );
       
    75     }
       
    76 
       
    77 ////////////////////////////////////////////////////////////////////////////
       
    78 // CPbkxRclSearchResultItemDrawer
       
    79 ////////////////////////////////////////////////////////////////////////////
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CPbkxRclSearchResultItemDrawer::CPbkxRclSearchResultItemDrawer
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CPbkxRclSearchResultItemDrawer::CPbkxRclSearchResultItemDrawer(
       
    87     MTextListBoxModel* aTextListBoxModel,
       
    88     const CFont* aFont,
       
    89     CColumnListBoxData* aColumnData ) :
       
    90     CColumnListBoxItemDrawer( aTextListBoxModel, aFont, aColumnData )
       
    91     {
       
    92     FUNC_LOG;
       
    93     }
       
    94     
       
    95 // ---------------------------------------------------------------------------
       
    96 // CPbkxRclSearchResultItemDrawer::~CPbkxRclSearchResultItemDrawer
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 CPbkxRclSearchResultItemDrawer::~CPbkxRclSearchResultItemDrawer()
       
   100     {
       
   101     FUNC_LOG;
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // CPbkxRclSearchResultItemDrawer::SetHighlightColor
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 void CPbkxRclSearchResultItemDrawer::SetHighlightColor( TRgb aColor )
       
   109     {
       
   110     FUNC_LOG;
       
   111     iHighlightColor = aColor;
       
   112     iColorsSet = iColorsSet | EHighlighColorSet;
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // CPbkxRclSearchResultItemDrawer::SetColor
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CPbkxRclSearchResultItemDrawer::SetColor( TRgb aColor )
       
   120     {
       
   121     FUNC_LOG;
       
   122     iColor = aColor;
       
   123     iColorsSet = iColorsSet | EColorSet;
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CPbkxRclSearchResultItemDrawer::ResetColors
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CPbkxRclSearchResultItemDrawer::ResetColors( TBool aHighlightColor )
       
   131     {
       
   132     FUNC_LOG;
       
   133     if ( aHighlightColor )
       
   134         {
       
   135         iColorsSet = iColorsSet & ( ~EHighlighColorSet );
       
   136         }
       
   137     else
       
   138         {
       
   139         iColorsSet = iColorsSet & ( ~EColorSet );
       
   140         }
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // CPbkxRclSearchResultItemDrawer::DrawItemText
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 void CPbkxRclSearchResultItemDrawer::DrawItemText(
       
   148     TInt aItemIndex,
       
   149     const TRect& aItemTextRect,
       
   150     TBool aItemIsCurrent,
       
   151     TBool aViewIsEmphasized,
       
   152     TBool aItemIsSelected ) const
       
   153     {
       
   154     FUNC_LOG;
       
   155 
       
   156     // force our own text colors to item drawer
       
   157     CPbkxRclSearchResultItemDrawer* ptr = 
       
   158         const_cast<CPbkxRclSearchResultItemDrawer*>( this );
       
   159     if ( iColorsSet & EColorSet )
       
   160         {
       
   161         ptr->iTextColor = iColor;
       
   162         }
       
   163     
       
   164     if ( iColorsSet & EHighlighColorSet )
       
   165         {
       
   166         ptr->iHighlightedTextColor = iHighlightColor;
       
   167         }        
       
   168 
       
   169     // Disable AVKON skinning so that our own color definitions apply
       
   170     TBool skinEnabled = AknsUtils::AvkonSkinEnabled();
       
   171     // Safe to ignore error
       
   172     TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( EFalse ) );
       
   173     CColumnListBoxItemDrawer::DrawItemText(
       
   174         aItemIndex,
       
   175         aItemTextRect,
       
   176         aItemIsCurrent,
       
   177         aViewIsEmphasized,
       
   178         aItemIsSelected );
       
   179     // Safe to ignore error
       
   180     TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( skinEnabled ) );
       
   181     }
       
   182 
       
   183 ////////////////////////////////////////////////////////////////////////////
       
   184 // CPbkxRclSearchResultListView
       
   185 ////////////////////////////////////////////////////////////////////////////
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // CPbkxRclSearchResultListView::DrawEmptyList
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 void CPbkxRclSearchResultListView::DrawEmptyList(const TRect &aClientRect) const
       
   192     {
       
   193     // Disable AVKON skinning so that our own color definitions apply
       
   194     TBool skinEnabled = AknsUtils::AvkonSkinEnabled();
       
   195     // Safe to ignore error
       
   196     TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( EFalse ) );
       
   197     CAknColumnListBoxView::DrawEmptyList( aClientRect );
       
   198     // Safe to ignore error
       
   199     TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( skinEnabled ) );
       
   200     }
       
   201