locationsystemui/locationsysui/locutils/src/loctextutils.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2002 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 requestor utilities.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "loctextutils.h"
       
    21 #include <AknLayoutDef.h>
       
    22 #include <AknLayout.lag>
       
    23 #include <eikfrlbd.h>
       
    24 
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // LocTextUtils::ClipToFit
       
    30 // (other items were commented in a header).
       
    31 // ---------------------------------------------------------------------------
       
    32 //      
       
    33 EXPORT_C TBool LocTextUtils::ClipToFit(
       
    34     TDes& aText,
       
    35     AknTextUtils::TClipDirection aClipDirection,
       
    36     CEikFormattedCellListBox* aListBox,
       
    37     TInt aItemIndex,
       
    38     TInt aSubCellNumber,
       
    39     TInt aIcons )
       
    40     {
       
    41     if (aIcons == 0)
       
    42     	{
       
    43     	// There is no Icon so just use the AknTextUtils API
       
    44    		return AknTextUtils::ClipToFit( aText, aClipDirection, 
       
    45    										aListBox, aItemIndex, 
       
    46    										aSubCellNumber );
       
    47     	}
       
    48     CFormattedCellListBoxData *data = 
       
    49         aListBox->ItemDrawer()->FormattedCellData();
       
    50     const CFont *font = data->Font( aListBox->ItemDrawer()->Properties( 
       
    51                                             aItemIndex ), aSubCellNumber );
       
    52 	
       
    53 	// Obtain the layout parameters for this element from the Avkon Layout
       
    54 
       
    55     TAknLayoutText textLayout;
       
    56     textLayout.LayoutText(aListBox->Rect() , 
       
    57 		AKN_LAYOUT_TEXT_List_pane_texts__menu_single__Line_1(aIcons));
       
    58      
       
    59 	TRect rect = textLayout.TextRect();
       
    60     TInt width = rect.Width();
       
    61 
       
    62     TInt clipgap = data->SubCellTextClipGap( aSubCellNumber );
       
    63 
       
    64 	return AknTextUtils::ClipToFit( aText, *font, width,
       
    65                                   aClipDirection, width + clipgap );
       
    66     }
       
    67 
       
    68 //  End of File