epoc32/include/mw/AknUtils.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/AknUtils.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,2727 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*     General Avkon Utilities. Includes:
    1.19 +*       - listbox utilities
    1.20 +*       - layout utilities
    1.21 +* 
    1.22 +*
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +#ifndef __AKNUTILS_H__
    1.27 +#define __AKNUTILS_H__
    1.28 +
    1.29 +#include <eiktxlbm.h>
    1.30 +#include <avkon.hrh>
    1.31 +#include <avkon.rsg>
    1.32 +#include <coedef.h>
    1.33 +#include <coecobs.h>
    1.34 +#include <w32std.h>
    1.35 +#include <gulalign.h>
    1.36 +#include <gulutil.h>
    1.37 +#include <eikenv.h>
    1.38 +#include <biditext.h>
    1.39 +#include <eiksbfrm.h>
    1.40 +#include <AknsConstants.h>
    1.41 +#include <aknenv.h>
    1.42 +#include <AknLayout.lag>
    1.43 +
    1.44 +// These are for listbox column lengths (These are used to allocate memory from stack while drawing listboxes, they should be as small as possible, but not smaller!)
    1.45 +const TInt KMaxColumnDataLength = 80; // This is maximum length of data for one listbox column -- after that the data is truncated before drawing.
    1.46 +const TInt KMaxTotalDataLength = 8*KMaxColumnDataLength;  // max of 5 columns can have full 80 characters...
    1.47 +
    1.48 +/** AVKON utility module
    1.49 + *
    1.50 + * From this file, you can find several tools for making application development easier for S60
    1.51 + *
    1.52 + * 1) Conversion modules to convert coordinate data from european LAF to usable formats
    1.53 + *     AknLayoutUtils, TAknLayoutRect, TAknLayoutText
    1.54 + * 2) Utilities to clip text
    1.55 + * 3) Part of selection service implementation
    1.56 + * 4) Different classes that help using listboxes
    1.57 + * 5) Handling colors in AKN_LAF_COLOR macro.
    1.58 + * 6) Resource readers for different purposes
    1.59 + * 7) Utility to find files without specifying the drive letter or path
    1.60 + */
    1.61 +
    1.62 +
    1.63 +class CCoeControl;
    1.64 +class CEikTextListBox;
    1.65 +class CEikColumnListBox;
    1.66 +class CEikFormattedCellListBox;
    1.67 +class CGulIcon;
    1.68 +class CEikSettingsListBox;
    1.69 +class CAknLAF;
    1.70 +class CEikImage;
    1.71 +class CEikMfne;
    1.72 +class CEikListBox;
    1.73 +class CEikLabel;
    1.74 +class CEikEdwin;
    1.75 +class CEikMenuPane;
    1.76 +class CAknPopupField;
    1.77 +class CListBoxView;
    1.78 +class CAknColumnListBox;
    1.79 +class CEikSecretEditor;
    1.80 +class CFindExtension;
    1.81 +class CAknLayoutFont;
    1.82 +class TAknFontSpecification;
    1.83 +class CAknAppUiBase;
    1.84 +class TAknWindowLineLayout;
    1.85 +class TAknMultiLineTextLayout;
    1.86 +class TAknTextLineLayout;
    1.87 +
    1.88 +/**
    1.89 + * Egul library had methods to clip text from right side, this class includes methods to clip from both sides.
    1.90 + * It does add 3 dots to the end of the text.
    1.91 + */
    1.92 +const TInt  KDefaultClipWidth = -1;
    1.93 +const TUint KDefaultClipChar  = TUint(0x2026);
    1.94 +
    1.95 +// Constant to use in AknLayoutUtils to indicate that the parameter is not to be used as a override value
    1.96 +const TInt KAknLayoutUtilsDoNotOverride = -1;
    1.97 +
    1.98 +/**
    1.99 +* Text utilities.
   1.100 +* Text truncating and wrapping methods in this class do not support 
   1.101 +* text that requires conversion from logical to visual form,
   1.102 +* e.g. Arabic/Hebrew, Thai and Hindi text. Code that needs to support that
   1.103 +* kind of text should use corresponding methods in AknBidiTextUtils instead.
   1.104 +*/
   1.105 +class AknTextUtils 
   1.106 +    {
   1.107 +public:
   1.108 +    enum TClipDirection
   1.109 +    {
   1.110 +    EDoNotClip,
   1.111 +    EClipFromEnd,
   1.112 +    EClipFromBeginning
   1.113 +    };
   1.114 +    /** ClipToFit() Generic clipping
   1.115 +    
   1.116 +    @param aBuffer         String that needs to be clipped. will be modified by this call
   1.117 +    @param aFont           Font used in the code
   1.118 +    @param aMaxWidthInPixels Maximum length of text that will not be clipped.
   1.119 +    @param aDir            Where is the text clipped from. EDoNotClip, EClipFromEnd, EClipFromBeginning.
   1.120 +    @param aClipWidth      The length of the text after clipping. KDefaultClipWidth will make it use aMaxWidthInPixels.
   1.121 +    @param aClipString     The representation of three dots. (not really used anywhere - use the default value always or "")
   1.122 +       
   1.123 +    returns true if the text was clipped and 3 dots were added. 
   1.124 +    */
   1.125 +    
   1.126 +    IMPORT_C static TBool ClipToFit(TDes& aBuffer,
   1.127 +                                    const CFont& aFont, 
   1.128 +                                    TInt aMaxWidthInPixels,
   1.129 +                                    TClipDirection aDir=EClipFromEnd,
   1.130 +                                    TInt aClipWidth = KDefaultClipWidth,
   1.131 +                                    const TDesC &aClipString=_L("..."));
   1.132 +
   1.133 +    /** ClipToFit() for clipping text inside lists
   1.134 +     *
   1.135 +     * NOTICE: This method cannot handle situation where the text may dynamically change its size! Especially when you have bitmaps on the right side!
   1.136 +     *
   1.137 +     * This needs to be done AFTER the listbox has done its SizeChanged()!
   1.138 +     */
   1.139 +    IMPORT_C static TBool ClipToFit(TDes& aBuffer, 
   1.140 +                                    TClipDirection aDir,
   1.141 +                                    CEikFormattedCellListBox *aListBox,
   1.142 +                                    TInt aItemIndex,
   1.143 +                                    TInt aSubCellNumber);
   1.144 +
   1.145 +    /** ClipToFit() for clipping text inside lists
   1.146 +     *
   1.147 +     * NOTICE: This method cannot handle situation where the text may dynamically change its size! Especially when you have bitmaps on the right side!
   1.148 +     *
   1.149 +     * This needs to be done AFTER the listbox has done its SizeChanged()!
   1.150 +     */
   1.151 +    IMPORT_C static TBool ClipToFit(TDes& aBuffer,
   1.152 +                                    TClipDirection aDir,
   1.153 +                                    CEikColumnListBox *aListBox,
   1.154 +                                    TInt aItemIndex,
   1.155 +                                    TInt aColumnNumber);
   1.156 +
   1.157 +    // implementation
   1.158 +
   1.159 +    static TBool DoClipToFit(
   1.160 +        TDes& aBuffer,
   1.161 +        const CFont& aFont,
   1.162 +        TInt aMaxWidthInPixels,
   1.163 +        TClipDirection aDir,
   1.164 +        TInt aClipWidth,
   1.165 +        const TDesC& aClipString );
   1.166 +
   1.167 +    /**
   1.168 +    * Wraps a string to an array of pointers.
   1.169 +    * The number of lines and line widths are specified by aLineWidthArray.
   1.170 +    * The pointers in aWrappedArray point to positions inside aWrappedString.
   1.171 +    *
   1.172 +    * @param aStringToWrap      String that needs to be wrapped
   1.173 +    * @param aLineWidthArray    Line widths in pixels
   1.174 +    * @param aFont              Used font
   1.175 +    * @param aWrappedArray      Pointers to wrapped lines
   1.176 +    */
   1.177 +    IMPORT_C static void WrapToArrayL( 
   1.178 +        const TDesC& aStringToWrap,
   1.179 +        const CArrayFix<TInt>& aLineWidthArray,
   1.180 +        const CFont& aFont,
   1.181 +        CArrayFix<TPtrC>& aWrappedArray);
   1.182 +
   1.183 +    /**
   1.184 +    * Wraps a string to an array of pointers.
   1.185 +    * Constant line width is given.
   1.186 +    * The pointers in aWrappedArray point to positions inside aWrappedString.
   1.187 +    *
   1.188 +    * @param aStringToWrap      String that needs to be wrapped
   1.189 +    * @param aLineWidth         Constant line width in pixels
   1.190 +    * @param aFont              Used font
   1.191 +    * @param aWrappedArray      Pointers to wrapped lines
   1.192 +    */
   1.193 +    IMPORT_C static void WrapToArrayL( 
   1.194 +        const TDesC& aStringToWrap,
   1.195 +        TInt aLineWidth,
   1.196 +        const CFont& aFont,
   1.197 +        CArrayFix<TPtrC>& aWrappedArray );
   1.198 +
   1.199 +    /**
   1.200 +    * Wraps a string to an array of pointers and clips at the end
   1.201 +    * of the last line if there aren't enough lines to accomodate
   1.202 +    * the entire text. When clipping three dots are inserted at the
   1.203 +    * end of the last line.
   1.204 +    * The number of lines and line widths are specified by aLineWidthArray.
   1.205 +    * The pointers in aWrappedArray point to positions inside aWrappedString.
   1.206 +    *
   1.207 +    * Expect the string to be modified if clipping is needed.
   1.208 +    * (Clipping character KEllipsis is inserted at the ending point)
   1.209 +    *
   1.210 +    * @param aStringToWrap      String that needs to be wrapped
   1.211 +    * @param aLineWidthArray    Line widths in pixels
   1.212 +    * @param aFont              Used font
   1.213 +    * @param aWrappedArray      Pointers to wrapped lines
   1.214 +    */
   1.215 +    IMPORT_C static void WrapToArrayAndClipL( 
   1.216 +        TDes& aStringToWrap,             
   1.217 +        const CArrayFix<TInt>& aLineWidthArray, 
   1.218 +        const CFont& aFont,                     
   1.219 +        CArrayFix<TPtrC>& aWrappedArray );       
   1.220 +    
   1.221 +    /**
   1.222 +    * Chops a string when a line break character is encountered.
   1.223 +    * Clips at the end of each line if there isn't enough space
   1.224 +    * on that line.
   1.225 +    * When clipping, KEllipsis (shown as 3 dots) is inserted at
   1.226 +    * the end of the line.
   1.227 +    * The number of lines and line widths are specified by aLineWidthArray.
   1.228 +    * The pointers in aChoppedArray point to positions inside aStringToChop.
   1.229 +    *
   1.230 +    * Expect the string to be modified if clipping is needed
   1.231 +    * (Clipping character KEllipsis is inserted in the end of the lines)
   1.232 +    *
   1.233 +    * @param aStringToChop      String that needs to be chopped
   1.234 +    * @param aLineWidthArray    Line widths in pixels
   1.235 +    * @param aFont              Used font
   1.236 +    * @param aChoppedArray      Pointers to chopped lines
   1.237 +    */
   1.238 +    IMPORT_C static void ChopToArrayAndClipL(
   1.239 +        TDes& aStringToChop,             
   1.240 +        const CArrayFix<TInt>& aLineWidthArray, 
   1.241 +        const CFont& aFont,                    
   1.242 +        CArrayFix<TPtrC>& aChoppedArray);
   1.243 +
   1.244 +    /**
   1.245 +    * Chops a string when a line break character is encountered.
   1.246 +    * Clips at the end of each line if there isn't enough space
   1.247 +    * on that line.
   1.248 +    * When clipping, KEllipsis (shown as 3 dots) is inserted at
   1.249 +    * the end of the line.
   1.250 +    * Constant line width is given.
   1.251 +    * The pointers in aChoppedArray point to positions inside aStringToChop.
   1.252 +    *
   1.253 +    * Expect the string to be modified if clipping is needed
   1.254 +    * (Clipping character KEllipsis is inserted in the end of the lines)
   1.255 +    *
   1.256 +    * @param aStringToChop      String that needs to be chopped
   1.257 +    * @param aLineWidth         Constant line width in pixels
   1.258 +    * @param aFont              Used font
   1.259 +    * @param aChoppedArray      Pointers to chopped lines
   1.260 +    */
   1.261 +    IMPORT_C static void ChopToArrayAndClipL(
   1.262 +        TDes& aStringToChop,             
   1.263 +        TInt aLineWidth, 
   1.264 +        const CFont& aFont,                    
   1.265 +        CArrayFix<TPtrC>& aChoppedArray );
   1.266 +
   1.267 +    /**
   1.268 +    * Wraps a string (aStringToWrap) into lines according to the
   1.269 +    * number of lines and line widths specified in aLineWidthArray. 
   1.270 +    * Inserts '\n' at the end of lines. 
   1.271 +    * Copies the result into aWrappedString.
   1.272 +    * Leaves if aWrappedString isn't big enough.
   1.273 +    *
   1.274 +    * @param aStringToWrap      String that needs to be wrapped
   1.275 +    * @param aLineWidthArray    Lines widths in pixels
   1.276 +    * @param aFont              Used font
   1.277 +    * @param aWrappedString     Wrapped string 
   1.278 +    */
   1.279 +    IMPORT_C static void WrapToStringL( 
   1.280 +        const TDesC& aStringToWrap,
   1.281 +        const CArrayFix<TInt>& aLineWidthArray,
   1.282 +        const CFont& aFont,
   1.283 +        TDes& aWrappedString );
   1.284 +
   1.285 +   /**
   1.286 +    * Wraps a string (aStringToWrap) into lines according to the
   1.287 +    * number of lines and line widths specified in aLineWidthArray. 
   1.288 +    * Inserts '\n' at the end of lines. 
   1.289 +    * Clips the last line if there aren't enough lines to
   1.290 +    * fit the entire string. 
   1.291 +    * Copies the result into aWrappedString.
   1.292 +    * Leaves if aWrappedString isn't big enough.
   1.293 +    *
   1.294 +    * @param aStringToWrap      String that needs to be wrapped
   1.295 +    * @param aLineWidthArray    Width of lines in pixels
   1.296 +    * @param aFont              Used font
   1.297 +    * @param aWrappedString     Wrapped string 
   1.298 +    */
   1.299 +    IMPORT_C static void WrapToStringAndClipL(
   1.300 +        const TDesC& aStringToWrap, 
   1.301 +        const CArrayFix<TInt>& aLineWidthArray, 
   1.302 +        const CFont& aFont, 
   1.303 +        TDes& aWrappedString ); 
   1.304 +
   1.305 +    /**
   1.306 +     * This routine is used to strip away a set of characters from
   1.307 +     * a descriptor.
   1.308 +     *
   1.309 +     * Useful for example for listboxes to make sure strings from
   1.310 +     * network or typed by the end user does not have tab or linefeed
   1.311 +     * characters. (as those will make listbox broken.)
   1.312 +     * 
   1.313 +     * @param   aDes         Parameter to change
   1.314 +     * @param   aCharacters  A set of characters to remove
   1.315 +     *
   1.316 +     * There exists predefined character sets to remove:
   1.317 +     *    KAknStripTabs
   1.318 +     *    KAknStripListControlChars  (\t's and \n's and \r's)
   1.319 +     */
   1.320 +    IMPORT_C static void StripCharacters(TDes &aDes, const TDesC &aCharacters);
   1.321 +
   1.322 +    /**
   1.323 +     * This routine is used to replace all control chars with a single 
   1.324 +     * character, usually a whitespace.
   1.325 +     *
   1.326 +     * @param   aDes         Parameter to change
   1.327 +     * @param   aCharacters  A set of characters to remove
   1.328 +     * @param   aReplacement a character used as replacement
   1.329 +     *
   1.330 +     *    KAknReplaceTabs
   1.331 +     *    KAknReplaceListControlChars  (\t's and \n's)
   1.332 +     */
   1.333 +    IMPORT_C static void ReplaceCharacters(TDes &aDes, const TDesC &aChars, TChar aReplacement);
   1.334 +
   1.335 +    /**
   1.336 +     * This routine is used to remove extra whitespaces from text before 
   1.337 +     * showing on screen
   1.338 +     *
   1.339 +     * @param   aDes                   Parameter to change
   1.340 +     * @param   aWhiteSpaceCharacters  A set of whitespace characters to remove
   1.341 +     */
   1.342 +    IMPORT_C static void PackWhiteSpaces(TDes &aDes, const TDesC &aWhiteSpaceChars);
   1.343 +    
   1.344 +    // non-exported implementation
   1.345 +
   1.346 +    static void WrapToStringL(
   1.347 +        const TDesC& aStringToWrap, 
   1.348 +        const CArrayFix<TInt>& aLineWidthArray, 
   1.349 +        const CFont& aFont, 
   1.350 +        TDes& aWrappedString,
   1.351 +        TInt aFlags,
   1.352 +        TInt aDirectionality );
   1.353 +
   1.354 +    static void WrapToArrayL( 
   1.355 +        TDes& aStringToWrap,
   1.356 +        const CArrayFix<TInt>* aLineWidthArray, 
   1.357 +        const CFont& aFont,
   1.358 +        CArrayFix<TPtrC>& aWrappedArray,
   1.359 +        TInt aLineWidth,
   1.360 +        TInt aFlags,
   1.361 +        TInt aDirectionality );
   1.362 +
   1.363 +    static void ChopToArrayAndClipL(
   1.364 +        TDes& aStringToChop,             
   1.365 +        const CArrayFix<TInt>* aLineWidthArray,
   1.366 +        const CFont& aFont,                 
   1.367 +        CArrayFix<TPtrC>& aChoppedArray,
   1.368 +        TInt aLineWidth );    
   1.369 +
   1.370 +    /**
   1.371 +    * This utility is used to see if a text is empty according to the conventions of 
   1.372 +    * Avkon.
   1.373 +    *
   1.374 +    * @param    aTextToTest
   1.375 +    * @return   ETrue if the text is empty according to Avkon
   1.376 +    */
   1.377 +    static TBool IsEmptyText( const TDesC& aTextToTest );
   1.378 +
   1.379 +    /**
   1.380 +     * This routine is used to convert between arabic-indic digits and european digits.
   1.381 +     * based on existing language setting. So it'll convert any digit from the string
   1.382 +     * to use either european digits or arabic-indic digits based on current settings.
   1.383 +     *
   1.384 +     * NOTE: THis method can be also called in european release. The method is required
   1.385 +     * to do the correct thing with all the languages.
   1.386 +     *
   1.387 +     * This method should only be used just before displaying the number as unicode string.
   1.388 +     * Also, never store the converted string as unicode.
   1.389 +     *
   1.390 +     * @since 2.0
   1.391 +     * @param   aDes                    Parameter to change
   1.392 +     */
   1.393 +    IMPORT_C static void LanguageSpecificNumberConversion(TDes &aDes);
   1.394 +
   1.395 +    /**
   1.396 +     * This routine is used to convert digits from any digit format to another format eg. from 
   1.397 +     * european digits to arabic-indic digits.
   1.398 +     *
   1.399 +     * @since 2.0
   1.400 +     * @param aDes                      Parameter to change. It can contain digits from several digit types.
   1.401 +     * @param aDigitType                Destination digit type.
   1.402 +     */
   1.403 +    IMPORT_C static void ConvertDigitsTo( TDes& aDes, TDigitType aDigitType );
   1.404 +
   1.405 +    /**
   1.406 +    * Convenience routine to obtain the directionality of the current input language
   1.407 +    * This routine will attempt to access this information in a system-efficient way.
   1.408 +    *
   1.409 +    * This is not to be confused with either the directionality of the display text 
   1.410 +    * language or (a closely associated concept) the layout direction of the UI 
   1.411 +    * (accessed via AknLayoutUtils::LayoutMirrored() )
   1.412 +    * 
   1.413 +    * @since 2.0
   1.414 +    * @return TBidiText::ELeftToRight if the current input language is left to right
   1.415 +    *         TBidiText::ERightToLeft if the current input langauge is right to left     
   1.416 +    */
   1.417 +    IMPORT_C static TBidiText::TDirectionality CurrentScriptDirectionality();
   1.418 +
   1.419 +    /**
   1.420 +    * Method used to constrain the digit type to use to that consisted with the current input language
   1.421 +    * 
   1.422 +    * @since 2.0
   1.423 +    * @returns TDigitType consistent with the current input language
   1.424 +    */
   1.425 +    static TDigitType InputLanguageFilteredDigitType();
   1.426 +
   1.427 +    /**
   1.428 +    * Method used to constrain the digit type to use to that consisted with the current display text language
   1.429 +    * 
   1.430 +    * @since 2.0
   1.431 +    * @returns TDigitType consistent with the current input language
   1.432 +    */
   1.433 +    static TDigitType DisplayTextLanguageFilteredDigitType();
   1.434 +
   1.435 +    /**
   1.436 +    * Returns the digit type to be used for editors that are purely numeric in quality.
   1.437 +    *
   1.438 +    * @since 2.0
   1.439 +    * @returns TDigitType to use for purely numeric editors
   1.440 +    */ 
   1.441 +    IMPORT_C static TDigitType NumericEditorDigitType();
   1.442 +
   1.443 +    /**
   1.444 +     * This routine is used to convert between arabic-indic digits and european digits.
   1.445 +     * based on existing language setting. So it'll convert any digit from the string
   1.446 +     * to use either european digits or arabic-indic digits based on current settings.
   1.447 +     *
   1.448 +     * This routine builds in the constraints imposed by current display text languages. 
   1.449 +     *
   1.450 +     * The number of characters in the buffer is not changed by this routine. It can therefore be 
   1.451 +     * safely used easily with existing (modifiable) descriptors.
   1.452 +     *
   1.453 +     * This method should only be used just before displaying the number as unicode descriptor.
   1.454 +     * Never store the converted string.
   1.455 +     *
   1.456 +     * @since 2.0
   1.457 +     * @param   aDes                    Parameter to change
   1.458 +     */
   1.459 +    IMPORT_C static void DisplayTextLanguageSpecificNumberConversion(TDes &aDes);
   1.460 +  
   1.461 +    /**
   1.462 +    * Returns the digit type to be used for editors that are alphanumeric.
   1.463 +    * (Note that these editors may be configurable to be purely numeric - that is have a numeric
   1.464 +    * mode, but they remain alphanumeric editors for the sake of this API.)
   1.465 +    *
   1.466 +    * This may be useful for instance for input processors that convert numeric key events to the 
   1.467 +    * currently set input digit type.
   1.468 +    *
   1.469 +    * @since 2.0
   1.470 +    * @returns TDigitType to editors with alphanumeric capability
   1.471 +    */ 
   1.472 +    IMPORT_C static TDigitType TextEditorDigitType();
   1.473 +
   1.474 +    enum TDigitModeQueryType {
   1.475 +        EDigitModeEditorDefault, // in editors by default whether western or foreign digits are used (gen.editors, both text and numbers)
   1.476 +        EDigitModeUserModifiableEditor, // in editors whether user can modify digitmode with keypad
   1.477 +        EDigitModeShownToUser, // in all components when displaying digits
   1.478 +        EDigitModeNumberEditor, // number, time, date, notification texts (1st group of editors)
   1.479 +        EDigitModeLatinNumberEditor // e-mail, password, PIN codes, etc. (3rd group, where only latin can be used)
   1.480 +    };
   1.481 +    /**
   1.482 +     * This routine can be used to check what modes digits can be on.
   1.483 +     *
   1.484 +     * It uses input language, display language and the setting from general settings
   1.485 +     * to calculate whether foreign digits need to be used.
   1.486 +     *
   1.487 +     * This is useful for editor implementation and anyone that needs to convert
   1.488 +     * digits for display.
   1.489 +     * 
   1.490 +     * @since 2.0
   1.491 +     * @param aQueryType   what is the situation where the digits are to be used.
   1.492 +     * @returns ETrue to indicate whether digit conversions need to be used.
   1.493 +     * @returns EFalse to indicate that no conversion is needed.
   1.494 +     */
   1.495 +    IMPORT_C static TBool DigitModeQuery(TDigitModeQueryType aQueryType = EDigitModeShownToUser);
   1.496 +
   1.497 +    /** 
   1.498 +     * Converts a filename ABCDE.EXT to format which is suitable for display.
   1.499 +     * This method is needed for bi-directional language support.
   1.500 +     * The method adds directionality markers to the filename so that the
   1.501 +     * filename can correctly be rendered to screen.
   1.502 +     *
   1.503 +     *
   1.504 +     * @since 2.6
   1.505 +     * @param aDes contains the file name in logical format. 
   1.506 +     * @returns file name in logical format with needed directionality markers.
   1.507 +     */
   1.508 +    IMPORT_C static HBufC* ConvertFileNameL(const TDesC& aDes);
   1.509 +
   1.510 +
   1.511 +    /**
   1.512 +    * @deprecated
   1.513 +    * Do not use. This method will be removed.
   1.514 +    */
   1.515 +    IMPORT_C static HBufC* LoadScalableTextL(CCoeEnv& aCoe, TInt aResourceId);
   1.516 +
   1.517 +    /**
   1.518 +    * @deprecated
   1.519 +    * Do not use. This method will be removed.
   1.520 +    */
   1.521 +    IMPORT_C static HBufC* LoadScalableTextLC(CCoeEnv& aCoe, TInt aResourceId);
   1.522 +
   1.523 +    /**
   1.524 +    * @deprecated
   1.525 +    * Do not use. This method will be removed.
   1.526 +    */
   1.527 +    IMPORT_C static TInt LoadScalableText(CCoeEnv& aCoe, TInt aResourceId, TDes& aBuffer ); 
   1.528 +
   1.529 +    /**
   1.530 +    * @deprecated
   1.531 +    * Do not use. This method will be removed.
   1.532 +    */
   1.533 +    IMPORT_C static HBufC* ClipAccordingScreenOrientationLC(CCoeEnv& aCoe, HBufC* aBuf); 
   1.534 +
   1.535 +    /**
   1.536 +    * Utility method used in scalable UI for choosing the longest fitting text variant.
   1.537 +    * Truncating and wrapping methods in classes AknTextUtils and AknBidiTextUtils do
   1.538 +    * the choice by themselves, so whenever they are used to process the text, it is not
   1.539 +    * necessary to call this method.
   1.540 +    *
   1.541 +    * Applications do not need to call this method if they pass their localized texts
   1.542 +    * to Avkon's UI components.
   1.543 +    *
   1.544 +    * @since 2.8
   1.545 +    * 
   1.546 +    * @param aText Text containing one or many variants with varying text widths,
   1.547 +    * separated with the character 0x0001. The text is supposed to be 
   1.548 +    * in logical order.
   1.549 +    * @param aFont Font used to render the text.
   1.550 +    * @param aMaxWidthInPixels Max width in pixels.
   1.551 +    *
   1.552 +    * @ret Longest fitting text. If none of the variants fits,
   1.553 +    * the shortest one in pixels is returned.
   1.554 +    */
   1.555 +    IMPORT_C static TPtrC ChooseScalableText(
   1.556 +        const TDesC& aText,
   1.557 +        const CFont& aFont,
   1.558 +        TInt aMaxWidthInPixels );
   1.559 +    };
   1.560 +
   1.561 +_LIT(KAknStripTabs, "\t");
   1.562 +_LIT(KAknStripListControlChars, "\t\n");
   1.563 +_LIT(KAknReplaceTabs, "\t");
   1.564 +_LIT(KAknReplaceListControlChars, "\t\n");
   1.565 +_LIT(KAknCommonWhiteSpaceCharacters, " \n\t\r");
   1.566 +
   1.567 +/**
   1.568 + * These are part of Selection service and they should be called by application's HandleCommandL() to get
   1.569 + * menus and cba's handled automatically for selection service.
   1.570 + *
   1.571 + * The right way to implement these would be to have dialogs with names "Selection List", "MultiSelection List"
   1.572 + * and "Markable list" and make them keep a listbox inside it. (look at CAknPopupList, it does similar things)
   1.573 + *
   1.574 + * See CAknSelectionListDialog and CAknMarkableListDialog from aknselectionlist.h, they provide better
   1.575 + * interface for applications.
   1.576 + */
   1.577 +class AknSelectionService
   1.578 +    {
   1.579 +public:
   1.580 +    /** Helper function to implement ProcessCommandL() for selection list dialogs
   1.581 +     */
   1.582 +    IMPORT_C static void HandleSelectionListProcessCommandL(
   1.583 +        TInt aCommand,
   1.584 +        CEikListBox* aListBox);
   1.585 +
   1.586 +    /** Helper function to implement ProcessCommandL() for selection list dialogs
   1.587 +     */
   1.588 +    IMPORT_C static void HandleMultiselectionListProcessCommandL(
   1.589 +        TInt aCommand,
   1.590 +        CEikListBox* aListBox);
   1.591 +
   1.592 +    /** Helper function to implement ProcessCommandL() for markable list dialogs
   1.593 +     */
   1.594 +    IMPORT_C static void HandleMarkableListProcessCommandL(
   1.595 +        TInt aCommand,
   1.596 +        CEikListBox* aListBox);
   1.597 +
   1.598 +    /** Helper function to implement ProcessCommandL() for menu lists
   1.599 +     */
   1.600 +    IMPORT_C static TKeyResponse HandleMenuListOfferKeyEventL(
   1.601 +        const TKeyEvent& aKeyEvent,
   1.602 +        TEventCode aType,
   1.603 +        CEikListBox* aListBox);
   1.604 +
   1.605 +    /** Helper function to implement DynInitMenuPaneL() for markable list dialogs
   1.606 +     */
   1.607 +    IMPORT_C static void HandleMarkableListDynInitMenuPane(
   1.608 +        TInt aResourceId,
   1.609 +        CEikMenuPane *aMenu,
   1.610 +        CEikListBox *aListBox);
   1.611 +
   1.612 +    /** Helper function to implement DynInitMenuPaneL() for markable list dialogs
   1.613 +     */
   1.614 +    IMPORT_C static void HandleMarkableListDynInitMenuItem(
   1.615 +        CEikMenuPane *aMenu,
   1.616 +        CEikListBox *aListBox,
   1.617 +        TInt aCommandId,
   1.618 +        TBool aCanBeAppliedToMultipleItems);
   1.619 +
   1.620 +    /** Helper function to implement command handling for markable list dialogs
   1.621 +     */
   1.622 +    IMPORT_C static void HandleMarkableListUpdateAfterCommandExecution(
   1.623 +        CEikListBox *aListBox);
   1.624 +
   1.625 +    /** Helper function to position list highlight correctly after item removal
   1.626 +     */
   1.627 +    IMPORT_C static void HandleItemRemovalAndPositionHighlightL(
   1.628 +        CEikListBox *aListBox,
   1.629 +        TInt aValueOfCurrentItemIndexBeforeRemoval,
   1.630 +        TBool aCurrentItemWasRemoved);
   1.631 +
   1.632 +    // This one updates selectionindexes too.
   1.633 +    /** Helper function to position list highlight correctly after item removal
   1.634 +     *
   1.635 +     * It also updates selection index array based on information about which
   1.636 +     * items were removed.
   1.637 +     */
   1.638 +    IMPORT_C static void HandleItemRemovalAndPositionHighlightL(
   1.639 +        CEikListBox *aListBox,
   1.640 +        TInt aValueOfCurrentItemIndexBeforeRemoval,
   1.641 +        CArrayFix<TInt> &aIndexesOfRemovedItemsBeforeRemoval);
   1.642 +    };
   1.643 +
   1.644 +
   1.645 +
   1.646 +class CAknSearchField;
   1.647 +
   1.648 +/** 
   1.649 + * This class implements find requirements from component specifications. This
   1.650 + * class works also as documentation of how to use different find components.
   1.651 + * (The implementation has been copied from the example application which 
   1.652 + * implements find and replaced the code with calls to these static functions).
   1.653 + *
   1.654 + * There is no reason for an application to use this class directly. 
   1.655 + * Application should use CAknSelectionListDialog instead. This class is public
   1.656 + * only because sometimes it is necessary to access the low level behaviour of
   1.657 + * find to implement similar functionality in places independent of find; or if
   1.658 + * @c CAknSelectionListDialog is not used for some reason.
   1.659 + */
   1.660 +class AknFind
   1.661 +    {
   1.662 +public:
   1.663 +
   1.664 +    /*
   1.665 +     * Implements the event handlers for the find pane. This method must be
   1.666 +     * called when a @c ProcessCommandL event is received and a find pane is on
   1.667 +     * the screen.
   1.668 +     *
   1.669 +     * @param aCommand Command id.
   1.670 +     * @param aListBox Pointer to listbox control.
   1.671 +     * @param aSearchField Pointer to search field control.
   1.672 +     * @param aParentControl Parent control.
   1.673 +     */
   1.674 +    IMPORT_C static void HandleFindPopupProcessCommandL(
   1.675 +                        TInt aCommand, 
   1.676 +                        CEikListBox* aListBox, 
   1.677 +                        CAknSearchField* aSearchField, 
   1.678 +                        CCoeControl* aParentControl);
   1.679 +    
   1.680 +    /*
   1.681 +     * Handles key events for the find pane. This method must be called when
   1.682 +     * control receives @c OfferKeyEventL event.
   1.683 +     *
   1.684 +     * @param aKeyEvent The key event.
   1.685 +     * @param aType The type of key event:@c TEventCode.
   1.686 +     * @param aListBoxParent Pointer to the parent control.
   1.687 +     * @param aListBox Pointer to listbox control.
   1.688 +     * @param aSearchField Pointer to search field control.
   1.689 +     * @param isFindPopup @c ETrue if popup find pane, @c EFalse if normal find
   1.690 +     *        pane.
   1.691 +     * @param aNeedRefresh @c ETrue when find pane is redrawn.
   1.692 +     */    
   1.693 +    IMPORT_C static TKeyResponse HandleFindOfferKeyEventL(
   1.694 +                        const TKeyEvent& aKeyEvent, 
   1.695 +                        TEventCode aType, 
   1.696 +                        CCoeControl* aListBoxParent, 
   1.697 +                        CEikListBox* aListBox, 
   1.698 +                        CAknSearchField* aSearchField, 
   1.699 +                        TBool isFindPopup, 
   1.700 +                        TBool &aNeedRefresh);
   1.701 +
   1.702 +    /*
   1.703 +     * Do not use this method.
   1.704 +     *
   1.705 +     * @deprecated Use @c AknFind::HandleFixedFindSizeChanged() and 
   1.706 +     *             @c AknFind::HandlePopupFindSizeChanged instead.
   1.707 +     *        
   1.708 +     */
   1.709 +    IMPORT_C static void HandleFindSizeChanged(
   1.710 +            CCoeControl* aParentControl, 
   1.711 +            CEikListBox* aListBox, 
   1.712 +            CAknSearchField* aSearchField, 
   1.713 +            TBool ispopup = ETrue, 
   1.714 +            TInt aFindWindowResourceId = R_AVKON_POPUP_FIND_WINDOW, 
   1.715 +            TInt aListAreaId = R_AVKON_LIST_GEN_PANE, 
   1.716 +            TInt aListResourceIdWithFindPopup = 
   1.717 +                                R_AVKON_LIST_GEN_PANE_WITH_FIND_POPUP, 
   1.718 +            TInt aFindWindowParentResourceId = 
   1.719 +                                R_AVKON_MAIN_PANE_WITH_STATUS_PANE);
   1.720 +
   1.721 +    /** 
   1.722 +     * This is the new typesafe (and easier to use) version of @c
   1.723 +     * HandleFindSizeChanged(). Use this instead of (deprecated) @c
   1.724 +     * HandleFindSizeChanged().
   1.725 +     *
   1.726 +     * @param aParentControl Parent control.
   1.727 +     * @param aListBox Column list, optional and available only with column 
   1.728 +     *                 lists.
   1.729 +     * @param aSearchField Pointer to search field control.
   1.730 +     */
   1.731 +    IMPORT_C static void HandleFixedFindSizeChanged(
   1.732 +            CCoeControl* aParentControl,
   1.733 +            CAknColumnListBox* aListBox, // only available with column lists
   1.734 +            CAknSearchField* aSearchField);
   1.735 +    
   1.736 +    /** 
   1.737 +     * This is the new typesafe(and easier to use) version of @c 
   1.738 +     * HandleFindSizeChanged(). Use this instead of (deprecated) @c
   1.739 +     * HandleFindSizeChanged().
   1.740 +     *
   1.741 +     * @param aParentControl Parent control.
   1.742 +     * @param aListBox Pointer to listbox control.
   1.743 +     * @param aSearchField Pointer to search field control.
   1.744 +     */
   1.745 +    IMPORT_C static void HandlePopupFindSizeChanged(
   1.746 +                            CCoeControl* aParentControl,
   1.747 +                            CEikListBox* aListBox,  //available with all lists.
   1.748 +                            CAknSearchField* aSearchField);
   1.749 +    
   1.750 +    /**
   1.751 +     * Creates layout for a find pane and for a list. This method must be called
   1.752 +     * in @c SizeChanged() method of an container.
   1.753 +     *
   1.754 +     * @since 2.6
   1.755 +     *
   1.756 +     * @param aParentControl Parent control.
   1.757 +     * @param aListBox Pointer to listbox control.
   1.758 +     * @param aSearchField Pointer to search field control.
   1.759 +     * @param aFindWindow LAF specific table line for find window.
   1.760 +     * @param aListArea LAF specific table for list box area.
   1.761 +     * @param aIsPopup @c ETrue if popup find pane, @c EFalse if normal find
   1.762 +     *        pane.
   1.763 +     * @param aFindWindowParent LAF specific table line for find parent.
   1.764 +     */
   1.765 +    IMPORT_C static void HandleFindSizeChangedLayouts(
   1.766 +                            CCoeControl* aParentControl, 
   1.767 +                            CEikListBox* aListBox, 
   1.768 +                            CAknSearchField* aSearchField, 
   1.769 +                            const TAknWindowLineLayout& aFindWindow,
   1.770 +                            const TAknWindowLineLayout& aListArea,
   1.771 +                            TBool aIsPopup,
   1.772 +                            const TAknWindowLineLayout& aFindWindowParent );
   1.773 +
   1.774 +public:
   1.775 +
   1.776 +    /**
   1.777 +     * Checks if @c aItemText matches @c aSearchText. 
   1.778 +     *
   1.779 +     * @param aItemText List box item text.
   1.780 +     * @param aSearchText Searched text.
   1.781 +     * 
   1.782 +     * @return @c ETrue if list box item text @c aItemText matches @c 
   1.783 +     *         aSearchText otherwise @c EFalse.
   1.784 +     */
   1.785 +    IMPORT_C static TBool IsFindMatch(const TDesC& aItemText, 
   1.786 +                                      const TDesC& aSearchText);
   1.787 +
   1.788 +    /**
   1.789 +     * Tests if aCh is a word separator character as described in S60.
   1.790 +     *
   1.791 +     * @param aCh Comperative character.
   1.792 +     *
   1.793 +     * @return @c ETrue if aCh is a word separator character as described in
   1.794 +     * S60 otherwise @c EFalse.
   1.795 +     */
   1.796 +    IMPORT_C static TBool IsFindWordSeparator(TChar aCh);
   1.797 +
   1.798 +    
   1.799 +    /**
   1.800 +     * Checks if @c aItemText matches @c aSearchText. 
   1.801 +     * Calls UpdateNextCharsL() if findutil is not supported.
   1.802 +     *
   1.803 +     * @since 5.0
   1.804 +     * @param aItemText List box item text.
   1.805 +     * @param aSearchText Searched text.
   1.806 +     * @param aNextChars Reference to the next characters for the adaptive search grid
   1.807 +     *        The HBufC buffer may be re-allocated by this method. 
   1.808 +     *        In that case the pointer reference is modified to point to the re-allocated object.     
   1.809 +     * 
   1.810 +     * @return @c ETrue if list box item text @c aItemText matches @c 
   1.811 +     *         aSearchText otherwise @c EFalse.
   1.812 +     */
   1.813 +    IMPORT_C static TBool IsAdaptiveFindMatch( const TDesC& aItemText, 
   1.814 +			    		       const TDesC& aSearchText,			
   1.815 +			       		       HBufC*& aNextChars );
   1.816 +
   1.817 +    /**
   1.818 +     * Update next characters if find pane state was changed.
   1.819 +     *
   1.820 +     * @since 5.0
   1.821 +     * @param aNextChars Next characters for the adaptive search grid
   1.822 +     * @param aCh Criteria from the search field.    
   1.823 +     */
   1.824 +    static void UpdateNextCharsL( HBufC*& aNextChars, TChar aCh );
   1.825 +    
   1.826 +    /**
   1.827 +     * For Devanagari adaptive search     
   1.828 +     * Update next characters if find pane state was changed.
   1.829 +     *
   1.830 +     * @since 5.0
   1.831 +     * @param aNextChars reference to the next characters for the adaptive search grid
   1.832 +     * @param aItemString string we are searching.    
   1.833 +     */
   1.834 +    static void UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString );
   1.835 +    
   1.836 +    /**
   1.837 +     * Update next chars from the list box item text, when search field if empty.
   1.838 +     * This need to be done for update next characters for adaptive grid
   1.839 +     * works faster then calling IsAdaptiveFindMatch(). 
   1.840 +     *
   1.841 +     * @since 5.0
   1.842 +     * @param aNextChars Reference to the next characters for the adaptive search grid
   1.843 +     *        The HBufC buffer may be re-allocated by this method. 
   1.844 +     *        In that case the pointer reference is modified to point to the re-allocated object.     
   1.845 +     * @param aItemString List box item text.
   1.846 +     */
   1.847 +    IMPORT_C static void UpdateNextCharsFromString( HBufC*& aNextChars, const TDesC& aItemString );
   1.848 +
   1.849 +    /**
   1.850 +     * Update next chars from the list box item text according to the bitflag.
   1.851 +     * Use to exclude columns from the listbox string. For example icon index columns. 
   1.852 +     *
   1.853 +     * @since 5.0
   1.854 +     * @param aInputText List box item text
   1.855 +     * @param aColumnFlag The bit flag shows which columns take into account
   1.856 +     * @param aOutText Updated list box item text accoding to bit flag
   1.857 +     */
   1.858 +    IMPORT_C static void UpdateItemTextAccordingToFlag( const TDesC& aInputText, 
   1.859 +		  		 			TBitFlags32 aColumnFlag, 
   1.860 +							TDes& aOutText );
   1.861 +
   1.862 +    /**
   1.863 +     * Helper function to handle find pane's visibility.
   1.864 +     *
   1.865 +     * @param aSearchField Pointer to search field control.
   1.866 +     * @param ispopup @c ETrue if popup find pane, @c EFalse if normal find 
   1.867 +     *        pane.
   1.868 +     * @param textchanged @c ETrue when text in @c CAknSearchField has changed.
   1.869 +     * @param aNeedRefresh @c ETrue when find pane is redrawn.
   1.870 +     */
   1.871 +    static void HandleFindPaneVisibility(CAknSearchField* aSearchField, 
   1.872 +                                         TBool ispopup, 
   1.873 +                                         TBool textchanged, 
   1.874 +                                         TBool &aNeedRefresh);
   1.875 +    };
   1.876 +
   1.877 +
   1.878 +/** 
   1.879 + * Utility class to initialize editor control. Use this in conjunction with @c
   1.880 + * AknLayoutUtils::LayoutEdwin(). The class is not fully implemented yet.
   1.881 + */
   1.882 +class AknEditUtils
   1.883 +    {
   1.884 +    public:
   1.885 +    
   1.886 +    /** Basic elements that are needed for the basic editing functions. */
   1.887 +    struct SAknEditorParameters 
   1.888 +    {
   1.889 +        /** The maximum available space that can be used for one text. */
   1.890 +        TInt iEditingSpace;
   1.891 +        
   1.892 +        /** Size of the editing window. */
   1.893 +        TInt iEditingWindow;
   1.894 +        
   1.895 +        /**
   1.896 +         * Character case effects on the style of entering characters.
   1.897 +         * Available alternatives are Upper case, Lower case and Text case.
   1.898 +         */ 
   1.899 +        TInt iCharacterCase;
   1.900 +        
   1.901 +        /** 
   1.902 +         * Specifies from which edge the current line is filled with the
   1.903 +         * inserted characters.
   1.904 +         */
   1.905 +        TInt iJustification;
   1.906 +        
   1.907 +        /** Is user allowed to move the insertion point. */ 
   1.908 +        TBool iAllowedToMoveInsertionPoint;
   1.909 +        
   1.910 +        /** Is cursor blinking or not. */
   1.911 +        TBool iCursorYesNo;
   1.912 +        
   1.913 +        /** Is overflow active or not.  */  
   1.914 +        TBool iOverflowYesNo;
   1.915 +    };
   1.916 +
   1.917 +    IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, TInt aResourceId);
   1.918 +    IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, TResourceReader& aReader);
   1.919 +    IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, const SAknEditorParameters &aParams);
   1.920 +
   1.921 +/**
   1.922 + *  Configures edwin editor. Use AknLayoutUtils::LayoutEdwin() with this method.
   1.923 + *
   1.924 + *  @param aEdwin Edwins created with new.
   1.925 + *  @param aEditingSpace maximum number of characters for the editor
   1.926 + *  @param aEditingWindow maximum number of lines in the editor
   1.927 + *  @param aCharacterCase initial character case:
   1.928 + *          EAknEditorCharactersUpperCase = EAknEditorUpperCase,
   1.929 + *          EAknEditorCharactersLowerCase = EAknEditorLowerCase,
   1.930 + *          EAknEditorCharactersTextCase = EAknEditorTextCase,
   1.931 + *          EAknEditorCharactersTitleCase = EAknEditorTitleCase
   1.932 + *
   1.933 + *  @param aJustification alignment for the editor text ( EAknEditorAlignCenter, 
   1.934 + *         EAknEditorAlignLeft, EAknEditorAlignRight)
   1.935 + *  @param aAllowedToMoveInsertionPoint user can move cursor
   1.936 + *  @param aCursorYesNo is cursor visible or not.
   1.937 + *  @param aOverflowYesNo
   1.938 + */
   1.939 +    IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, 
   1.940 +                       TInt aEditingSpace, 
   1.941 +                       TInt aEditingWindow, 
   1.942 +                       TInt aCharacterCase, 
   1.943 +                       TInt aJustification, 
   1.944 +                       TBool aAllowedToMoveInsertionPoint, 
   1.945 +                       TBool aCursorYesNo, 
   1.946 +                       TBool aOverflowYesNo);
   1.947 +                       
   1.948 +/**
   1.949 + *  Configures edwin editor. Use AknLayoutUtils::LayoutEdwin() with this method.
   1.950 + *  
   1.951 + *  @param aEdwin Edwins created with new.
   1.952 + *  @param aEditingSpace maximum number of characters for the editor
   1.953 + *  @param aEditingWindow maximum number of lines in the editor
   1.954 + *  @param aCharacterCase initial character case:
   1.955 + *          EAknEditorCharactersUpperCase = EAknEditorUpperCase,
   1.956 + *          EAknEditorCharactersLowerCase = EAknEditorLowerCase,
   1.957 + *          EAknEditorCharactersTextCase = EAknEditorTextCase,
   1.958 + *          EAknEditorCharactersTitleCase = EAknEditorTitleCase
   1.959 + *
   1.960 + *  @param aJustification alignment for the editor text ( EAknEditorAlignCenter, 
   1.961 + *         EAknEditorAlignLeft, EAknEditorAlignRight)
   1.962 + *  @param aAllowedToMoveInsertionPoint user can move cursor
   1.963 + *  @param aCursorYesNo is cursor visible or not.
   1.964 + *  @param aOverflowYesNo
   1.965 + *  @param aIsResizeable is edwin resizeable (one line editor should use EFalse, in order to have proper scrolling)
   1.966 + */
   1.967 +    IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, 
   1.968 +                                              TInt aEditingSpace, 
   1.969 +                                              TInt aEditingWindow, 
   1.970 +                                              TInt aCharacterCase, 
   1.971 +                                              TInt aJustification, 
   1.972 +                                              TBool aAllowedToMoveInsertionPoint, 
   1.973 +                                              TBool aCursorYesNo, 
   1.974 +                                              TBool aOverflowYesNo,
   1.975 +                                              TBool aIsResizable);
   1.976 +
   1.977 +    };
   1.978 +
   1.979 +/** Automatic numbering for list items. (DEPRECATED)
   1.980 + * Just create this kind of object and attach it to a listbox, and you'll
   1.981 + * have automatic numbering. 
   1.982 + *
   1.983 + *
   1.984 + * You'll need to call UpdateL() each time you modify the listbox's model!
   1.985 + */
   1.986 +class CListBoxNumbers : public CBase
   1.987 +    {
   1.988 +public:
   1.989 +    IMPORT_C CListBoxNumbers(CEikTextListBox* aListBox);
   1.990 +    IMPORT_C void ConstructL();
   1.991 +    IMPORT_C void UpdateL();
   1.992 +private:
   1.993 +    CEikTextListBox* iListBox;
   1.994 +    };
   1.995 +
   1.996 +class CAknListBoxFilterItems;
   1.997 +
   1.998 +    /** 
   1.999 +    * This class shows how application should build its model for filtered
  1.1000 +    * items. Application should not use this directly, if it has it's own model
  1.1001 +    * or if there's any special things needed for @c MatchableTextArray.
  1.1002 +    * Application can derive from this though. All listboxes use 
  1.1003 +    * @c CAknFilteredTextListBoxModel by default. @c CreateFilter() call 
  1.1004 +    * enables it.
  1.1005 +    * @since S60 0.9
  1.1006 +    */
  1.1007 +class CAknFilteredTextListBoxModel : public CTextListBoxModel, public MDesCArray
  1.1008 +    {
  1.1009 +public: // public interface for apps
  1.1010 +    /**
  1.1011 +    * Creates a @c CAknListBoxFilterItems and thus enables filtering of list
  1.1012 +    * items.
  1.1013 +    * @param aListBox List box from which one or more items can be selected.
  1.1014 +    * @param aSearchField Search field control.
  1.1015 +    */
  1.1016 +    IMPORT_C void CreateFilterL(CEikListBox* aListBox, CAknSearchField* aSearchField);
  1.1017 +    /**
  1.1018 +     * removes previously added filter from model
  1.1019 +     */
  1.1020 +    IMPORT_C void RemoveFilter();
  1.1021 +    /**
  1.1022 +    * Access function for the filter.
  1.1023 +    * @return Pointer to the listbox filter.
  1.1024 +    */
  1.1025 +    IMPORT_C CAknListBoxFilterItems* Filter() const;
  1.1026 +    /**
  1.1027 +    * Destructor.
  1.1028 +    */
  1.1029 +    IMPORT_C ~CAknFilteredTextListBoxModel();
  1.1030 +public: // from CTextListBoxMode
  1.1031 +    /**
  1.1032 +    * Implementation of @c CTextListBoxModel::NumberOfItems()
  1.1033 +    * @return The number of items the list box has.
  1.1034 +    */
  1.1035 +    IMPORT_C virtual TInt NumberOfItems() const;
  1.1036 +    /**
  1.1037 +    * Returns the text of the specified item.
  1.1038 +    * @param aItemIndex Index to the item.
  1.1039 +    * @return The text of item in given index.
  1.1040 +    */
  1.1041 +    IMPORT_C virtual TPtrC ItemText(TInt aItemIndex) const;
  1.1042 +public: // from MEikTextListBoxModel (default filtering string conversions)
  1.1043 +    /**
  1.1044 +    * Implementation of @c CTextListBoxModel::MatchableTextArray()
  1.1045 +    * @return Pointer to the text array.
  1.1046 +    */
  1.1047 +    IMPORT_C const MDesCArray* MatchableTextArray() const;
  1.1048 +
  1.1049 +private:
  1.1050 +    CAknListBoxFilterItems* iFilter; // owned
  1.1051 +private: // From MdesCArray (these implement default matchabletextarray for filtering.)
  1.1052 +    IMPORT_C TInt MdcaCount() const;
  1.1053 +    IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
  1.1054 +private: // from MListBoxModel
  1.1055 +    IMPORT_C virtual TAny* MListBoxModel_Reserved();
  1.1056 +    };
  1.1057 +
  1.1058 +    /** 
  1.1059 +    * Listbox item filtering. This class is designed to be stored inside
  1.1060 +    * a listbox model and the model should call this in its @c NumberOfItems()
  1.1061 +    * and @c ItemText() implementation. The model must be given to this class
  1.1062 +    * and it must have @c MatchableTextArray() implemented correctly.
  1.1063 +    * @c HandleOfferKeyEvent() should be called from the same offer key event
  1.1064 +    * implementation which forwards the keys to listbox and search field
  1.1065 +    * 
  1.1066 +    * If you have both markable list and find at the same time, you should call
  1.1067 +    * @c ResetFiltering() before executing the command for marked items. This
  1.1068 +    * ensures that the ListBox's @c SelectionIndexes() returns all items instead
  1.1069 +    * of only those items that are visible. Selected *items can be found under
  1.1070 +    * @c CAknListBoxFilterItems::SelectionIndexes().
  1.1071 +    *
  1.1072 +    * @since S60 0.9
  1.1073 +    * 
  1.1074 +    */
  1.1075 +class CAknListBoxFilterItems : public CBase, public MCoeControlObserver
  1.1076 +    {
  1.1077 +public:
  1.1078 +    /**
  1.1079 +    * Base class default constructor.
  1.1080 +    * @param aListBox Listbox to be filtered,
  1.1081 +    * @param aSearchField Listbox search field.
  1.1082 +    * @param aModel Listbox model,
  1.1083 +    * @param aView A list box view that displays the list items which are
  1.1084 +    * currently visible in a list box.
  1.1085 +    */
  1.1086 +    IMPORT_C CAknListBoxFilterItems(
  1.1087 +        CEikListBox *aListBox,
  1.1088 +        CAknSearchField *aSearchField,
  1.1089 +        MListBoxModel *aModel,
  1.1090 +        CListBoxView *aView);
  1.1091 +
  1.1092 +    /**
  1.1093 +    * This is for setting empty list text.
  1.1094 +    */
  1.1095 +    IMPORT_C void ConstructL(); // for setting empty list text.
  1.1096 +    /** 
  1.1097 +    * This function is to be called when filter is cleared.
  1.1098 +    */
  1.1099 +    IMPORT_C void ResetFilteringL();
  1.1100 +    /** 
  1.1101 +    * This function will update filter items state from the search field and
  1.1102 +    * listbox. Also updates selection indexes.
  1.1103 +    */
  1.1104 +    IMPORT_C void UpdateCachedDataL(); // updates iOldSearchCriteria and selection indexes.
  1.1105 +    /**
  1.1106 +    * Destructor. Frees all resources owned by the object prior to its
  1.1107 +    * destruction.
  1.1108 +    */
  1.1109 +    IMPORT_C ~CAknListBoxFilterItems();    
  1.1110 +
  1.1111 +public: 
  1.1112 +    /** 
  1.1113 +    * This one gives all indices, not just the ones that are visible.
  1.1114 +    * @return Pointer to the array that has all indices.
  1.1115 +    */
  1.1116 +    IMPORT_C CArrayFix<TInt> *SelectionIndexes();
  1.1117 +    /** 
  1.1118 +    * This will synchronise the selection indices from the listbox.
  1.1119 +    * If you use @c SelectionIndexes(), call this before it.
  1.1120 +    * This is heavy operation and goes through all list items.
  1.1121 +    */
  1.1122 +    IMPORT_C void UpdateSelectionIndexesL();
  1.1123 +    /** 
  1.1124 +    * This will synchronise the selected index from the listbox.
  1.1125 +    * If you use @c SelectionIndexes(), call this before it.
  1.1126 +    * This is heavy operation and goes through all list items. 
  1.1127 +    * @param aVisibleIndex Index to be updated.
  1.1128 +    */
  1.1129 +    IMPORT_C void UpdateSelectionIndexL(TInt aVisibleIndex);
  1.1130 +
  1.1131 +public: // Applications should call this in their listbox model implementation
  1.1132 +    /** 
  1.1133 +    * This is used to ask how many list items are available after filter has
  1.1134 +    * been used. Counts visible list items.
  1.1135 +    * @return Number of items visible.
  1.1136 +    */
  1.1137 +    IMPORT_C TInt FilteredNumberOfItems() const;
  1.1138 +    /** 
  1.1139 +    * This is used to fetch the content of a list item after filter has been
  1.1140 +    * used.
  1.1141 +    * @param aVisibleItemIndex The index of visible item.
  1.1142 +    * @return Index to the original item array.
  1.1143 +    */
  1.1144 +    IMPORT_C TInt FilteredItemIndex(TInt aVisibleItemIndex) const;
  1.1145 +
  1.1146 +public: // Needed to change the correct item.
  1.1147 +
  1.1148 +    /** 
  1.1149 +    * Returns number of original list items.
  1.1150 +    * @return Number of all items.
  1.1151 +    */
  1.1152 +    IMPORT_C TInt NonFilteredNumberOfItems() const; // this always returns >= FilteredNumberOfItems()
  1.1153 +    /** 
  1.1154 +    * Finds the list item on the screen when the item array index is given.
  1.1155 +    * @param aOriginalIndex Item index.
  1.1156 +    * @return Matching index from original array. Returns -1 if the Index is
  1.1157 +    * not visible.
  1.1158 +    */
  1.1159 +    IMPORT_C TInt VisibleItemIndex(TInt aOriginalIndex) const;
  1.1160 +public: 
  1.1161 +    /** 
  1.1162 +    * For building @c MdcaPoint() of the model's @c MatchableTextArray.
  1.1163 +    * This method builds the default value for @c MatchableTextArray.
  1.1164 +    * @param aText Pointer descriptor.
  1.1165 +    * @return Modified text.
  1.1166 +    */
  1.1167 +    IMPORT_C TPtrC DefaultMatchableItemFromItem(TPtrC aText);
  1.1168 +
  1.1169 +public: 
  1.1170 +    /** 
  1.1171 +    * Applications should call this in @c OfferKeyEventL() which gives keys to
  1.1172 +    * listbox and search field.
  1.1173 +    */
  1.1174 +    IMPORT_C void HandleOfferkeyEventL();
  1.1175 +
  1.1176 +   
  1.1177 +    /** 
  1.1178 +    * When you change the list item array you should call this method.
  1.1179 +    */
  1.1180 +    IMPORT_C void HandleItemArrayChangeL();
  1.1181 +
  1.1182 +public: // MCoeControlObserver
  1.1183 +    /**
  1.1184 +    * Sets the observer.
  1.1185 +    * @param aObserver Pointer to the observer.
  1.1186 +    */
  1.1187 +    IMPORT_C void SetObserver(MCoeControlObserver *aObserver);
  1.1188 +    /**
  1.1189 +    * Editor sends messages to this object as control events.
  1.1190 +    * @param aControl The control that sent the event.
  1.1191 +    * @param aEventType The event type.
  1.1192 +    */
  1.1193 +    IMPORT_C void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);
  1.1194 +
  1.1195 +public: // For FEP
  1.1196 +    /**
  1.1197 +    * Sends key events to FEP. This is used to resend key event to FEP if
  1.1198 +    * @c AknFind's @c HandleOfferKeyEventL() gets the key while search field
  1.1199 +    * has no focus. If search field has a focus, the key events go directly to
  1.1200 +    * the editor and this is not called.
  1.1201 +    * @param aValue The character code for an @c EEventKey.
  1.1202 +    */
  1.1203 +    IMPORT_C void DeferredSendKeyEventToFepL(TUint aValue);
  1.1204 +    /**
  1.1205 +    * This gets called from @c DeferredSendKeyEventToFepL().
  1.1206 +    * This does the actual sending of a key event. Does not support more than
  1.1207 +    * one event at the time.
  1.1208 +    * @param aFilterItems Pointer to the @c CAknListBoxFilterItems object.
  1.1209 +    * @return Always returns 0.
  1.1210 +    */
  1.1211 +    static TInt IdleCallBack(TAny *aFilterItems);
  1.1212 +
  1.1213 +public: // For size changed
  1.1214 +    /**
  1.1215 +    * @c AknFind uses this to inform us who is the parent control owning the
  1.1216 +    * listbox and search field. This control should be window-owning control and
  1.1217 +    * it will be used to resize the listbox when changes to the filtering
  1.1218 +    * happens.
  1.1219 +    * @param aControl Pointer to the control.
  1.1220 +    */
  1.1221 +    IMPORT_C void SetParentControl(CCoeControl *aControl);
  1.1222 +   /**
  1.1223 +    * @c AknFind uses this to inform us that we have popup find. Applications 
  1.1224 +    * shouldn't call this.
  1.1225 +    */
  1.1226 +    IMPORT_C void SetPopup();
  1.1227 +
  1.1228 +public: // For detaching and attaching list, findbox, model and view...
  1.1229 +    /**
  1.1230 +    * Attaches or detaches list used by the filtering.
  1.1231 +    * @since S60 2.0
  1.1232 +    * @param aListBox Pointer to listbox or @c NULL.
  1.1233 +    */
  1.1234 +    IMPORT_C void SetListBox(CEikListBox *aListBox);
  1.1235 +    /**
  1.1236 +    * Attaches or detaches find pane used by the filtering.
  1.1237 +    * @since S60 2.0
  1.1238 +    * @param aSearchField Pointer to findbox or @c NULL.
  1.1239 +    */
  1.1240 +    IMPORT_C void SetSearchField(CAknSearchField *aSearchField);
  1.1241 +    /**
  1.1242 +    * Attaches or detaches list model used by the filtering.
  1.1243 +    * @since S60 2.0
  1.1244 +    * @param aModel a pointer to list model or @c NULL.
  1.1245 +    */
  1.1246 +    IMPORT_C void SetModel(MListBoxModel *aModel);
  1.1247 +    /**
  1.1248 +    * Attaches or detaches list view used by the filtering.
  1.1249 +    * @since S60 2.0
  1.1250 +    * @param aView a pointer to list view or @c NULL.
  1.1251 +    */
  1.1252 +    IMPORT_C void SetView(CListBoxView *aView);
  1.1253 +    
  1.1254 +public:
  1.1255 +    /**
  1.1256 +    * This function just returns pointer to the search field.
  1.1257 +    * @return Pointer to the search field.
  1.1258 +    */
  1.1259 +    IMPORT_C CCoeControl *FindBox() const;
  1.1260 +
  1.1261 +    /**
  1.1262 +     * An improved version of DeferredSendKeyEventToFepL. It sends a 
  1.1263 +     * @c TKeyEvent rather than just key code. Thus the correct key 
  1.1264 +     * event can be send to FEP on QWERTY keyboard.
  1.1265 +     * @since S60 5.0
  1.1266 +     * @param aEvent Event send to FEP.
  1.1267 +     */
  1.1268 +    void DeferredSendFullKeyEventToFepL(const TKeyEvent& aEvent);
  1.1269 +
  1.1270 +private:
  1.1271 +    void NoCriteriaL(TBool aUpdateAS = ETrue); // remove criteria completely.
  1.1272 +    void TightenCriteriaL(const TDesC& aCriteria); // slow operation (do when adding new characters to search criteria)
  1.1273 +    void ReleaseCriteriaL(const TDesC& aCriteria); // very slow operation (do when removing characters from search criteria)
  1.1274 +    // EmptyListText handling
  1.1275 +    void InstallEmptyTextL();
  1.1276 +    void UninstallEmptyTextL();
  1.1277 +    // Selections -- these methods form a pair, 
  1.1278 +    // you must call Fetch first and then push.
  1.1279 +    void FetchSelectionIndexesFromListBoxL();
  1.1280 +    void PushSelectionIndexesToListBoxL();
  1.1281 +    void ClearNextChars();
  1.1282 +    TBool IsAdaptiveSearch() const; 	
  1.1283 +
  1.1284 +    // HandleItemAddition without ResetFilteringL() call
  1.1285 +    void HandleItemAdditionL();
  1.1286 +    void HandleItemRemovalL();
  1.1287 +private:
  1.1288 +    TBool IsItemVisible(const TDesC& aMatchableItemString, const TDesC& aSearchText);
  1.1289 +    static TBool IsSeparatorCharacter(TChar c);
  1.1290 +    TBool IsItemSelected(TInt aRealIndex) const;
  1.1291 +private:
  1.1292 +    CArrayFix<TInt> *iShownIndexes; // own // uses non-filtered indexes
  1.1293 +    CArrayFix<TInt> *iSelectionIndexes; // own   // this uses non-filtered indexes
  1.1294 +    HBufC *iOldSearchCriteria; // own
  1.1295 +    MListBoxModel *iModel;
  1.1296 +    CListBoxView *iView;
  1.1297 +    TInt iOldItemCount;
  1.1298 +    HBufC* iEmptyListText; // own
  1.1299 +    CEikListBox* iListBox;
  1.1300 +    CAknSearchField* iSearchField;
  1.1301 +    TBuf<256> iMatchableText;
  1.1302 +    MCoeControlObserver *iObserver;
  1.1303 +    CFindExtension *iExtension;
  1.1304 +    TUint iKeyValue;
  1.1305 +    CCoeControl *iParentControl;
  1.1306 +    TBool iIsPopup;
  1.1307 +    TBool iDisableChangesToShownIndexes;  
  1.1308 +    };
  1.1309 +
  1.1310 +
  1.1311 +/** Removing optimization that breaks listbox views 
  1.1312 + * A view which removes optimization from CListBoxView which breaks with lists where all items are not
  1.1313 + * the same layout.
  1.1314 + * Use it like this: 
  1.1315 + *   CListBoxView* MakeViewClassInstanceL() { return new(ELeave) NoOptimizationView<CListBoxView>; }
  1.1316 + */
  1.1317 +template<class T>
  1.1318 +class NoOptimizationView : public T
  1.1319 +    {
  1.1320 +public:
  1.1321 +    virtual void VScrollTo(TInt aNewTopItemIndex, TRect& aMinRedrawRect)
  1.1322 +    {
  1.1323 +    // AVKON LAF
  1.1324 +    if (this->RedrawDisabled())
  1.1325 +        return;
  1.1326 +    if (this->iTopItemIndex == aNewTopItemIndex)
  1.1327 +        return;
  1.1328 +    aMinRedrawRect.SetRect(this->iViewRect.iTl,this->iViewRect.Size());
  1.1329 +    this->SetTopItemIndex(aNewTopItemIndex);
  1.1330 +    this->Draw(&aMinRedrawRect);
  1.1331 +    // end of AVKON LAF
  1.1332 +    }
  1.1333 +    };
  1.1334 +
  1.1335 +
  1.1336 +/** This is private class, do not use it except for drawing controls!
  1.1337 + * 
  1.1338 + * Do not use it in applications.
  1.1339 + */
  1.1340 +
  1.1341 +
  1.1342 +class AknLAFUtils 
  1.1343 +    {
  1.1344 +public:
  1.1345 +    static void DrawLines(CGraphicsContext* aGc, 
  1.1346 +                  const TRect& mainpane,
  1.1347 +                  TInt x);
  1.1348 +    IMPORT_C static void ReplaceColumn(TPtr aTarget, TDesC* aSource,
  1.1349 +                                       TDesC* aReplacement, TChar aColumnSeparator,
  1.1350 +                                       TInt aColumn);
  1.1351 +    };
  1.1352 +
  1.1353 +
  1.1354 +/**
  1.1355 + * Resource reader class
  1.1356 + *
  1.1357 + * This is utility class for reading listbox resouces.
  1.1358 + *
  1.1359 + * This should be derived from and it reads resource file for you.
  1.1360 + *
  1.1361 + * This seems to be only used by listbox resource readers. (Do not use it in applications)
  1.1362 + */
  1.1363 +struct SAknLayoutGfx;
  1.1364 +struct SAknLayoutText;
  1.1365 +struct SAknLayoutCmd;
  1.1366 +struct SAknLayoutGfx;
  1.1367 +// Not for apps
  1.1368 +struct SAknLayoutPos 
  1.1369 +    {
  1.1370 +    TInt l, t, r, b, W, H;
  1.1371 +
  1.1372 +    typedef SAknLayoutPos ItemType;
  1.1373 +    static void ReadResource(TResourceReader& aReader, ItemType& aTarget);    
  1.1374 +    };
  1.1375 +template<class T> class CArrayReader;
  1.1376 +class CAknGenericReader : public CBase
  1.1377 +    {
  1.1378 +public:
  1.1379 +    IMPORT_C void ConstructL(TInt aResourceId);
  1.1380 +    IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
  1.1381 +    IMPORT_C ~CAknGenericReader();
  1.1382 +
  1.1383 +    IMPORT_C const SAknLayoutGfx* GfxItem(TInt aIndex) const;
  1.1384 +    IMPORT_C const SAknLayoutText* TextItem(TInt aIndex) const;
  1.1385 +    IMPORT_C const SAknLayoutCmd* CmdItem(TInt aIndex) const;
  1.1386 +    IMPORT_C const SAknLayoutGfx* AreaItem(TInt aIndex) const;
  1.1387 +
  1.1388 +    CArrayReader<SAknLayoutGfx>* iGfx;
  1.1389 +    CArrayReader<SAknLayoutText>* iText;
  1.1390 +    CArrayReader<SAknLayoutCmd>* iCmd;
  1.1391 +    CArrayReader<SAknLayoutGfx>* iArea;
  1.1392 +    };
  1.1393 +
  1.1394 +
  1.1395 +
  1.1396 +
  1.1397 +
  1.1398 +// Use this to mark that the position in LAF specification is empty.
  1.1399 +const TInt AknLayoutUtilsNoValue = ELayoutEmpty;
  1.1400 +
  1.1401 +/** Utility classes to build layout based on European LAF from resource files. (can be used by applications)
  1.1402 + *
  1.1403 + * Methods in this class are designed to be called from your control's SizeChanged() method!
  1.1404 + *
  1.1405 + * This class knows the specification's coordinate data format and ensures that different types of
  1.1406 + * controls are positioned and setup correctly according to European LAF. 
  1.1407 + * 
  1.1408 + * This class helps you with positioning labels, controls, rects and other things to according to LAF specification.
  1.1409 + * (It is NOT trivial to get it correct and this adjusts easily to changes in the LAF specification - if you're not
  1.1410 + * using this, remember to read the whole LAF specification - especially the beginning and the end with color and
  1.1411 + * especially how text margins and widths interact!!)
  1.1412 + *
  1.1413 + * (idea of this class is that when specification of one component changes, only resource file needs to be changed and when you 
  1.1414 + * get new product with new specification format, only this module needs to be changed and resources rewritten from the specification. 
  1.1415 + * And when component's specification changes, only the component need to be changed (usually only change is what components are
  1.1416 + * inside it and how it calls this module.).. => all controls have common format that decides its layout!
  1.1417 + *
  1.1418 + * Parent rectangles are always coordinates of LAF specification's parent rectangle in the screen.
  1.1419 + * 
  1.1420 + * To use this, call one of the methods in your SizeChanged() and then you'll need to make sure you
  1.1421 + * draw the area between controls using ClearBetweenRects() call from egul library. (CCoeControl::Rect() helps with that...)
  1.1422 + *
  1.1423 + * A Tip: You do not want to use any dynamic calculation of layouts! It is almost always an error to do so!
  1.1424 + *        => Do not allow layouts that have not been specified!
  1.1425 + *
  1.1426 + * (If LAF spec has many numbers and you need to dynamically choose between them, then keep the numbers in
  1.1427 + * code as function-local using SAknLayoutText/SAknLayoutRect/... -structs..)
  1.1428 + *
  1.1429 + * You'll want to use TAknLayoutRect and TAknLayoutText too to build layout
  1.1430 + * for your custom controls.
  1.1431 + */
  1.1432 +class AknLayoutUtils
  1.1433 +    {
  1.1434 +public:
  1.1435 +
  1.1436 +    struct SAknLayoutText
  1.1437 +    {
  1.1438 +    TInt iFont, iC, iL, iR, iB, iW, iJ;
  1.1439 +    };
  1.1440 +    struct SAknLayoutTextMultiline
  1.1441 +    {
  1.1442 +    TInt iFont, iC, iL, iR, iB, iW, iJ, iNumberOfLinesShown, iNextLineB;
  1.1443 +    };
  1.1444 +    typedef SAknLayoutTextMultiline SAknLayoutLabel;
  1.1445 +    typedef SAknLayoutTextMultiline SAknLayoutEdwin;
  1.1446 +    typedef SAknLayoutText SAknLayoutMfne;
  1.1447 +    typedef SAknLayoutText SAknLayoutSecEd;
  1.1448 +    struct SAknLayoutRect
  1.1449 +    {
  1.1450 +    TInt iC, iL, iT, iR, iB, iW, iH;
  1.1451 +    };
  1.1452 +    typedef SAknLayoutRect SAknLayoutControl;
  1.1453 +    typedef SAknLayoutRect SAknLayoutImage;
  1.1454 +
  1.1455 +    /**
  1.1456 +    * Deprecated! Do not use!
  1.1457 +    */
  1.1458 +    IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
  1.1459 +                                     const TRect& aLabelParent,
  1.1460 +                                     TInt aResourceId,
  1.1461 +                                     const CFont* aCustomFont=0);
  1.1462 +
  1.1463 +    /**
  1.1464 +    * Deprecated! Do not use!
  1.1465 +    */
  1.1466 +    IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
  1.1467 +                                     const TRect& aLabelParent,
  1.1468 +                                     TResourceReader& aReader,
  1.1469 +                                     const CFont* aCustomFont=0);
  1.1470 +
  1.1471 +    /** Layouts a label via a structure of layout parameters
  1.1472 +    @param aLayout   the structure
  1.1473 +     */
  1.1474 +    IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
  1.1475 +                                     const TRect& aLabelParent,
  1.1476 +                                     const SAknLayoutLabel& aLayout,
  1.1477 +                                     const CFont *aCustomFont=0);
  1.1478 +
  1.1479 +    /** Layouts a label via a layout compiler output
  1.1480 +    @param aLayout   a define from aknlayout.lag file
  1.1481 +     */
  1.1482 +    IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
  1.1483 +                                     const TRect& aLabelParent,
  1.1484 +                                     const TAknMultiLineTextLayout& aLayout,
  1.1485 +                                     const CFont *aCustomFont=0);
  1.1486 +
  1.1487 +    /** Layouts a label via a layout compiler output
  1.1488 +    @param aLayout   a define from aknlayout.lag file
  1.1489 +     */
  1.1490 +    IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
  1.1491 +                                     const TRect& aLabelParent,
  1.1492 +                                     const TAknTextLineLayout& aLayout,
  1.1493 +                                     const CFont *aCustomFont=0);
  1.1494 +
  1.1495 +    /** Layouts a label via parameters from the specification
  1.1496 +    @param aLayout   a define from aknlayout.lag file
  1.1497 +    @param font      font id, ELatinPlain12, ELatinBold12, ELatinBold13, ELatinBold17, ELatinBold19 etc..
  1.1498 +    @param C         colour index, 0..255
  1.1499 +    @param l         left margin
  1.1500 +    @param r         right margin
  1.1501 +    @param B         Baseline from top of the parent rectangle
  1.1502 +    @param W         text width in pixels
  1.1503 +    @param J         justification. ELayoutAlignNone; ELayoutAlignCenter; ELayoutAlignLeft; ELayoutAlignRight; ELayoutAlignBidi
  1.1504 +    @param NextLineB baseline of 2nd line for multi-line labels/editors
  1.1505 +    @param aCustomFont   a font used, if resource file uses EFontCustom
  1.1506 +     */
  1.1507 +    IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
  1.1508 +                                     const TRect& aLabelParent,
  1.1509 +                                     TInt font, TInt C,
  1.1510 +                                     TInt l, TInt r,
  1.1511 +                                     TInt B, TInt W,
  1.1512 +                                     TInt J, TInt NextLineB=0,
  1.1513 +                                     const CFont* aCustomFont=0);
  1.1514 +
  1.1515 +    /**
  1.1516 +    * Deprecated! Do not use!
  1.1517 +    */
  1.1518 +    IMPORT_C static void LayoutEdwin(CEikEdwin* aEdwin,
  1.1519 +                                     const TRect& aEdwinParent,
  1.1520 +                                     TInt aResourceId,
  1.1521 +                                     TInt aNumberOfLines = 0,
  1.1522 +                                     const CFont* aCustomFont=0,
  1.1523 +                                     TBool aMinimizeEdwinView=EFalse);
  1.1524 +    /**
  1.1525 +    * Deprecated! Do not use!
  1.1526 +    */
  1.1527 +    IMPORT_C static void LayoutEdwin(CEikEdwin* aEdwin,
  1.1528 +                                     const TRect& aEdwinParent,
  1.1529 +                                     TResourceReader& aReader,
  1.1530 +                                     TInt aNumberOfLines = 0,
  1.1531 +                                     const CFont* aCustomFont=0,
  1.1532 +                                     TBool aMinimizeEdwinView=EFalse);
  1.1533 +
  1.1534 +    /** Layouts an editor via a structure of layout parameters
  1.1535 +    @param aLayout   the structure
  1.1536 +     */
  1.1537 +    IMPORT_C static void LayoutEdwin(CEikEdwin* aEdwin,
  1.1538 +                                     const TRect& aEdwinParent,
  1.1539 +                                     const SAknLayoutEdwin& aLayout,
  1.1540 +                                     const CFont* aCustomFont=0,
  1.1541 +                                     TBool aMinimizeEdwinView=EFalse);
  1.1542 +
  1.1543 +    /** Layouts an editor via a structure of layout parameters
  1.1544 +    @param aLayout   the structure
  1.1545 +     */
  1.1546 +
  1.1547 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1548 +                                      const TRect& aEdwinParent,
  1.1549 +                                      const TAknMultiLineTextLayout& aLayout,
  1.1550 +                                      const CFont* aCustomFont=0,
  1.1551 +                                      TBool aMinimizeEdwinView=EFalse);
  1.1552 +
  1.1553 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1554 +                                      const TRect& aEdwinParent,
  1.1555 +                                      const TAknMultiLineTextLayout& aLayout,
  1.1556 +                                      TAknsQsnTextColorsIndex aOverrideColor,
  1.1557 +                                      const CFont* aCustomFont=0,
  1.1558 +                                      TBool aMinimizeEdwinView=EFalse ); 
  1.1559 +        
  1.1560 +
  1.1561 +
  1.1562 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1563 +                                      const TRect& aEdwinParent,
  1.1564 +                                      const TAknTextLineLayout& aLayout,
  1.1565 +                                      const CFont* aCustomFont=0,
  1.1566 +                                      TBool aMinimizeEdwinView=EFalse );
  1.1567 +
  1.1568 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1569 +                                      const TRect& aEdwinParent,
  1.1570 +                                      const TAknTextLineLayout& aLayout,
  1.1571 +                                      TAknsQsnTextColorsIndex aOverrideColor,
  1.1572 +                                      const CFont* aCustomFont=0,
  1.1573 +                                      TBool aMinimizeEdwinView=EFalse );
  1.1574 +
  1.1575 +    /** 
  1.1576 +    * Routine to perform standard layout of a CEikEdwin editor.  Two elements from the S60 layout data are required: 
  1.1577 +    * The rectangle of the containing layout element, and the TAknTextLineLayout object created for the contained text pane element. 
  1.1578 +    * 
  1.1579 +    * Override parameters can be supplied for a different number of lines, a different baseline separation,
  1.1580 +    * or substituted skin color. Various "Do Not Override" values are to be passed if the values passed in aLayout are to be used. 
  1.1581 +    * Refer to the parameters' documentation.
  1.1582 +    * 
  1.1583 +    * The lower extent of the editor to be laid out (whether driven by the NumberOfLinesToShow() 
  1.1584 +    * feature of the TAknTextLineLayout object, or overridden by aNumberOfLinesToShowOverRide)
  1.1585 +    * will not extend below the lower limit of the rectangle aEdwinParent.  Thus the number of
  1.1586 +    * lines formatted is limited, and is available as an output parameter.
  1.1587 +    * 
  1.1588 +    * The height of the editor is also restricted by any value previously set in 
  1.1589 +    * CEikEdwin::SetMaximumHeightInLines().
  1.1590 +    * 
  1.1591 +    * @since 3.1 
  1.1592 +    * 
  1.1593 +    * @param aEdwin          pointer to the editor to be laid out 
  1.1594 +    * @param aEdwinParent    rectangle of the containing layout element 
  1.1595 +    * @param aLayout         object representing the layout of the text pane implemented by this editor 
  1.1596 +    * @param aNumberOfLinesToShowOverride  number of lines overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
  1.1597 +    * @param aBaselineSeparationOverride   vertical separation of baselines overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
  1.1598 +    * @param aOverrideColor      Avkon Skins color index to override with, if 
  1.1599 +    *                            not (TAknsQsnTextColorsIndex)KAknLayoutUtilsDoNotOverride 
  1.1600 +    * @param aNumberOfVisibleLines  Number of lines of editor actually laid out.
  1.1601 +    */ 
  1.1602 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1603 +                         const TRect& aEdwinParent,
  1.1604 +                         const TAknTextLineLayout& aLayout,
  1.1605 +                         TInt aNumberOfLinesToShowOverRide,
  1.1606 +                         TInt aBaselineSeparationOverRide,
  1.1607 +                         TAknsQsnTextColorsIndex aOverrideColor, 
  1.1608 +                         TInt& aNumberOfVisibleLines );
  1.1609 +                                 
  1.1610 +    /** Layouts an editor via parameters from the specification
  1.1611 +    @param aLayout   a define from aknlayout.lag file
  1.1612 +    @param font      font id, ELatinPlain12, ELatinBold12, ELatinBold13, ELatinBold17, ELatinBold19 etc..
  1.1613 +    @param C         colour index, 0..255
  1.1614 +    @param l         left margin
  1.1615 +    @param r         right margin
  1.1616 +    @param B         Baseline from top of the parent rectangle
  1.1617 +    @param W         text width in pixels
  1.1618 +    @param J         justification. ELayoutAlignNone; ELayoutAlignCenter; ELayoutAlignLeft; ELayoutAlignRight; ELayoutAlignBidi
  1.1619 +    @param aNumberOfLinesShown number of lines visible for the editor
  1.1620 +    @param NextLineB baseline of 2nd line for multi-line labels/editors
  1.1621 +    @param aMinimizeEdwinView whether to use minimum size. You need to use MinimizedEdwinRect() if you use ETrue here.
  1.1622 +     */
  1.1623 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1624 +                                      const TRect& aEdwinParent,
  1.1625 +                                      TInt font,
  1.1626 +                                      TInt C,
  1.1627 +                                      TInt l,
  1.1628 +                                      TInt r,
  1.1629 +                                      TInt B,
  1.1630 +                                      TInt W,
  1.1631 +                                      TInt J,
  1.1632 +                                      TInt aNumberOfLinesShown,
  1.1633 +                                      TInt aNextLineBaseline,
  1.1634 +                                      const CFont* aCustomFont=0 ,
  1.1635 +                                      TBool aMinimizeEdwinView=EFalse );
  1.1636 +
  1.1637 +    IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
  1.1638 +                                      const TRect& aEdwinParent,
  1.1639 +                                      TInt font,
  1.1640 +                                      TInt C,
  1.1641 +                                      TInt l,
  1.1642 +                                      TInt r,
  1.1643 +                                      TInt B,
  1.1644 +                                      TInt W,
  1.1645 +                                      TInt J,
  1.1646 +                                      TInt aNumberOfLinesShown,
  1.1647 +                                      TInt aNextLineBaseline,
  1.1648 +                                      TAknsQsnTextColorsIndex aOverrideColor,
  1.1649 +                                      const CFont* aCustomFont=0 ,
  1.1650 +                                      TBool aMinimizeEdwinView=EFalse );
  1.1651 +    /** Use this, if you give aMinimizeEdwinView to LayoutEdwin as true.
  1.1652 +     * The edwin will not draw the whole rectangle allocated for the control.
  1.1653 +     */
  1.1654 +    IMPORT_C static TRect MinimizedEdwinRect(const CEikEdwin *aEdwin);
  1.1655 +
  1.1656 +
  1.1657 +    /**
  1.1658 +    * Deprecated! Do not use!
  1.1659 +    */
  1.1660 +    IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
  1.1661 +                                    const TRect& aMfneParent,
  1.1662 +                                    TInt aResourceId);
  1.1663 +    /**
  1.1664 +    * Deprecated! Do not use!
  1.1665 +    */
  1.1666 +    IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
  1.1667 +                                    const TRect& aMfneParent,
  1.1668 +                                    TResourceReader& aReader);
  1.1669 +
  1.1670 +    IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
  1.1671 +                                    const TRect& aMfneParent,
  1.1672 +                                    const SAknLayoutMfne& aLayout);
  1.1673 +
  1.1674 +    IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
  1.1675 +                                    const TRect& aMfneParent,
  1.1676 +                                    const TAknTextLineLayout& aLayout);
  1.1677 +
  1.1678 +    IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
  1.1679 +                                    const TRect& aMfneParent,
  1.1680 +                                    TInt font, TInt C, TInt l, TInt r,
  1.1681 +                                    TInt B, TInt W, TInt J);
  1.1682 +
  1.1683 +    /**
  1.1684 +    * Deprecated! Do not use!
  1.1685 +    */
  1.1686 +    IMPORT_C static void LayoutControl(CCoeControl* aControl, 
  1.1687 +                                       const TRect& aControlParent,
  1.1688 +                                       TInt aResourceId);
  1.1689 +    /**
  1.1690 +    * Deprecated! Do not use!
  1.1691 +    */
  1.1692 +    IMPORT_C static void LayoutControl(CCoeControl* aControl,
  1.1693 +                                       const TRect& aControlParent,
  1.1694 +                                       TResourceReader& aReader);
  1.1695 +
  1.1696 +    IMPORT_C static void LayoutControl(CCoeControl* aControl,
  1.1697 +                                       const TRect& aControlParent,
  1.1698 +                                       const SAknLayoutControl& aLayout);
  1.1699 +
  1.1700 +    IMPORT_C static void LayoutControl(CCoeControl* aControl, 
  1.1701 +                                       const TRect& aControlParent,
  1.1702 +                                       const TAknWindowLineLayout& aLayout);
  1.1703 +
  1.1704 +    IMPORT_C static void LayoutControl(CCoeControl* aControl,
  1.1705 +                                       const TRect& aControlParent,
  1.1706 +                                       TInt /*C*/, TInt l, TInt t, TInt r, TInt b,
  1.1707 +                                       TInt W, TInt H);
  1.1708 +
  1.1709 +    /**
  1.1710 +    * Deprecated! Do not use!
  1.1711 +    */
  1.1712 +    IMPORT_C static void LayoutImage(CEikImage* aImage,
  1.1713 +                                     const TRect& aParent,
  1.1714 +                                     TInt aResourceId);
  1.1715 +    /**
  1.1716 +    * Deprecated! Do not use!
  1.1717 +    */    
  1.1718 +    IMPORT_C static void LayoutImage(CEikImage* aImage, 
  1.1719 +                                     const TRect& aParent,
  1.1720 +                                     TResourceReader& aReader);
  1.1721 +
  1.1722 +    IMPORT_C static void LayoutImage(CEikImage* aImage, 
  1.1723 +                                     const TRect& aParent,
  1.1724 +                                     const SAknLayoutControl& aLayout);
  1.1725 +
  1.1726 +    IMPORT_C static void LayoutImage(CEikImage* aImage,
  1.1727 +                                     const TRect& aParent,
  1.1728 +                                     const TAknWindowLineLayout& aLayout);
  1.1729 +
  1.1730 +    IMPORT_C static void LayoutImage(CEikImage* aImage,
  1.1731 +                                     const TRect& aParent,
  1.1732 +                                     TInt C, TInt l, TInt t, TInt r, TInt b,
  1.1733 +                                     TInt W, TInt H);
  1.1734 +
  1.1735 +    /** Sets CEikSecretEditor's position, colors and fonts based on LAF specification
  1.1736 +     *
  1.1737 +     */
  1.1738 +    IMPORT_C static void LayoutSecretEditor(CEikSecretEditor* aSecEd,
  1.1739 +                                            const TRect& aParent,
  1.1740 +                                            const SAknLayoutText& aLayout);
  1.1741 +
  1.1742 +    IMPORT_C static void LayoutSecretEditor(CEikSecretEditor* aSecEd,
  1.1743 +                                            const TRect& aParent,
  1.1744 +                                            const TAknTextLineLayout& aLayout);
  1.1745 +
  1.1746 +public:
  1.1747 +    /** Different conversions
  1.1748 +     * Fonts: ELatinPlain12, ELatinBold12, ELatinBold13, ELatinBold17, ELatinBold19, ENumberPlain5, EClockBold30, ELatinClock14, EFontCustom
  1.1749 +     *        EAknLogicalFontPrimaryFont, EAknLogicalFontSecondaryFont, EAknLogicalFontTitleFont,
  1.1750 +     * Alignments: ELayoutAlignNone, ELayoutAlignCenter, ELayoutAlignLeft, ELayoutAlignRight, ELayoutAlignBidi with these..
  1.1751 +     */
  1.1752 +    IMPORT_C static TRect TextRectFromCoords(const TRect& aParent,
  1.1753 +                                             const CFont* aFont,
  1.1754 +                                             TInt l, TInt r,
  1.1755 +                                             TInt B, TInt W,
  1.1756 +                                             TInt LB = 0);
  1.1757 +
  1.1758 +    IMPORT_C static TRect RectFromCoords(const TRect& aParent,
  1.1759 +                                         TInt l, TInt t, TInt r, TInt b,
  1.1760 +                                         TInt W, TInt H);
  1.1761 +
  1.1762 +    /**
  1.1763 +    * Method to return a useable system font reference from a S60 font enumeration from among
  1.1764 +    * the supported list.
  1.1765 +    * 
  1.1766 +    * This method should only be used if application code needs to render its own graphics. That is, it
  1.1767 +    * is not using S60 controls and furthermore not using the recommended methods 
  1.1768 +    * AknLayoutUtils::LayoutEdwin(), AknLayoutUtils::LayoutLabel() or AknLayoutUtils::LayoutSecretEditor(). 
  1.1769 +    * 
  1.1770 +    * Fonts returned by this are not recommended to be stored in clients' member data, but should be
  1.1771 +    * accessed when they are required for use.
  1.1772 +    *
  1.1773 +    * Applications that are written to run with their layout dynamically adapting to different screen sizes 
  1.1774 +    * should use only the values found in the S60 logical font enumeration, TAknLogicalFontId.
  1.1775 +    * 
  1.1776 +    * @param aFontId        Input S60 font id.
  1.1777 +    * @param aCustomFont    Font to return if aFontId is given as EFontCustom
  1.1778 +    * @return               const pointer to a system font, or aCustomFont
  1.1779 +    */
  1.1780 +    IMPORT_C static const CFont* FontFromId(TInt aFontId, const CFont* aCustomFont=0);
  1.1781 +
  1.1782 +    /**
  1.1783 +    * Method to return a system font reference from a S60 font id. This will always conform to type CAknLayoutFont
  1.1784 +    * 
  1.1785 +    * This method should only be used if application code needs to render its own graphics. That is, it
  1.1786 +    * is not using S60 controls and furthermore not using the recommended methods 
  1.1787 +    * AknLayoutUtils::LayoutEdwin(), AknLayoutUtils::LayoutLabel() or AknLayoutUtils::LayoutSecretEditor(). 
  1.1788 +    * 
  1.1789 +    * Fonts returned by this are not recommended to be stored in clients' member data, but should be
  1.1790 +    * accessed when they are required for use.
  1.1791 +    *
  1.1792 +    * Applications that are written to run with their layout dynamically adapting to different screen sizes 
  1.1793 +    * should use only the values found in the S60 logical font enumeration, TAknLogicalFontId.
  1.1794 +    * 
  1.1795 +    * @param aFontId        Input S60 font id.
  1.1796 +    * @param aCustomFont    Font to return if aFontId is given as EFontCustom
  1.1797 +    * @return               const pointer to a system font, or aCustomFont
  1.1798 +    */
  1.1799 +    IMPORT_C static const CAknLayoutFont* LayoutFontFromId(TInt aId, 
  1.1800 +                                                           const CAknLayoutFont *aCustomFont = 0);
  1.1801 +
  1.1802 +    /**
  1.1803 +    * Return a fully constructed CAknLayoutFont object based upon the specification passed in.
  1.1804 +    * The Avkon font specifiation object uses TAknFontCategory to determine the font. 
  1.1805 +    *
  1.1806 +    * The font object is returned as non-const, since it is owned and will eventually be deleted by the client.
  1.1807 +    * 
  1.1808 +    * @param aSpec     S60 font specification object
  1.1809 +    * @return               pointer to a CAknLayoutFont object, owned by the caller
  1.1810 +    */
  1.1811 +    IMPORT_C static CAknLayoutFont* CreateLayoutFontFromSpecificationL( 
  1.1812 +        const TAknFontSpecification& aSpec );
  1.1813 +
  1.1814 +    /**
  1.1815 +    * Return a fully constructed CAknLayoutFont object based upon the typeface and specification passed in.
  1.1816 +    * The TTypeface object contains a typeface name that is used as the primary key to select a font.  
  1.1817 +    * The S60  font specifiation object is also used, but any value of TAknFontCategory passed in is reset to 
  1.1818 +    * EAknFontCategoryUndefined, and is not used to select the font. 
  1.1819 +    *
  1.1820 +    * The font object is returned as non-const, since it is owned and will eventually be deleted by the client.
  1.1821 +    * 
  1.1822 +    * @param aTypeface      Symbian Typface object
  1.1823 +    * @param aSpec             S60 font specification object
  1.1824 +    * @return                       pointer to a CAknLayoutFont object, owned by the caller
  1.1825 +    */
  1.1826 +    IMPORT_C static CAknLayoutFont* CreateLayoutFontFromSpecificationL( 
  1.1827 +        const TTypeface& aTypeface, 
  1.1828 +        const TAknFontSpecification& aSpec);
  1.1829 +
  1.1830 +    /**
  1.1831 +    * Deprecated! Do not use!
  1.1832 +    */
  1.1833 +    IMPORT_C static const CFont* FontFromName(const TDesC& aName); 
  1.1834 +
  1.1835 +    IMPORT_C static CGraphicsContext::TTextAlign TextAlignFromId(TInt aId);
  1.1836 +
  1.1837 +    IMPORT_C static TGulAlignment GulAlignFromId(TInt aId);
  1.1838 +
  1.1839 +    IMPORT_C static TInt CursorHeightFromFont(const TFontSpec& aFont);
  1.1840 +
  1.1841 +    IMPORT_C static TInt CursorWidthFromFont (const TFontSpec& aFont);
  1.1842 +
  1.1843 +    IMPORT_C static TInt CursorAscentFromFont(const TFontSpec& aFont);
  1.1844 +
  1.1845 +    IMPORT_C static void CursorExtensionsFromFont(const TFontSpec& /*aFont*/,
  1.1846 +                                                  TInt& aFirstExtension,
  1.1847 +                                                  TInt& aSecondExtension);
  1.1848 +
  1.1849 +    IMPORT_C static TInt HighlightLeftPixelsFromFont (const TFontSpec& aFont);
  1.1850 +
  1.1851 +    IMPORT_C static TInt HighlightRightPixelsFromFont(const TFontSpec& aFont);
  1.1852 +    static void HighlightExtensionsFromFont(const TInt fontid,
  1.1853 +                                            TInt& aLeft, TInt& aRight,
  1.1854 +                                            TInt&  aTop, TInt& aBottom);
  1.1855 +
  1.1856 +    /**
  1.1857 +    * Access the system font array to see if there is a font that matches the  
  1.1858 +    * font specification presented in Twips. Device map is also passed in case the 
  1.1859 +    * system font array has fonts from different devices.
  1.1860 +    * 
  1.1861 +    * A null return value means that the system font array is not constructed yet, or does
  1.1862 +    * not contain a font that has the same TFontSpec or device map.
  1.1863 +    *
  1.1864 +    * @param aSpec  Symbian font specification object to match
  1.1865 +    * @param aMap   Device map to disambiguate fonts on different devices
  1.1866 +    * @return       NULL if no match was found; otherwise a CAknLayoutFont pointer
  1.1867 +    **/
  1.1868 +    static const CAknLayoutFont* MatchFontFromSystemFontArray( 
  1.1869 +        const TFontSpec& aSpec, MGraphicsDeviceMap* aMap );
  1.1870 +
  1.1871 +    IMPORT_C static TBool LayoutMirrored();
  1.1872 +
  1.1873 +    /*
  1.1874 +    * This method returns build variant based on which flag is active,
  1.1875 +    * __AVKON_ELAF__ or __AVKON_APAC__.
  1.1876 +    *
  1.1877 +    * If you need to decide which layout to use, do not do it based on this method.
  1.1878 +    * Instead, use CAknEnv::GetCurrentLayoutId().
  1.1879 +    *
  1.1880 +    * @return current variant
  1.1881 +    */
  1.1882 +    IMPORT_C static EVariantFlag Variant();
  1.1883 +
  1.1884 +    IMPORT_C static ESubVariantFlag SubVariant();
  1.1885 +
  1.1886 +    IMPORT_C static void OverrideControlColorL(
  1.1887 +        CCoeControl& aControl,
  1.1888 +        TLogicalColor aLogicalColor,
  1.1889 +        TRgb aColor);
  1.1890 +    
  1.1891 +    /*
  1.1892 +    * This method returns the default scrollbar type for the given application. 
  1.1893 +    * For non-layout aware applications (e.g. legacy apps designed for 176x208 screen) 
  1.1894 +    * this method returns always EArrowHead. But for layout aware apps the returned type 
  1.1895 +    * may vary depending on the type of scrollbar which has been set as preferred 
  1.1896 +    * scrollbar type in the device.
  1.1897 +    *
  1.1898 +    * Note that applications may use freely whatever scrollbartype, this method only 
  1.1899 +    * returns the default scrollbartype for the application.
  1.1900 +    * 
  1.1901 +    * @since  2.6
  1.1902 +    * @param  aApplication Application of which default scrollbar type is requested.
  1.1903 +    * @return Default scrollbar type for the given application
  1.1904 +    */
  1.1905 +    IMPORT_C static CEikScrollBarFrame::TScrollBarType DefaultScrollBarType(CAknAppUiBase* aApplication);
  1.1906 +
  1.1907 +    /*
  1.1908 +    * This method sets the layout for vertical scrollbar of the given scrollbar frame. Layout
  1.1909 +    * can freely only be set for EDoubleSpan type scrollbars.
  1.1910 +    * 
  1.1911 +    * @since  2.6
  1.1912 +    * @param  aScrollBarFrame   Scrollbarframe of which vertical scrollbar layout will be set.
  1.1913 +    * @param  aControlParent    Rect of the parent control of the scrollbarframe.
  1.1914 +    * @param  aLayout           Layout for the vertical scrollbar.
  1.1915 +    *
  1.1916 +    *
  1.1917 +    * This method can also be useful when layout of the scrollbar needs to be changed for scrollbars
  1.1918 +    * which are owned by some other components such as e.g. ListBoxes, Editors or Grids.
  1.1919 +    *
  1.1920 +    * Example of use:
  1.1921 +    *
  1.1922 +    *  // Get a pointer to scrollbarframe of the listbox
  1.1923 +    *  CEikScrollBarFrame* frame = iListBox->ScrollBar();
  1.1924 +    *  
  1.1925 +    *  // Get the layout data
  1.1926 +    *  TAknWindowLineLayout layout = GetMyListBoxLayout();
  1.1927 +    *  Trect parentRect = GetMyListBoxParentRect();
  1.1928 +    *
  1.1929 +    *  // Set the layout
  1.1930 +    *  AknLayoutUtils::LayoutVerticalScrollBar(frame, parentRect, layout);
  1.1931 +    *
  1.1932 +    *  // The layout for scrollbar is now set.
  1.1933 +    *
  1.1934 +    */
  1.1935 +    IMPORT_C static void LayoutVerticalScrollBar(
  1.1936 +        CEikScrollBarFrame* aScrollBarFrame,
  1.1937 +        const TRect& aControlParent,
  1.1938 +        const TAknWindowLineLayout& aLayout);
  1.1939 +
  1.1940 +    /*
  1.1941 +    * This method sets the layout for horizontal scrollbar of the given scrollbar frame. Layout
  1.1942 +    * can freely only be set for EDoubleSpan type scrollbars.
  1.1943 +    * 
  1.1944 +    * @since  2.6
  1.1945 +    * @param  aScrollBarFrame   Scrollbarframe of which horizontal scrollbar layout will be set.
  1.1946 +    * @param  aControlParent    Rect of the parent control of the scrollbarframe.
  1.1947 +    * @param  aLayout           Layout for the horizontal scrollbar.
  1.1948 +    *
  1.1949 +    *
  1.1950 +    * Usage of this method is similar as for LayoutVerticalScrollBar().
  1.1951 +    *
  1.1952 +    */
  1.1953 +    IMPORT_C static void LayoutHorizontalScrollBar(
  1.1954 +        CEikScrollBarFrame* aScrollBarFrame,
  1.1955 +        const TRect& aControlParent,
  1.1956 +        const TAknWindowLineLayout& aLayout);
  1.1957 +
  1.1958 +public:   // Metrics API
  1.1959 +
  1.1960 +    /**
  1.1961 +    * Layout Metrics.
  1.1962 +    */
  1.1963 +    enum TAknLayoutMetrics
  1.1964 +    {
  1.1965 +        /** Screen. */
  1.1966 +        EScreen,
  1.1967 +        
  1.1968 +        /** Window that fills the entire screen. */
  1.1969 +        EApplicationWindow,
  1.1970 +        
  1.1971 +        /** Indicates common components for most of the applications. */
  1.1972 +        EStatusPane,
  1.1973 +        
  1.1974 +        /** The application main pane is used in all the applications */
  1.1975 +        EMainPane,
  1.1976 +        
  1.1977 +        /** Control pane. */
  1.1978 +        EControlPane,   
  1.1979 +        
  1.1980 +        /** The signal pane is used to indicate signal strength. */
  1.1981 +        ESignalPane,
  1.1982 +        
  1.1983 +        /** The context pane is used to indicate an active application. */
  1.1984 +        EContextPane,
  1.1985 +        
  1.1986 +        /** Used to indicate the subject or the name of the main pane content.*/
  1.1987 +        ETitlePane,
  1.1988 +        
  1.1989 +        /** The battery pane is used to indicate battery strength. */
  1.1990 +        EBatteryPane,
  1.1991 +        
  1.1992 +        /** 
  1.1993 +         * The universal indicator pane is used to indicate items that require
  1.1994 +         * the user's attention while browsing applications.
  1.1995 +         */
  1.1996 +        EUniversalIndicatorPane,
  1.1997 +        
  1.1998 +        /** 
  1.1999 +         * The navi pane is used to indicate navigation within an application,
  1.2000 +         * to provide context sensitive information to the user while entering
  1.2001 +         * or editing data, or to show additional information.
  1.2002 +         */
  1.2003 +        ENaviPane,
  1.2004 +        
  1.2005 +        /** 
  1.2006 +         * A fixed find pane is used with lists instead of the find pop-up
  1.2007 +         * window. */
  1.2008 +        EFindPane,
  1.2009 +        
  1.2010 +        /** Wallpaper pane. */
  1.2011 +        EWallpaperPane,
  1.2012 +        
  1.2013 +        /** 
  1.2014 +         * The universal indicator pane is used to indicate items that require
  1.2015 +         * the user's attention while browsing applications.
  1.2016 +         */
  1.2017 +        EIndicatorPane,
  1.2018 +        
  1.2019 +        /** Used generally to display small sized graphics or heading texts. */
  1.2020 +        EAColunm,
  1.2021 +        
  1.2022 +        /** Used generally to display large sized icons or heading texts. */
  1.2023 +        EBColunm,
  1.2024 +        
  1.2025 +        /** 
  1.2026 +         * Used generally to display data entered by the user. Overlaps with
  1.2027 +         * the D column.
  1.2028 +         */
  1.2029 +        ECColunm,
  1.2030 +        
  1.2031 +        /** 
  1.2032 +         * Used generally to display additional icons. Overlaps with
  1.2033 +         * the C column.
  1.2034 +         */
  1.2035 +        EDColunm,
  1.2036 +        
  1.2037 +        /** @deprecated, do not use */
  1.2038 +        EStatusPaneSecondary,
  1.2039 +        
  1.2040 +        /** deprecated, do not use */
  1.2041 +        EControlPaneSecondary,
  1.2042 +        
  1.2043 +        /** Top part of status and control panes in landscape layout. */
  1.2044 +        EStaconTop,
  1.2045 +        
  1.2046 +        /** Bottom part of status and control panes in landscape layout. */
  1.2047 +        EStaconBottom,
  1.2048 +
  1.2049 +        /** */
  1.2050 +        EPopupParent,
  1.2051 +        
  1.2052 +        /** Bottom part of status pane in landscape layout. */
  1.2053 +        EStatusPaneBottom = EStatusPaneSecondary,
  1.2054 +        
  1.2055 +        /** Bottom part of control pane in landscape layout. */
  1.2056 +        EControlPaneBottom = EControlPaneSecondary,
  1.2057 +        
  1.2058 +        /** Top part of control pane in landscape layout. */
  1.2059 +        EControlPaneTop = EControlPane,
  1.2060 +        
  1.2061 +        /** Top part of status pane in landscape layout. */
  1.2062 +        EStatusPaneTop = EStatusPane
  1.2063 +    };
  1.2064 +
  1.2065 +
  1.2066 +    /**
  1.2067 +    * Fills given TRect with rectangle for given layout component. 
  1.2068 +    * Returns EFalse for status pane descendants if requested
  1.2069 +    * layout component is not available in current layout. For
  1.2070 +    * other components returns always ETrue (returned rectangle is
  1.2071 +    * from layout definition).
  1.2072 +    *
  1.2073 +    * @since  2.8
  1.2074 +    * @param  aParam   Layout component to be queried. 
  1.2075 +    * @param  aRect    Resulting rectangle.
  1.2076 +    * @param  ETrue    If requested value was available.
  1.2077 +    *         EFalse   Otherwise.
  1.2078 +    */
  1.2079 +    IMPORT_C static TBool LayoutMetricsRect(TAknLayoutMetrics aParam, TRect& aRect);
  1.2080 +
  1.2081 +    /**
  1.2082 +    * This method returns size of rectangle for given layout component.
  1.2083 +    * Returns EFalse for status pane descendants if requested
  1.2084 +    * layout component is not available in current layout. For
  1.2085 +    * other components returns always ETrue (returned size is
  1.2086 +    * from layout definition).
  1.2087 +    *
  1.2088 +    * @since  2.8
  1.2089 +    * @param  aParam   Layout component to be queried. 
  1.2090 +    * @param  aSize    Resulting size.
  1.2091 +    * @param  ETrue    If requested value was available.
  1.2092 +    *         EFalse   Otherwise.
  1.2093 +    */
  1.2094 +    IMPORT_C static TBool LayoutMetricsSize(TAknLayoutMetrics aParam, TSize& aSize);
  1.2095 +
  1.2096 +    /**
  1.2097 +    * This method returns position of top left corner for given layout component.
  1.2098 +    * Returns EFalse for status pane descendants if requested
  1.2099 +    * layout component is not available in current layout. For
  1.2100 +    * other components returns always ETrue (returned position is
  1.2101 +    * from layout definition).
  1.2102 +    *
  1.2103 +    * @since  2.8
  1.2104 +    * @param  aParam   Layout component to be queried. 
  1.2105 +    * @param  aPos     Resulting position.
  1.2106 +    * @param  ETrue    If requested value was available.
  1.2107 +    *         EFalse   Otherwise.
  1.2108 +    */
  1.2109 +    IMPORT_C static TBool LayoutMetricsPosition(TAknLayoutMetrics aParan, TPoint& aPos);
  1.2110 +public:
  1.2111 +    /**
  1.2112 +    * This method returns a new value for a baseline, based upon a value for bottom and 
  1.2113 +    * a value for height. For legacy layout data, the baseline will be correct, and this
  1.2114 +    * method will detect that it is a legacy font id and just return aBottom. 
  1.2115 +    * However, for scalable layout data, the bottom value will be hidden inside 
  1.2116 +    * the old baseline variable, so call this method passing in 'iB', NOT passing in 'ib'
  1.2117 +    * ... e.g.: (the following line is an example, so is ok to have commented out code)
  1.2118 +    * TInt newbaseline = CorrectBaseline(myLayoutLine.iB, myLayoutLine.iFont);
  1.2119 +    *
  1.2120 +    * @since  2.8
  1.2121 +    * @param  aBottom  Baseline or Bottom value of text pane (found in TAknTextLineLayout.iB)
  1.2122 +    * @param  aFontId     FontId of text pane (for scalable layouts, this will encode the height)
  1.2123 +    * @return   new Baseline value
  1.2124 +    */
  1.2125 +    static TInt CorrectBaseline(TInt aParentHeight, TInt aBaseline, TInt aFontId);
  1.2126 +
  1.2127 +    /**
  1.2128 +    * This method updates fontid if it has ELayoutEmpty or parent relative values
  1.2129 +    */
  1.2130 +    static void CorrectFontId(TRect aParent, TInt at, TInt aH, TInt ab, TInt &aFontId);
  1.2131 +
  1.2132 +    /**
  1.2133 +    * This method tells if the scalable layout interface is available.
  1.2134 +    * 
  1.2135 +    * @internal
  1.2136 +    * @return ETrue if scalable layout interface can be used, otherwise EFalse.
  1.2137 +    */
  1.2138 +    IMPORT_C static TBool ScalableLayoutInterfaceAvailable();
  1.2139 +    
  1.2140 +    /*
  1.2141 +    * Enumeration of CBA's possible locations.
  1.2142 +    * @since 3.0
  1.2143 +    */
  1.2144 +    enum TAknCbaLocation
  1.2145 +        {
  1.2146 +        EAknCbaLocationBottom, //landscape and portrait
  1.2147 +        EAknCbaLocationRight,  //only landscape
  1.2148 +        EAknCbaLocationLeft    //only landscape
  1.2149 +        };
  1.2150 +    
  1.2151 +    /**
  1.2152 +    * This method tells location of softkeys (CBA) field in current running application. 
  1.2153 +    * Possible location of softkeys are bottom (portrait and landscape), left and right 
  1.2154 +    * (only landscape).
  1.2155 +    *
  1.2156 +    * @since 3.0
  1.2157 +    * @return TAknCbaLocation
  1.2158 +    */
  1.2159 +    IMPORT_C static TAknCbaLocation CbaLocation();
  1.2160 +
  1.2161 +    /**
  1.2162 +    * Used by pop-ups to align themselves around the given highlighted area.
  1.2163 +    * @param aHighlightRect Highlighted area.
  1.2164 +    * @param aControl Control whose position should be calculated,
  1.2165 +    * @return TRect Size and position of pop-up.
  1.2166 +    */
  1.2167 +    static TRect HighlightBasedRect( const TRect& aHighlightRect, CCoeControl* aControl );
  1.2168 +
  1.2169 +    /**
  1.2170 +     * Flags for main_pane status
  1.2171 +     */
  1.2172 +    enum TAknMainPaneState 
  1.2173 +        {
  1.2174 +        EAknMainPaneForTinyStatusPane = 0x0001  // for 3x4 grid or app shell list views
  1.2175 +        };
  1.2176 +    IMPORT_C static TAknMainPaneState MainPaneState();
  1.2177 +
  1.2178 +    /**
  1.2179 +    * This method can be used to check whether pen support is enabled.
  1.2180 +    * @return ETrue if pen support is enabled, otherwise EFalse.
  1.2181 +    */
  1.2182 +    IMPORT_C static TBool PenEnabled();
  1.2183 +    
  1.2184 +    /**
  1.2185 +    * This method can be used to check whether MSK support is enabled.
  1.2186 +    * @return ETrue if MSK support is enabled, otherwise EFalse.
  1.2187 +    */
  1.2188 +    IMPORT_C static TBool MSKEnabled();
  1.2189 +
  1.2190 +    /**
  1.2191 +    * Utility method to be used along side LayoutEdwin methods that take number of lines or 
  1.2192 +    * baseline separation overrides. 
  1.2193 +    * 
  1.2194 +    * This routine returns the edwin height in pixels required to fit exactly the passed-in layout,
  1.2195 +    * or the layout with overridden baseline separation and/or number of lines.
  1.2196 +    * 
  1.2197 +    * The vertical position of the editor is also returned. Note that the correct
  1.2198 +    * height of the parent layout item is needed in order for this to be calculated properly.
  1.2199 +    *
  1.2200 +    * Note that this API does not cause a layout of the editor.
  1.2201 +    * 
  1.2202 +    * @since 3.1
  1.2203 +    *
  1.2204 +    * @param aParentHeight  Height of the parent layout item
  1.2205 +    * @param aLayout        S60 layout object for the text to be laid out in the editor
  1.2206 +    * @param aBaselineSeparationOverride   vertical separation of baselines overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
  1.2207 +    *                                       aLayout, if not KAknLayoutUtilsDoNotOverride 
  1.2208 +    * @param aNumberOfLinesToShowOverride   number of lines overriding aLayout, 
  1.2209 +    *                                       if not KAknLayoutUtilsDoNotOverride 
  1.2210 +    * @param aEdwinVerticalPositionRelativeToParent     Returns the vertical postion of the editor 
  1.2211 +    *                                                   relative to its parent when laid out.
  1.2212 +    * @param aEdwinHeight   The height required in pixels to fit the required number of laid 
  1.2213 +    *                       out lines plus highlights.
  1.2214 +    */
  1.2215 +    IMPORT_C static void GetEdwinVerticalPositionAndHeightFromLines(
  1.2216 +        TInt aParentHeight,
  1.2217 +        const TAknTextLineLayout& aLayout,
  1.2218 +        TInt aBaselineSeparationOverRide,
  1.2219 +        TInt aNumberOfLinesToShowOverRide,
  1.2220 +        TInt& aEdwinVerticalPositionRelativeToParent,
  1.2221 +        TInt& aEdwinHeight
  1.2222 +        );
  1.2223 +       
  1.2224 +    /**
  1.2225 +    * Utility routine to give the number of text lines that will completely fit, 
  1.2226 +    * including room for highlights, within the given height, when the passed in layout is
  1.2227 +    * being used. 
  1.2228 +    *
  1.2229 +    * Note that the NumberOfLinesShown() value from the TAknTextLineLayout object is not taken into
  1.2230 +    * consideration. This routine ignores it, and returns number of lines based upon the font metrics,
  1.2231 +    * hightlight specification, and the passed in maximum height.
  1.2232 +    * 
  1.2233 +    * Note that this API does not cause a layout of the editor.
  1.2234 +    *
  1.2235 +    * @since 3.1
  1.2236 +    *
  1.2237 +    * @param aLayout    S60 layout object for the text to be laid out in the editor    
  1.2238 +    * @param aBaselineSeparationOverride   vertical separation of baselines 
  1.2239 +    *       overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
  1.2240 +    * @param aMaxHeight     Input maximum height to use for the editor.
  1.2241 +    * @param aUsedHeight    Returns the number of pixels required for the lines that fit
  1.2242 +    * @return The number of lines which completely fit
  1.2243 +    */
  1.2244 +    IMPORT_C static TInt EdwinLinesWithinHeight (
  1.2245 +        const TAknTextLineLayout& aLayout,
  1.2246 +        TInt aBaselineSeparationOverride,
  1.2247 +        TInt aMaxHeight,
  1.2248 +        TInt& aUsedHeight
  1.2249 +        );
  1.2250 +};
  1.2251 +
  1.2252 +/** Low level drawing based on European LAF document (can be used by application's custom controls)
  1.2253 + *
  1.2254 + * This class reads AVKON_LAYOUT_TEXT resources
  1.2255 + */
  1.2256 +class TAknLayoutText
  1.2257 +    {
  1.2258 +public:
  1.2259 +    IMPORT_C TAknLayoutText();
  1.2260 +    /** Read resources and calculate information needed to draw text.
  1.2261 +     *
  1.2262 +     * LayoutText() call should be placed to control's SizeChanged() method.
  1.2263 +     */
  1.2264 +    IMPORT_C void LayoutText(const TRect& aParent, TInt aResourceId,
  1.2265 +                             const CFont* aCustomFont=0);
  1.2266 +
  1.2267 +    IMPORT_C void LayoutText(const TRect& aParent, TResourceReader& aReader,
  1.2268 +                             const CFont* aCustomFont=0);
  1.2269 +
  1.2270 +    IMPORT_C void LayoutText(const TRect& aParent, 
  1.2271 +                             const AknLayoutUtils::SAknLayoutText& aLayout,
  1.2272 +                             const CFont* aCustomFont=0);
  1.2273 +
  1.2274 +    IMPORT_C void LayoutText(const TRect& aParent,
  1.2275 +                             const TAknTextLineLayout& aLayout,
  1.2276 +                             const CFont* aCustomFont=0);
  1.2277 +
  1.2278 +    IMPORT_C void LayoutText(const TRect& aParent, TInt fontid, 
  1.2279 +                             TInt C, TInt l, TInt r, TInt B, TInt W, TInt J,
  1.2280 +                             const CFont* aCustomFont=0);
  1.2281 +
  1.2282 +    /** Do the actual drawing, should be placed to control's Draw() method.
  1.2283 +     */
  1.2284 +    IMPORT_C void DrawText(CGraphicsContext& aGc, const TDesC& aText) const;
  1.2285 +    
  1.2286 +    /**
  1.2287 +    * In case of bidirectional text, which is already converted from logical to
  1.2288 +    * visual order, use this method with parameter 
  1.2289 +    * aUseLogicalToVisualConversion EFalse.
  1.2290 +    */
  1.2291 +    IMPORT_C void DrawText(
  1.2292 +        CGraphicsContext& aGc,
  1.2293 +        const TDesC& aText,
  1.2294 +        TBool aUseLogicalToVisualConversion ) const;
  1.2295 +
  1.2296 +    IMPORT_C void DrawText(
  1.2297 +        CGraphicsContext& aGc,
  1.2298 +        const TDesC& aText,
  1.2299 +        TBool aUseLogicalToVisualConversion,
  1.2300 +        const TRgb &aColor) const;
  1.2301 +                           
  1.2302 +
  1.2303 +public:
  1.2304 +    /** This returns rectangle that is used to draw the text.
  1.2305 +     *
  1.2306 +     * This allows you to divide screen space for egul's TextUtils::ClearBetweenRect()
  1.2307 +     * without knowing exact coordinates => when coordinates change, your code 
  1.2308 +     * does not need to change.
  1.2309 +     */
  1.2310 +    IMPORT_C TRect TextRect() const;
  1.2311 +    const CFont *Font() const { return iFont; }
  1.2312 +    TRgb Color() const { return AKN_LAF_COLOR_STATIC(iColor); }
  1.2313 +    CGraphicsContext::TTextAlign Align() const { return iAlign; }
  1.2314 +    /**
  1.2315 +    * Returns the baseline position for the font set in this object.
  1.2316 +    * This value, together with TextRect(), are the metrics that are used to 
  1.2317 +    * parametrise a call to DrawText, for example:
  1.2318 +    *      void CGraphicsContext::DrawText( 
  1.2319 +    *            const TDesC& aText, 
  1.2320 +    *            const TRect& aBox, 
  1.2321 +    *            TInt aBaselineOffset, 
  1.2322 +    *            TTextAlign aAlignment = ELeft,
  1.2323 +    *            TInt aLeftMargin = 0);
  1.2324 +    * 
  1.2325 +    *  TAknLayoutText's own DrawText methods are recommended, however.
  1.2326 +    * 
  1.2327 +    *  Notice that this value is relative to the top of the TextRect() rectangle, 
  1.2328 +    *  which is generally made to bound all accents. Thus this offset value 
  1.2329 +    *  is usually larger than the CFont::AscentInPixels value.
  1.2330 +    * 
  1.2331 +    * @since 3.1 
  1.2332 +    * @return   distance in pixels measured from the top of the textpane down to the baseline
  1.2333 +    */
  1.2334 +    TInt BaselineOffset() const;
  1.2335 +private:
  1.2336 +    TRect iTextRect;
  1.2337 +    const CFont *iFont; // not owned..
  1.2338 +    TInt iColor;
  1.2339 +    TInt iOffset;
  1.2340 +    CGraphicsContext::TTextAlign iAlign;
  1.2341 +    friend class CBubbleOutlookNumberEntry;
  1.2342 +    };
  1.2343 +
  1.2344 +/** Low level rectangle management based on European LAF document (can be used by application's custom controls)
  1.2345 + * 
  1.2346 + * This allows you to draw images, rectangles, lines or just calculate rectangles based on LAF spec.
  1.2347 + *
  1.2348 + * This class reads AVKON_LAYOUT_RECT resources.
  1.2349 + *
  1.2350 + * Instances of this class should be placed inside controls for reading low level layout from resources.
  1.2351 + */
  1.2352 +class TAknLayoutRect
  1.2353 +    {    
  1.2354 +public:
  1.2355 +    IMPORT_C TAknLayoutRect();
  1.2356 +    /** LayoutRect should be called from control's SizeChanged() method.
  1.2357 +     */
  1.2358 +    IMPORT_C void LayoutRect(const TRect &aParent, TInt aResourceId);
  1.2359 +    IMPORT_C void LayoutRect(const TRect &aParent, TResourceReader &aReader);
  1.2360 +    IMPORT_C void LayoutRect(const TRect &aParent, 
  1.2361 +                             const AknLayoutUtils::SAknLayoutRect &aLayout);
  1.2362 +
  1.2363 +    IMPORT_C void LayoutRect(const TRect &aParent,
  1.2364 +                             const TAknWindowLineLayout &aLayout);
  1.2365 +
  1.2366 +    IMPORT_C void LayoutRect(const TRect &aParent, 
  1.2367 +                             TInt C, TInt l, TInt t, TInt r, TInt b,
  1.2368 +                             TInt W, TInt H);
  1.2369 +    
  1.2370 +    /** Color() can be called from control's Draw() method. 
  1.2371 +    
  1.2372 +    DO NOT CALL it in SizeChanged(), ConstructL() or ActivateL() method, because 
  1.2373 +    it messes up color scheme changes. Especially if you're using colors 226-248.
  1.2374 +    If you store color values, be prepared to update TRgb's you store when color
  1.2375 +    palette is changed! Best thing to do is to make your Draw() methods call
  1.2376 +    AKN_LAF_COLOR().
  1.2377 +     */    
  1.2378 +    IMPORT_C TRgb Color() const;
  1.2379 +    /** Rect() can be called from control's Draw() or in SizeChanged() as input for some other table's layout code.
  1.2380 +     */
  1.2381 +    IMPORT_C TRect Rect() const;
  1.2382 +    TBool Valid() const;
  1.2383 +
  1.2384 +    /** DrawRect() and DrawImage() should be called from control's Draw() method.
  1.2385 +     */
  1.2386 +    IMPORT_C void DrawRect(CWindowGc& aGc) const;
  1.2387 +    IMPORT_C void DrawOutLineRect(CWindowGc& aGc) const;
  1.2388 +    IMPORT_C void DrawImage(CBitmapContext& aGc, CFbsBitmap* aBitmap, CFbsBitmap* aMask) const;
  1.2389 +private:
  1.2390 +    TInt iColor;
  1.2391 +    TRect iRect;
  1.2392 +    };
  1.2393 +
  1.2394 +/**
  1.2395 + * Helper functions for drawing empty lists and window shadows
  1.2396 + */
  1.2397 +class AknDraw 
  1.2398 +    {
  1.2399 +public:
  1.2400 +    /** 
  1.2401 +    Draws standard empty list
  1.2402 +    @param aRect the client rectangle
  1.2403 +    @param aGc   the graphics context
  1.2404 +    @param aText text for empty list in format "Line1\nLine2"
  1.2405 +     */
  1.2406 +    IMPORT_C static void DrawEmptyList(
  1.2407 +        const TRect& aRect,
  1.2408 +        CWindowGc& aGc,
  1.2409 +        TPtrC aText);
  1.2410 +
  1.2411 +    /** 
  1.2412 +    Draws empty list for setting item editing
  1.2413 +    @param aRect the rectangle of setting page's content
  1.2414 +    @param aGc   the graphics context
  1.2415 +    @param aText text for empty list in format "Line1\nLine2"
  1.2416 +     */
  1.2417 +    IMPORT_C static void DrawEmptyListForSettingPage(
  1.2418 +        const TRect &aRect,
  1.2419 +        CWindowGc &aGc,
  1.2420 +        TPtrC text); // only for setting page with empty layout.
  1.2421 +
  1.2422 +    /** 
  1.2423 +    Draws empty list for lists with find
  1.2424 +    @param aRect the client rectangle
  1.2425 +    @param aGc   the graphics context
  1.2426 +    @param aText text for empty list in format "Line1\nLine2"
  1.2427 +     */
  1.2428 +    IMPORT_C static void DrawEmptyListWithFind(
  1.2429 +        const TRect& aClientRect,
  1.2430 +        CWindowGc& aGc,
  1.2431 +        TPtrC aText); // only for fixed find pane used with single graphics listbox.
  1.2432 +
  1.2433 +    /** 
  1.2434 +    Draws empty list for lists with heading
  1.2435 +    @param aRect the client rectangle
  1.2436 +    @param aGc   the graphics context
  1.2437 +    @param aText text for empty list in format "Line1\nLine2"
  1.2438 +     */
  1.2439 +    IMPORT_C static void DrawEmptyListHeading(
  1.2440 +        const TRect &aClientRect,
  1.2441 +        CWindowGc& aGc,
  1.2442 +        TPtrC aText); // only heading style lists.
  1.2443 +
  1.2444 +    // The following is optimization for drawing window shadows.
  1.2445 +    /** 
  1.2446 +    Draws a window shadow
  1.2447 +    @param aCoverRect the area covered by the shadow
  1.2448 +    @param aSecondShadowRect the area used for second shadow
  1.2449 +    @param aFirstShadowRect  the area of first shadow
  1.2450 +    @param aOutliineFrameRect the area of black outline frame
  1.2451 +    @param aInsideAreaRect   the area of content inside the window
  1.2452 +     */
  1.2453 +    IMPORT_C static void DrawWindowShadow(
  1.2454 +        CWindowGc& aGc,
  1.2455 +        const TAknLayoutRect& aCoverRect,
  1.2456 +        const TAknLayoutRect& aSecondShadowRect,
  1.2457 +        const TAknLayoutRect& aFirstShadowRect,
  1.2458 +        const TAknLayoutRect& aOutlineFrameRect,
  1.2459 +        const TAknLayoutRect& aInsideAreaRect);
  1.2460 +
  1.2461 +public:
  1.2462 +
  1.2463 +    /** 
  1.2464 +    * The main implementation routine for empty list drawing.
  1.2465 +    * @param aRect the client rectangle
  1.2466 +    * @param aGc   the graphics context
  1.2467 +    * @param aText text for empty list in one of following formats:
  1.2468 +    *
  1.2469 +    * layouts with large font:
  1.2470 +    * "Line 1"
  1.2471 +    * "Long line. This will be wrapped to 2 lines and 2nd will be trunca..."
  1.2472 +    * "Line 1\nLine 2"
  1.2473 +    *
  1.2474 +    * layout with 1 line of large font and up to 3 lines with small font:
  1.2475 +    * "Line 1\nLong line, will be wrapped up to 3 lines with small font and..."
  1.2476 +    *
  1.2477 +    *
  1.2478 +    * @param aLayoutLine1 Resource id of AVKON_LAYOUT_TEXT for first line layout 
  1.2479 +    * @param aLayoutLine2 Resource id of AVKON_LAYOUT_TEXT for second line layout 
  1.2480 +     */
  1.2481 +    IMPORT_C static void DrawEmptyListImpl( const TRect& aRect,
  1.2482 +                                            CWindowGc& aGc,
  1.2483 +                                            TPtrC aText,
  1.2484 +                                            TInt aLayoutLine1,
  1.2485 +                                            TInt aLayoutLine2 );
  1.2486 +    
  1.2487 +    };
  1.2488 +
  1.2489 +/**
  1.2490 + * Helper functions for drawing empty lists and window shadows
  1.2491 + */
  1.2492 +class AknDrawWithSkins
  1.2493 +    {
  1.2494 +public:
  1.2495 +    /** 
  1.2496 +    Draws standard empty list
  1.2497 +    @param aRect the client rectangle
  1.2498 +    @param aGc   the graphics context
  1.2499 +    @param aText text for empty list in format "Line1\nLine2"
  1.2500 +     */
  1.2501 +    IMPORT_C static void DrawEmptyList(
  1.2502 +        const TRect& aRect,
  1.2503 +        CWindowGc& aGc,
  1.2504 +        TPtrC aText,
  1.2505 +        CCoeControl *aControl);
  1.2506 +
  1.2507 +    /** 
  1.2508 +    Draws empty list for setting item editing
  1.2509 +    @param aRect the rectangle of setting page's content
  1.2510 +    @param aGc   the graphics context
  1.2511 +    @param aText text for empty list in format "Line1\nLine2"
  1.2512 +     */
  1.2513 +    IMPORT_C static void DrawEmptyListForSettingPage(
  1.2514 +        const TRect &aRect,
  1.2515 +        CWindowGc &aGc,
  1.2516 +        TPtrC text,
  1.2517 +        CCoeControl *aControl); // only for setting page with empty layout.
  1.2518 +
  1.2519 +    /** 
  1.2520 +    Draws empty list for lists with find
  1.2521 +    @param aRect the client rectangle
  1.2522 +    @param aGc   the graphics context
  1.2523 +    @param aText text for empty list in format "Line1\nLine2"
  1.2524 +     */
  1.2525 +    IMPORT_C static void DrawEmptyListWithFind(
  1.2526 +        const TRect& aClientRect,
  1.2527 +        CWindowGc& aGc,
  1.2528 +        TPtrC aText,
  1.2529 +        CCoeControl *aControl); // only for fixed find pane used with single graphics listbox.
  1.2530 +
  1.2531 +    /** 
  1.2532 +    Draws empty list for lists with heading
  1.2533 +    @param aRect the client rectangle
  1.2534 +    @param aGc   the graphics context
  1.2535 +    @param aText text for empty list in format "Line1\nLine2"
  1.2536 +     */
  1.2537 +    IMPORT_C static void DrawEmptyListHeading(
  1.2538 +        const TRect &aClientRect,
  1.2539 +        CWindowGc& aGc,
  1.2540 +        TPtrC aText,
  1.2541 +        CCoeControl *aControl); // only heading style lists.
  1.2542 +
  1.2543 +    // The following is optimization for drawing window shadows.
  1.2544 +    /** 
  1.2545 +    Draws a window shadow
  1.2546 +    @param aCoverRect the area covered by the shadow
  1.2547 +    @param aSecondShadowRect the area used for second shadow
  1.2548 +    @param aFirstShadowRect  the area of first shadow
  1.2549 +    @param aOutliineFrameRect the area of black outline frame
  1.2550 +    @param aInsideAreaRect   the area of content inside the window
  1.2551 +     */
  1.2552 +    IMPORT_C static void DrawWindowShadow(
  1.2553 +        CWindowGc& aGc,
  1.2554 +        const TAknLayoutRect& aCoverRect,
  1.2555 +        const TAknLayoutRect& aSecondShadowRect,
  1.2556 +        const TAknLayoutRect& aFirstShadowRect,
  1.2557 +        const TAknLayoutRect& aOutlineFrameRect,
  1.2558 +        const TAknLayoutRect& aInsideAreaRect,
  1.2559 +        CCoeControl *aControl);
  1.2560 +    
  1.2561 +    };
  1.2562 +
  1.2563 +
  1.2564 +
  1.2565 +
  1.2566 +// Browser and calculator fonts will not be placed here. Application
  1.2567 +// can use them themselves with CEikonEnv::Static()->Font() call.
  1.2568 +IMPORT_C const CFont *LatinPlain12();
  1.2569 +IMPORT_C const CFont *LatinBold12();
  1.2570 +IMPORT_C const CFont *LatinBold13();
  1.2571 +IMPORT_C const CFont *LatinBold16(); // since 2.0
  1.2572 +IMPORT_C const CFont *LatinBold17();
  1.2573 +IMPORT_C const CFont *LatinBold19(); 
  1.2574 +IMPORT_C const CFont *NumberPlain5();
  1.2575 +IMPORT_C const CFont *ClockBold30();
  1.2576 +IMPORT_C const CFont *LatinClock14();
  1.2577 +const CFont *CalcBold21();
  1.2578 +const CFont *CalcOperBold21();
  1.2579 +const CFont *CalcOperBold13();
  1.2580 +
  1.2581 +
  1.2582 +
  1.2583 +IMPORT_C const CFont *ApacPlain12();
  1.2584 +IMPORT_C const CFont *ApacPlain16();
  1.2585 +
  1.2586 +
  1.2587 +/**
  1.2588 +* CompletePathWithAppPath
  1.2589 +*   All the components that are specified in the given descriptor (drive letter,
  1.2590 +*   path and file name, including extension) are put into the result;
  1.2591 +*   any missing components (path and drive letter) are taken from the app's path.
  1.2592 +*
  1.2593 +*   Can be used e.g. to load a bitmap file when an application don't know where
  1.2594 +*   it has been installed.
  1.2595 +*
  1.2596 +*   Example1:
  1.2597 +*        TFilename fname = _L("\testdir\pics.mbm"); // Use _LIT instead
  1.2598 +*        CompletePathWithAppPath( fname );
  1.2599 +*        Result:
  1.2600 +*            fname == "c:\testdir\pics.mbm" if application was installed to c:
  1.2601 +*
  1.2602 +*   Example2:
  1.2603 +*        TFilename fname = _L("pics.mbm"); // Use _LIT instead
  1.2604 +*        CompletePathWithAppPath( fname );
  1.2605 +*        Result:
  1.2606 +*            fname == "c:\system\apps\myapp\pics.mbm" if application was 
  1.2607 +*                installed to c:\system\apps\myapp
  1.2608 +*
  1.2609 +* @param    aFileName   FileName which will be completed with application's path
  1.2610 +* @return   Error code if an error occured. In case of an error aFileName will
  1.2611 +*               not be changed
  1.2612 +*/
  1.2613 +IMPORT_C TInt CompleteWithAppPath( TDes& aFileName );
  1.2614 +
  1.2615 +/**
  1.2616 + * Test whether the value falls within the parent relative range
  1.2617 + * as defined in AknLayout2Def.h
  1.2618 + *
  1.2619 + * @since 2.8
  1.2620 + * @param aVal value
  1.2621 + * @return ETrue if value is within the parent relative range, EFalse otherwise
  1.2622 + */
  1.2623 +TBool IsParentRelative(TInt aVal);
  1.2624 +
  1.2625 +/**
  1.2626 + * Returns default input language that corresponds to the UI language.
  1.2627 + *
  1.2628 + * @since 3.0
  1.2629 + * @param aUiLanguage Language code of the UI language
  1.2630 + * @return Language code of the default input language
  1.2631 + */
  1.2632 +IMPORT_C TInt DefaultInputLanguageFromUILanguage(const TInt aUiLanguage);
  1.2633 +
  1.2634 +    /**
  1.2635 +    * Sets the key block mode.
  1.2636 +    * Has the same functionality as SetKeyBlockMode in AknAppUi,
  1.2637 +    * but this can be used from a non app-framework application.
  1.2638 +    * The default mode blocks simultaneous key presses.
  1.2639 +    * @param aMode @c ENoKeyBlock if no key block, otherwise
  1.2640 +    * @c EDefaultBlockMode
  1.2641 +    */
  1.2642 +IMPORT_C void SetKeyblockMode( TAknKeyBlockMode aMode );
  1.2643 +
  1.2644 +namespace AknDateTimeUtils
  1.2645 +    {
  1.2646 +    /**
  1.2647 +    * Converts given UTC time to home time.
  1.2648 +    * This conversion is used e.g. when showing time stamps of files in UI.
  1.2649 +    * In Symbian OS file system, time stamps are in UTC time, but in UI
  1.2650 +    * they should be shown in home time.
  1.2651 +    *
  1.2652 +    * @param aTime UTC time to be converted to home time.
  1.2653 +    * @since 3.1
  1.2654 +    */
  1.2655 +    IMPORT_C void ConvertUtcTimeToHomeTime( TTime& aTime );
  1.2656 +    }
  1.2657 +
  1.2658 +#define KAknLanguageMask 0x3FF
  1.2659 +#define KAknDialectMask 0xFC00
  1.2660 +
  1.2661 +namespace AknLangUtils
  1.2662 +    {
  1.2663 +    /**
  1.2664 +    * Returns the RFC 3066 tag of the current display language.
  1.2665 +    * @since 3.1
  1.2666 +    * @ret RFC 3066 tag, ownership transferred to the caller.
  1.2667 +    */
  1.2668 +    IMPORT_C HBufC* DisplayLanguageTagL();
  1.2669 +    
  1.2670 +    TLanguage UserLanguage();
  1.2671 +    
  1.2672 +    }
  1.2673 +
  1.2674 +/**
  1.2675 + * Helper functions for Popups
  1.2676 + * 
  1.2677 + * @since S60 v5.2
  1.2678 + */
  1.2679 +class AknPopupUtils
  1.2680 +    {
  1.2681 +public:
  1.2682 +    /** 
  1.2683 +     * Calculates proper position for a popup control. Returned value depends
  1.2684 +     * on currently active layout and softkey visibility.
  1.2685 +     * 
  1.2686 +     * @param aSize             The size of the popup.
  1.2687 +     * @param aSoftkeysVisible  ETrue if softkeys are visible.
  1.2688 +     * @return                  Corrent popup position.
  1.2689 +     */
  1.2690 +    IMPORT_C static TPoint Position( const TSize& aSize,
  1.2691 +        TBool aSoftkeysVisible );
  1.2692 +
  1.2693 +    /** 
  1.2694 +     * Calculates proper position for a popup control. Returned value depends
  1.2695 +     * on currently active layout and softkey visibility which is checked from
  1.2696 +     * aControl via MOP chain.
  1.2697 +     * 
  1.2698 +     * @param aSize         The size of the popup.
  1.2699 +     * @param aControl      Control who's position should be calculated.
  1.2700 +     * @return              Corrent popup position.
  1.2701 +     */
  1.2702 +    IMPORT_C static TPoint Position( const TSize& aSize,
  1.2703 +        CCoeControl* aControl );
  1.2704 +    };
  1.2705 +
  1.2706 +
  1.2707 +/**
  1.2708 + * Helper functions for Lists
  1.2709 + * 
  1.2710 + * @since S60 v5.2
  1.2711 + */
  1.2712 +class AknListUtils
  1.2713 +    {
  1.2714 +public:
  1.2715 +    /** 
  1.2716 +     * Draws a separator line between list items.
  1.2717 +     * 
  1.2718 +     * @param aGc       Graphics context where separator is drawn to.
  1.2719 +     * @param aRect     Rectangle occupied by the item that is separated.
  1.2720 +     * @param aColor    Text color used in item. Separator is drawn with this
  1.2721 +     *                  color and additional alpha mask.
  1.2722 +     */
  1.2723 +    IMPORT_C static void DrawSeparator( CGraphicsContext& aGc, 
  1.2724 +        const TRect& aRect, const TRgb& aColor );
  1.2725 +    };
  1.2726 +
  1.2727 +#endif //  __AKNUTILS_H__
  1.2728 +
  1.2729 +// End of file
  1.2730 +