classicui_pub/ui_framework_utilities_api/inc/AknUtils.h
changeset 0 2f259fa3e83a
child 4 8ca85d2f0db7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     General Avkon Utilities. Includes:
       
    16 *       - listbox utilities
       
    17 *       - layout utilities
       
    18 * 
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef __AKNUTILS_H__
       
    24 #define __AKNUTILS_H__
       
    25 
       
    26 #include <eiktxlbm.h>
       
    27 #include <avkon.hrh>
       
    28 #include <avkon.rsg>
       
    29 #include <coedef.h>
       
    30 #include <coecobs.h>
       
    31 #include <w32std.h>
       
    32 #include <gulalign.h>
       
    33 #include <gulutil.h>
       
    34 #include <eikenv.h>
       
    35 #include <biditext.h>
       
    36 #include <eiksbfrm.h>
       
    37 #include <AknsConstants.h>
       
    38 #include <aknenv.h>
       
    39 #include <AknLayout.lag>
       
    40 
       
    41 // 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!)
       
    42 const TInt KMaxColumnDataLength = 80; // This is maximum length of data for one listbox column -- after that the data is truncated before drawing.
       
    43 const TInt KMaxTotalDataLength = 8*KMaxColumnDataLength;  // max of 5 columns can have full 80 characters...
       
    44 
       
    45 /** AVKON utility module
       
    46  *
       
    47  * From this file, you can find several tools for making application development easier for S60
       
    48  *
       
    49  * 1) Conversion modules to convert coordinate data from european LAF to usable formats
       
    50  *     AknLayoutUtils, TAknLayoutRect, TAknLayoutText
       
    51  * 2) Utilities to clip text
       
    52  * 3) Part of selection service implementation
       
    53  * 4) Different classes that help using listboxes
       
    54  * 5) Handling colors in AKN_LAF_COLOR macro.
       
    55  * 6) Resource readers for different purposes
       
    56  * 7) Utility to find files without specifying the drive letter or path
       
    57  */
       
    58 
       
    59 
       
    60 class CCoeControl;
       
    61 class CEikTextListBox;
       
    62 class CEikColumnListBox;
       
    63 class CEikFormattedCellListBox;
       
    64 class CGulIcon;
       
    65 class CEikSettingsListBox;
       
    66 class CAknLAF;
       
    67 class CEikImage;
       
    68 class CEikMfne;
       
    69 class CEikListBox;
       
    70 class CEikLabel;
       
    71 class CEikEdwin;
       
    72 class CEikMenuPane;
       
    73 class CAknPopupField;
       
    74 class CListBoxView;
       
    75 class CAknColumnListBox;
       
    76 class CEikSecretEditor;
       
    77 class CFindExtension;
       
    78 class CAknLayoutFont;
       
    79 class TAknFontSpecification;
       
    80 class CAknAppUiBase;
       
    81 class TAknWindowLineLayout;
       
    82 class TAknMultiLineTextLayout;
       
    83 class TAknTextLineLayout;
       
    84 
       
    85 /**
       
    86  * Egul library had methods to clip text from right side, this class includes methods to clip from both sides.
       
    87  * It does add 3 dots to the end of the text.
       
    88  */
       
    89 const TInt  KDefaultClipWidth = -1;
       
    90 const TUint KDefaultClipChar  = TUint(0x2026);
       
    91 
       
    92 // Constant to use in AknLayoutUtils to indicate that the parameter is not to be used as a override value
       
    93 const TInt KAknLayoutUtilsDoNotOverride = -1;
       
    94 
       
    95 /**
       
    96 * Text utilities.
       
    97 * Text truncating and wrapping methods in this class do not support 
       
    98 * text that requires conversion from logical to visual form,
       
    99 * e.g. Arabic/Hebrew, Thai and Hindi text. Code that needs to support that
       
   100 * kind of text should use corresponding methods in AknBidiTextUtils instead.
       
   101 */
       
   102 class AknTextUtils 
       
   103     {
       
   104 public:
       
   105     enum TClipDirection
       
   106     {
       
   107     EDoNotClip,
       
   108     EClipFromEnd,
       
   109     EClipFromBeginning
       
   110     };
       
   111     /** ClipToFit() Generic clipping
       
   112     
       
   113     @param aBuffer         String that needs to be clipped. will be modified by this call
       
   114     @param aFont           Font used in the code
       
   115     @param aMaxWidthInPixels Maximum length of text that will not be clipped.
       
   116     @param aDir            Where is the text clipped from. EDoNotClip, EClipFromEnd, EClipFromBeginning.
       
   117     @param aClipWidth      The length of the text after clipping. KDefaultClipWidth will make it use aMaxWidthInPixels.
       
   118     @param aClipString     The representation of three dots. (not really used anywhere - use the default value always or "")
       
   119        
       
   120     returns true if the text was clipped and 3 dots were added. 
       
   121     */
       
   122     
       
   123     IMPORT_C static TBool ClipToFit(TDes& aBuffer,
       
   124                                     const CFont& aFont, 
       
   125                                     TInt aMaxWidthInPixels,
       
   126                                     TClipDirection aDir=EClipFromEnd,
       
   127                                     TInt aClipWidth = KDefaultClipWidth,
       
   128                                     const TDesC &aClipString=_L("..."));
       
   129 
       
   130     /** ClipToFit() for clipping text inside lists
       
   131      *
       
   132      * NOTICE: This method cannot handle situation where the text may dynamically change its size! Especially when you have bitmaps on the right side!
       
   133      *
       
   134      * This needs to be done AFTER the listbox has done its SizeChanged()!
       
   135      */
       
   136     IMPORT_C static TBool ClipToFit(TDes& aBuffer, 
       
   137                                     TClipDirection aDir,
       
   138                                     CEikFormattedCellListBox *aListBox,
       
   139                                     TInt aItemIndex,
       
   140                                     TInt aSubCellNumber);
       
   141 
       
   142     /** ClipToFit() for clipping text inside lists
       
   143      *
       
   144      * NOTICE: This method cannot handle situation where the text may dynamically change its size! Especially when you have bitmaps on the right side!
       
   145      *
       
   146      * This needs to be done AFTER the listbox has done its SizeChanged()!
       
   147      */
       
   148     IMPORT_C static TBool ClipToFit(TDes& aBuffer,
       
   149                                     TClipDirection aDir,
       
   150                                     CEikColumnListBox *aListBox,
       
   151                                     TInt aItemIndex,
       
   152                                     TInt aColumnNumber);
       
   153 
       
   154     // implementation
       
   155 
       
   156     static TBool DoClipToFit(
       
   157         TDes& aBuffer,
       
   158         const CFont& aFont,
       
   159         TInt aMaxWidthInPixels,
       
   160         TClipDirection aDir,
       
   161         TInt aClipWidth,
       
   162         const TDesC& aClipString );
       
   163 
       
   164     /**
       
   165     * Wraps a string to an array of pointers.
       
   166     * The number of lines and line widths are specified by aLineWidthArray.
       
   167     * The pointers in aWrappedArray point to positions inside aWrappedString.
       
   168     *
       
   169     * @param aStringToWrap      String that needs to be wrapped
       
   170     * @param aLineWidthArray    Line widths in pixels
       
   171     * @param aFont              Used font
       
   172     * @param aWrappedArray      Pointers to wrapped lines
       
   173     */
       
   174     IMPORT_C static void WrapToArrayL( 
       
   175         const TDesC& aStringToWrap,
       
   176         const CArrayFix<TInt>& aLineWidthArray,
       
   177         const CFont& aFont,
       
   178         CArrayFix<TPtrC>& aWrappedArray);
       
   179 
       
   180     /**
       
   181     * Wraps a string to an array of pointers.
       
   182     * Constant line width is given.
       
   183     * The pointers in aWrappedArray point to positions inside aWrappedString.
       
   184     *
       
   185     * @param aStringToWrap      String that needs to be wrapped
       
   186     * @param aLineWidth         Constant line width in pixels
       
   187     * @param aFont              Used font
       
   188     * @param aWrappedArray      Pointers to wrapped lines
       
   189     */
       
   190     IMPORT_C static void WrapToArrayL( 
       
   191         const TDesC& aStringToWrap,
       
   192         TInt aLineWidth,
       
   193         const CFont& aFont,
       
   194         CArrayFix<TPtrC>& aWrappedArray );
       
   195 
       
   196     /**
       
   197     * Wraps a string to an array of pointers and clips at the end
       
   198     * of the last line if there aren't enough lines to accomodate
       
   199     * the entire text. When clipping three dots are inserted at the
       
   200     * end of the last line.
       
   201     * The number of lines and line widths are specified by aLineWidthArray.
       
   202     * The pointers in aWrappedArray point to positions inside aWrappedString.
       
   203     *
       
   204     * Expect the string to be modified if clipping is needed.
       
   205     * (Clipping character KEllipsis is inserted at the ending point)
       
   206     *
       
   207     * @param aStringToWrap      String that needs to be wrapped
       
   208     * @param aLineWidthArray    Line widths in pixels
       
   209     * @param aFont              Used font
       
   210     * @param aWrappedArray      Pointers to wrapped lines
       
   211     */
       
   212     IMPORT_C static void WrapToArrayAndClipL( 
       
   213         TDes& aStringToWrap,             
       
   214         const CArrayFix<TInt>& aLineWidthArray, 
       
   215         const CFont& aFont,                     
       
   216         CArrayFix<TPtrC>& aWrappedArray );       
       
   217     
       
   218     /**
       
   219     * Chops a string when a line break character is encountered.
       
   220     * Clips at the end of each line if there isn't enough space
       
   221     * on that line.
       
   222     * When clipping, KEllipsis (shown as 3 dots) is inserted at
       
   223     * the end of the line.
       
   224     * The number of lines and line widths are specified by aLineWidthArray.
       
   225     * The pointers in aChoppedArray point to positions inside aStringToChop.
       
   226     *
       
   227     * Expect the string to be modified if clipping is needed
       
   228     * (Clipping character KEllipsis is inserted in the end of the lines)
       
   229     *
       
   230     * @param aStringToChop      String that needs to be chopped
       
   231     * @param aLineWidthArray    Line widths in pixels
       
   232     * @param aFont              Used font
       
   233     * @param aChoppedArray      Pointers to chopped lines
       
   234     */
       
   235     IMPORT_C static void ChopToArrayAndClipL(
       
   236         TDes& aStringToChop,             
       
   237         const CArrayFix<TInt>& aLineWidthArray, 
       
   238         const CFont& aFont,                    
       
   239         CArrayFix<TPtrC>& aChoppedArray);
       
   240 
       
   241     /**
       
   242     * Chops a string when a line break character is encountered.
       
   243     * Clips at the end of each line if there isn't enough space
       
   244     * on that line.
       
   245     * When clipping, KEllipsis (shown as 3 dots) is inserted at
       
   246     * the end of the line.
       
   247     * Constant line width is given.
       
   248     * The pointers in aChoppedArray point to positions inside aStringToChop.
       
   249     *
       
   250     * Expect the string to be modified if clipping is needed
       
   251     * (Clipping character KEllipsis is inserted in the end of the lines)
       
   252     *
       
   253     * @param aStringToChop      String that needs to be chopped
       
   254     * @param aLineWidth         Constant line width in pixels
       
   255     * @param aFont              Used font
       
   256     * @param aChoppedArray      Pointers to chopped lines
       
   257     */
       
   258     IMPORT_C static void ChopToArrayAndClipL(
       
   259         TDes& aStringToChop,             
       
   260         TInt aLineWidth, 
       
   261         const CFont& aFont,                    
       
   262         CArrayFix<TPtrC>& aChoppedArray );
       
   263 
       
   264     /**
       
   265     * Wraps a string (aStringToWrap) into lines according to the
       
   266     * number of lines and line widths specified in aLineWidthArray. 
       
   267     * Inserts '\n' at the end of lines. 
       
   268     * Copies the result into aWrappedString.
       
   269     * Leaves if aWrappedString isn't big enough.
       
   270     *
       
   271     * @param aStringToWrap      String that needs to be wrapped
       
   272     * @param aLineWidthArray    Lines widths in pixels
       
   273     * @param aFont              Used font
       
   274     * @param aWrappedString     Wrapped string 
       
   275     */
       
   276     IMPORT_C static void WrapToStringL( 
       
   277         const TDesC& aStringToWrap,
       
   278         const CArrayFix<TInt>& aLineWidthArray,
       
   279         const CFont& aFont,
       
   280         TDes& aWrappedString );
       
   281 
       
   282    /**
       
   283     * Wraps a string (aStringToWrap) into lines according to the
       
   284     * number of lines and line widths specified in aLineWidthArray. 
       
   285     * Inserts '\n' at the end of lines. 
       
   286     * Clips the last line if there aren't enough lines to
       
   287     * fit the entire string. 
       
   288     * Copies the result into aWrappedString.
       
   289     * Leaves if aWrappedString isn't big enough.
       
   290     *
       
   291     * @param aStringToWrap      String that needs to be wrapped
       
   292     * @param aLineWidthArray    Width of lines in pixels
       
   293     * @param aFont              Used font
       
   294     * @param aWrappedString     Wrapped string 
       
   295     */
       
   296     IMPORT_C static void WrapToStringAndClipL(
       
   297         const TDesC& aStringToWrap, 
       
   298         const CArrayFix<TInt>& aLineWidthArray, 
       
   299         const CFont& aFont, 
       
   300         TDes& aWrappedString ); 
       
   301 
       
   302     /**
       
   303      * This routine is used to strip away a set of characters from
       
   304      * a descriptor.
       
   305      *
       
   306      * Useful for example for listboxes to make sure strings from
       
   307      * network or typed by the end user does not have tab or linefeed
       
   308      * characters. (as those will make listbox broken.)
       
   309      * 
       
   310      * @param   aDes         Parameter to change
       
   311      * @param   aCharacters  A set of characters to remove
       
   312      *
       
   313      * There exists predefined character sets to remove:
       
   314      *    KAknStripTabs
       
   315      *    KAknStripListControlChars  (\t's and \n's and \r's)
       
   316      */
       
   317     IMPORT_C static void StripCharacters(TDes &aDes, const TDesC &aCharacters);
       
   318 
       
   319     /**
       
   320      * This routine is used to replace all control chars with a single 
       
   321      * character, usually a whitespace.
       
   322      *
       
   323      * @param   aDes         Parameter to change
       
   324      * @param   aCharacters  A set of characters to remove
       
   325      * @param   aReplacement a character used as replacement
       
   326      *
       
   327      *    KAknReplaceTabs
       
   328      *    KAknReplaceListControlChars  (\t's and \n's)
       
   329      */
       
   330     IMPORT_C static void ReplaceCharacters(TDes &aDes, const TDesC &aChars, TChar aReplacement);
       
   331 
       
   332     /**
       
   333      * This routine is used to remove extra whitespaces from text before 
       
   334      * showing on screen
       
   335      *
       
   336      * @param   aDes                   Parameter to change
       
   337      * @param   aWhiteSpaceCharacters  A set of whitespace characters to remove
       
   338      */
       
   339     IMPORT_C static void PackWhiteSpaces(TDes &aDes, const TDesC &aWhiteSpaceChars);
       
   340     
       
   341     // non-exported implementation
       
   342 
       
   343     static void WrapToStringL(
       
   344         const TDesC& aStringToWrap, 
       
   345         const CArrayFix<TInt>& aLineWidthArray, 
       
   346         const CFont& aFont, 
       
   347         TDes& aWrappedString,
       
   348         TInt aFlags,
       
   349         TInt aDirectionality );
       
   350 
       
   351     static void WrapToArrayL( 
       
   352         TDes& aStringToWrap,
       
   353         const CArrayFix<TInt>* aLineWidthArray, 
       
   354         const CFont& aFont,
       
   355         CArrayFix<TPtrC>& aWrappedArray,
       
   356         TInt aLineWidth,
       
   357         TInt aFlags,
       
   358         TInt aDirectionality );
       
   359 
       
   360     static void ChopToArrayAndClipL(
       
   361         TDes& aStringToChop,             
       
   362         const CArrayFix<TInt>* aLineWidthArray,
       
   363         const CFont& aFont,                 
       
   364         CArrayFix<TPtrC>& aChoppedArray,
       
   365         TInt aLineWidth );    
       
   366 
       
   367     /**
       
   368     * This utility is used to see if a text is empty according to the conventions of 
       
   369     * Avkon.
       
   370     *
       
   371     * @param    aTextToTest
       
   372     * @return   ETrue if the text is empty according to Avkon
       
   373     */
       
   374     static TBool IsEmptyText( const TDesC& aTextToTest );
       
   375 
       
   376     /**
       
   377      * This routine is used to convert between arabic-indic digits and european digits.
       
   378      * based on existing language setting. So it'll convert any digit from the string
       
   379      * to use either european digits or arabic-indic digits based on current settings.
       
   380      *
       
   381      * NOTE: THis method can be also called in european release. The method is required
       
   382      * to do the correct thing with all the languages.
       
   383      *
       
   384      * This method should only be used just before displaying the number as unicode string.
       
   385      * Also, never store the converted string as unicode.
       
   386      *
       
   387      * @since 2.0
       
   388      * @param   aDes                    Parameter to change
       
   389      */
       
   390     IMPORT_C static void LanguageSpecificNumberConversion(TDes &aDes);
       
   391 
       
   392     /**
       
   393      * This routine is used to convert digits from any digit format to another format eg. from 
       
   394      * european digits to arabic-indic digits.
       
   395      *
       
   396      * @since 2.0
       
   397      * @param aDes                      Parameter to change. It can contain digits from several digit types.
       
   398      * @param aDigitType                Destination digit type.
       
   399      */
       
   400     IMPORT_C static void ConvertDigitsTo( TDes& aDes, TDigitType aDigitType );
       
   401 
       
   402     /**
       
   403     * Convenience routine to obtain the directionality of the current input language
       
   404     * This routine will attempt to access this information in a system-efficient way.
       
   405     *
       
   406     * This is not to be confused with either the directionality of the display text 
       
   407     * language or (a closely associated concept) the layout direction of the UI 
       
   408     * (accessed via AknLayoutUtils::LayoutMirrored() )
       
   409     * 
       
   410     * @since 2.0
       
   411     * @return TBidiText::ELeftToRight if the current input language is left to right
       
   412     *         TBidiText::ERightToLeft if the current input langauge is right to left     
       
   413     */
       
   414     IMPORT_C static TBidiText::TDirectionality CurrentScriptDirectionality();
       
   415 
       
   416     /**
       
   417     * Method used to constrain the digit type to use to that consisted with the current input language
       
   418     * 
       
   419     * @since 2.0
       
   420     * @returns TDigitType consistent with the current input language
       
   421     */
       
   422     static TDigitType InputLanguageFilteredDigitType();
       
   423 
       
   424     /**
       
   425     * Method used to constrain the digit type to use to that consisted with the current display text language
       
   426     * 
       
   427     * @since 2.0
       
   428     * @returns TDigitType consistent with the current input language
       
   429     */
       
   430     static TDigitType DisplayTextLanguageFilteredDigitType();
       
   431 
       
   432     /**
       
   433     * Returns the digit type to be used for editors that are purely numeric in quality.
       
   434     *
       
   435     * @since 2.0
       
   436     * @returns TDigitType to use for purely numeric editors
       
   437     */ 
       
   438     IMPORT_C static TDigitType NumericEditorDigitType();
       
   439 
       
   440     /**
       
   441      * This routine is used to convert between arabic-indic digits and european digits.
       
   442      * based on existing language setting. So it'll convert any digit from the string
       
   443      * to use either european digits or arabic-indic digits based on current settings.
       
   444      *
       
   445      * This routine builds in the constraints imposed by current display text languages. 
       
   446      *
       
   447      * The number of characters in the buffer is not changed by this routine. It can therefore be 
       
   448      * safely used easily with existing (modifiable) descriptors.
       
   449      *
       
   450      * This method should only be used just before displaying the number as unicode descriptor.
       
   451      * Never store the converted string.
       
   452      *
       
   453      * @since 2.0
       
   454      * @param   aDes                    Parameter to change
       
   455      */
       
   456     IMPORT_C static void DisplayTextLanguageSpecificNumberConversion(TDes &aDes);
       
   457   
       
   458     /**
       
   459     * Returns the digit type to be used for editors that are alphanumeric.
       
   460     * (Note that these editors may be configurable to be purely numeric - that is have a numeric
       
   461     * mode, but they remain alphanumeric editors for the sake of this API.)
       
   462     *
       
   463     * This may be useful for instance for input processors that convert numeric key events to the 
       
   464     * currently set input digit type.
       
   465     *
       
   466     * @since 2.0
       
   467     * @returns TDigitType to editors with alphanumeric capability
       
   468     */ 
       
   469     IMPORT_C static TDigitType TextEditorDigitType();
       
   470 
       
   471     enum TDigitModeQueryType {
       
   472         EDigitModeEditorDefault, // in editors by default whether western or foreign digits are used (gen.editors, both text and numbers)
       
   473         EDigitModeUserModifiableEditor, // in editors whether user can modify digitmode with keypad
       
   474         EDigitModeShownToUser, // in all components when displaying digits
       
   475         EDigitModeNumberEditor, // number, time, date, notification texts (1st group of editors)
       
   476         EDigitModeLatinNumberEditor // e-mail, password, PIN codes, etc. (3rd group, where only latin can be used)
       
   477     };
       
   478     /**
       
   479      * This routine can be used to check what modes digits can be on.
       
   480      *
       
   481      * It uses input language, display language and the setting from general settings
       
   482      * to calculate whether foreign digits need to be used.
       
   483      *
       
   484      * This is useful for editor implementation and anyone that needs to convert
       
   485      * digits for display.
       
   486      * 
       
   487      * @since 2.0
       
   488      * @param aQueryType   what is the situation where the digits are to be used.
       
   489      * @returns ETrue to indicate whether digit conversions need to be used.
       
   490      * @returns EFalse to indicate that no conversion is needed.
       
   491      */
       
   492     IMPORT_C static TBool DigitModeQuery(TDigitModeQueryType aQueryType = EDigitModeShownToUser);
       
   493 
       
   494     /** 
       
   495      * Converts a filename ABCDE.EXT to format which is suitable for display.
       
   496      * This method is needed for bi-directional language support.
       
   497      * The method adds directionality markers to the filename so that the
       
   498      * filename can correctly be rendered to screen.
       
   499      *
       
   500      *
       
   501      * @since 2.6
       
   502      * @param aDes contains the file name in logical format. 
       
   503      * @returns file name in logical format with needed directionality markers.
       
   504      */
       
   505     IMPORT_C static HBufC* ConvertFileNameL(const TDesC& aDes);
       
   506 
       
   507 
       
   508     /**
       
   509     * @deprecated
       
   510     * Do not use. This method will be removed.
       
   511     */
       
   512     IMPORT_C static HBufC* LoadScalableTextL(CCoeEnv& aCoe, TInt aResourceId);
       
   513 
       
   514     /**
       
   515     * @deprecated
       
   516     * Do not use. This method will be removed.
       
   517     */
       
   518     IMPORT_C static HBufC* LoadScalableTextLC(CCoeEnv& aCoe, TInt aResourceId);
       
   519 
       
   520     /**
       
   521     * @deprecated
       
   522     * Do not use. This method will be removed.
       
   523     */
       
   524     IMPORT_C static TInt LoadScalableText(CCoeEnv& aCoe, TInt aResourceId, TDes& aBuffer ); 
       
   525 
       
   526     /**
       
   527     * @deprecated
       
   528     * Do not use. This method will be removed.
       
   529     */
       
   530     IMPORT_C static HBufC* ClipAccordingScreenOrientationLC(CCoeEnv& aCoe, HBufC* aBuf); 
       
   531 
       
   532     /**
       
   533     * Utility method used in scalable UI for choosing the longest fitting text variant.
       
   534     * Truncating and wrapping methods in classes AknTextUtils and AknBidiTextUtils do
       
   535     * the choice by themselves, so whenever they are used to process the text, it is not
       
   536     * necessary to call this method.
       
   537     *
       
   538     * Applications do not need to call this method if they pass their localized texts
       
   539     * to Avkon's UI components.
       
   540     *
       
   541     * @since 2.8
       
   542     * 
       
   543     * @param aText Text containing one or many variants with varying text widths,
       
   544     * separated with the character 0x0001. The text is supposed to be 
       
   545     * in logical order.
       
   546     * @param aFont Font used to render the text.
       
   547     * @param aMaxWidthInPixels Max width in pixels.
       
   548     *
       
   549     * @ret Longest fitting text. If none of the variants fits,
       
   550     * the shortest one in pixels is returned.
       
   551     */
       
   552     IMPORT_C static TPtrC ChooseScalableText(
       
   553         const TDesC& aText,
       
   554         const CFont& aFont,
       
   555         TInt aMaxWidthInPixels );
       
   556     };
       
   557 
       
   558 _LIT(KAknStripTabs, "\t");
       
   559 _LIT(KAknStripListControlChars, "\t\n");
       
   560 _LIT(KAknReplaceTabs, "\t");
       
   561 _LIT(KAknReplaceListControlChars, "\t\n");
       
   562 _LIT(KAknCommonWhiteSpaceCharacters, " \n\t\r");
       
   563 
       
   564 /**
       
   565  * These are part of Selection service and they should be called by application's HandleCommandL() to get
       
   566  * menus and cba's handled automatically for selection service.
       
   567  *
       
   568  * The right way to implement these would be to have dialogs with names "Selection List", "MultiSelection List"
       
   569  * and "Markable list" and make them keep a listbox inside it. (look at CAknPopupList, it does similar things)
       
   570  *
       
   571  * See CAknSelectionListDialog and CAknMarkableListDialog from aknselectionlist.h, they provide better
       
   572  * interface for applications.
       
   573  */
       
   574 class AknSelectionService
       
   575     {
       
   576 public:
       
   577     /** Helper function to implement ProcessCommandL() for selection list dialogs
       
   578      */
       
   579     IMPORT_C static void HandleSelectionListProcessCommandL(
       
   580         TInt aCommand,
       
   581         CEikListBox* aListBox);
       
   582 
       
   583     /** Helper function to implement ProcessCommandL() for selection list dialogs
       
   584      */
       
   585     IMPORT_C static void HandleMultiselectionListProcessCommandL(
       
   586         TInt aCommand,
       
   587         CEikListBox* aListBox);
       
   588 
       
   589     /** Helper function to implement ProcessCommandL() for markable list dialogs
       
   590      */
       
   591     IMPORT_C static void HandleMarkableListProcessCommandL(
       
   592         TInt aCommand,
       
   593         CEikListBox* aListBox);
       
   594 
       
   595     /** Helper function to implement ProcessCommandL() for menu lists
       
   596      */
       
   597     IMPORT_C static TKeyResponse HandleMenuListOfferKeyEventL(
       
   598         const TKeyEvent& aKeyEvent,
       
   599         TEventCode aType,
       
   600         CEikListBox* aListBox);
       
   601 
       
   602     /** Helper function to implement DynInitMenuPaneL() for markable list dialogs
       
   603      */
       
   604     IMPORT_C static void HandleMarkableListDynInitMenuPane(
       
   605         TInt aResourceId,
       
   606         CEikMenuPane *aMenu,
       
   607         CEikListBox *aListBox);
       
   608 
       
   609     /** Helper function to implement DynInitMenuPaneL() for markable list dialogs
       
   610      */
       
   611     IMPORT_C static void HandleMarkableListDynInitMenuItem(
       
   612         CEikMenuPane *aMenu,
       
   613         CEikListBox *aListBox,
       
   614         TInt aCommandId,
       
   615         TBool aCanBeAppliedToMultipleItems);
       
   616 
       
   617     /** Helper function to implement command handling for markable list dialogs
       
   618      */
       
   619     IMPORT_C static void HandleMarkableListUpdateAfterCommandExecution(
       
   620         CEikListBox *aListBox);
       
   621 
       
   622     /** Helper function to position list highlight correctly after item removal
       
   623      */
       
   624     IMPORT_C static void HandleItemRemovalAndPositionHighlightL(
       
   625         CEikListBox *aListBox,
       
   626         TInt aValueOfCurrentItemIndexBeforeRemoval,
       
   627         TBool aCurrentItemWasRemoved);
       
   628 
       
   629     // This one updates selectionindexes too.
       
   630     /** Helper function to position list highlight correctly after item removal
       
   631      *
       
   632      * It also updates selection index array based on information about which
       
   633      * items were removed.
       
   634      */
       
   635     IMPORT_C static void HandleItemRemovalAndPositionHighlightL(
       
   636         CEikListBox *aListBox,
       
   637         TInt aValueOfCurrentItemIndexBeforeRemoval,
       
   638         CArrayFix<TInt> &aIndexesOfRemovedItemsBeforeRemoval);
       
   639     };
       
   640 
       
   641 
       
   642 
       
   643 class CAknSearchField;
       
   644 
       
   645 /** 
       
   646  * This class implements find requirements from component specifications. This
       
   647  * class works also as documentation of how to use different find components.
       
   648  * (The implementation has been copied from the example application which 
       
   649  * implements find and replaced the code with calls to these static functions).
       
   650  *
       
   651  * There is no reason for an application to use this class directly. 
       
   652  * Application should use CAknSelectionListDialog instead. This class is public
       
   653  * only because sometimes it is necessary to access the low level behaviour of
       
   654  * find to implement similar functionality in places independent of find; or if
       
   655  * @c CAknSelectionListDialog is not used for some reason.
       
   656  */
       
   657 class AknFind
       
   658     {
       
   659 public:
       
   660 
       
   661     /*
       
   662      * Implements the event handlers for the find pane. This method must be
       
   663      * called when a @c ProcessCommandL event is received and a find pane is on
       
   664      * the screen.
       
   665      *
       
   666      * @param aCommand Command id.
       
   667      * @param aListBox Pointer to listbox control.
       
   668      * @param aSearchField Pointer to search field control.
       
   669      * @param aParentControl Parent control.
       
   670      */
       
   671     IMPORT_C static void HandleFindPopupProcessCommandL(
       
   672                         TInt aCommand, 
       
   673                         CEikListBox* aListBox, 
       
   674                         CAknSearchField* aSearchField, 
       
   675                         CCoeControl* aParentControl);
       
   676     
       
   677     /*
       
   678      * Handles key events for the find pane. This method must be called when
       
   679      * control receives @c OfferKeyEventL event.
       
   680      *
       
   681      * @param aKeyEvent The key event.
       
   682      * @param aType The type of key event:@c TEventCode.
       
   683      * @param aListBoxParent Pointer to the parent control.
       
   684      * @param aListBox Pointer to listbox control.
       
   685      * @param aSearchField Pointer to search field control.
       
   686      * @param isFindPopup @c ETrue if popup find pane, @c EFalse if normal find
       
   687      *        pane.
       
   688      * @param aNeedRefresh @c ETrue when find pane is redrawn.
       
   689      */    
       
   690     IMPORT_C static TKeyResponse HandleFindOfferKeyEventL(
       
   691                         const TKeyEvent& aKeyEvent, 
       
   692                         TEventCode aType, 
       
   693                         CCoeControl* aListBoxParent, 
       
   694                         CEikListBox* aListBox, 
       
   695                         CAknSearchField* aSearchField, 
       
   696                         TBool isFindPopup, 
       
   697                         TBool &aNeedRefresh);
       
   698 
       
   699     /*
       
   700      * Do not use this method.
       
   701      *
       
   702      * @deprecated Use @c AknFind::HandleFixedFindSizeChanged() and 
       
   703      *             @c AknFind::HandlePopupFindSizeChanged instead.
       
   704      *        
       
   705      */
       
   706     IMPORT_C static void HandleFindSizeChanged(
       
   707             CCoeControl* aParentControl, 
       
   708             CEikListBox* aListBox, 
       
   709             CAknSearchField* aSearchField, 
       
   710             TBool ispopup = ETrue, 
       
   711             TInt aFindWindowResourceId = R_AVKON_POPUP_FIND_WINDOW, 
       
   712             TInt aListAreaId = R_AVKON_LIST_GEN_PANE, 
       
   713             TInt aListResourceIdWithFindPopup = 
       
   714                                 R_AVKON_LIST_GEN_PANE_WITH_FIND_POPUP, 
       
   715             TInt aFindWindowParentResourceId = 
       
   716                                 R_AVKON_MAIN_PANE_WITH_STATUS_PANE);
       
   717 
       
   718     /** 
       
   719      * This is the new typesafe (and easier to use) version of @c
       
   720      * HandleFindSizeChanged(). Use this instead of (deprecated) @c
       
   721      * HandleFindSizeChanged().
       
   722      *
       
   723      * @param aParentControl Parent control.
       
   724      * @param aListBox Column list, optional and available only with column 
       
   725      *                 lists.
       
   726      * @param aSearchField Pointer to search field control.
       
   727      */
       
   728     IMPORT_C static void HandleFixedFindSizeChanged(
       
   729             CCoeControl* aParentControl,
       
   730             CAknColumnListBox* aListBox, // only available with column lists
       
   731             CAknSearchField* aSearchField);
       
   732     
       
   733     /** 
       
   734      * This is the new typesafe(and easier to use) version of @c 
       
   735      * HandleFindSizeChanged(). Use this instead of (deprecated) @c
       
   736      * HandleFindSizeChanged().
       
   737      *
       
   738      * @param aParentControl Parent control.
       
   739      * @param aListBox Pointer to listbox control.
       
   740      * @param aSearchField Pointer to search field control.
       
   741      */
       
   742     IMPORT_C static void HandlePopupFindSizeChanged(
       
   743                             CCoeControl* aParentControl,
       
   744                             CEikListBox* aListBox,  //available with all lists.
       
   745                             CAknSearchField* aSearchField);
       
   746     
       
   747     /**
       
   748      * Creates layout for a find pane and for a list. This method must be called
       
   749      * in @c SizeChanged() method of an container.
       
   750      *
       
   751      * @since 2.6
       
   752      *
       
   753      * @param aParentControl Parent control.
       
   754      * @param aListBox Pointer to listbox control.
       
   755      * @param aSearchField Pointer to search field control.
       
   756      * @param aFindWindow LAF specific table line for find window.
       
   757      * @param aListArea LAF specific table for list box area.
       
   758      * @param aIsPopup @c ETrue if popup find pane, @c EFalse if normal find
       
   759      *        pane.
       
   760      * @param aFindWindowParent LAF specific table line for find parent.
       
   761      */
       
   762     IMPORT_C static void HandleFindSizeChangedLayouts(
       
   763                             CCoeControl* aParentControl, 
       
   764                             CEikListBox* aListBox, 
       
   765                             CAknSearchField* aSearchField, 
       
   766                             const TAknWindowLineLayout& aFindWindow,
       
   767                             const TAknWindowLineLayout& aListArea,
       
   768                             TBool aIsPopup,
       
   769                             const TAknWindowLineLayout& aFindWindowParent );
       
   770 
       
   771 public:
       
   772 
       
   773     /**
       
   774      * Checks if @c aItemText matches @c aSearchText. 
       
   775      *
       
   776      * @param aItemText List box item text.
       
   777      * @param aSearchText Searched text.
       
   778      * 
       
   779      * @return @c ETrue if list box item text @c aItemText matches @c 
       
   780      *         aSearchText otherwise @c EFalse.
       
   781      */
       
   782     IMPORT_C static TBool IsFindMatch(const TDesC& aItemText, 
       
   783                                       const TDesC& aSearchText);
       
   784 
       
   785     /**
       
   786      * Tests if aCh is a word separator character as described in S60.
       
   787      *
       
   788      * @param aCh Comperative character.
       
   789      *
       
   790      * @return @c ETrue if aCh is a word separator character as described in
       
   791      * S60 otherwise @c EFalse.
       
   792      */
       
   793     IMPORT_C static TBool IsFindWordSeparator(TChar aCh);
       
   794 
       
   795     
       
   796     /**
       
   797      * Checks if @c aItemText matches @c aSearchText. 
       
   798      * Calls UpdateNextCharsL() if findutil is not supported.
       
   799      *
       
   800      * @since 5.0
       
   801      * @param aItemText List box item text.
       
   802      * @param aSearchText Searched text.
       
   803      * @param aNextChars Reference to the next characters for the adaptive search grid
       
   804      *        The HBufC buffer may be re-allocated by this method. 
       
   805      *        In that case the pointer reference is modified to point to the re-allocated object.     
       
   806      * 
       
   807      * @return @c ETrue if list box item text @c aItemText matches @c 
       
   808      *         aSearchText otherwise @c EFalse.
       
   809      */
       
   810     IMPORT_C static TBool IsAdaptiveFindMatch( const TDesC& aItemText, 
       
   811 			    		       const TDesC& aSearchText,			
       
   812 			       		       HBufC*& aNextChars );
       
   813 
       
   814     /**
       
   815      * Update next characters if find pane state was changed.
       
   816      *
       
   817      * @since 5.0
       
   818      * @param aNextChars Next characters for the adaptive search grid
       
   819      * @param aCh Criteria from the search field.    
       
   820      */
       
   821     static void UpdateNextCharsL( HBufC*& aNextChars, TChar aCh );
       
   822     
       
   823     /**
       
   824      * For Devanagari adaptive search     
       
   825      * Update next characters if find pane state was changed.
       
   826      *
       
   827      * @since 5.0
       
   828      * @param aNextChars reference to the next characters for the adaptive search grid
       
   829      * @param aItemString string we are searching.    
       
   830      */
       
   831     static void UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString );
       
   832     
       
   833     /**
       
   834      * Update next chars from the list box item text, when search field if empty.
       
   835      * This need to be done for update next characters for adaptive grid
       
   836      * works faster then calling IsAdaptiveFindMatch(). 
       
   837      *
       
   838      * @since 5.0
       
   839      * @param aNextChars Reference to the next characters for the adaptive search grid
       
   840      *        The HBufC buffer may be re-allocated by this method. 
       
   841      *        In that case the pointer reference is modified to point to the re-allocated object.     
       
   842      * @param aItemString List box item text.
       
   843      */
       
   844     IMPORT_C static void UpdateNextCharsFromString( HBufC*& aNextChars, const TDesC& aItemString );
       
   845 
       
   846     /**
       
   847      * Update next chars from the list box item text according to the bitflag.
       
   848      * Use to exclude columns from the listbox string. For example icon index columns. 
       
   849      *
       
   850      * @since 5.0
       
   851      * @param aInputText List box item text
       
   852      * @param aColumnFlag The bit flag shows which columns take into account
       
   853      * @param aOutText Updated list box item text accoding to bit flag
       
   854      */
       
   855     IMPORT_C static void UpdateItemTextAccordingToFlag( const TDesC& aInputText, 
       
   856 		  		 			TBitFlags32 aColumnFlag, 
       
   857 							TDes& aOutText );
       
   858 
       
   859     /**
       
   860      * Helper function to handle find pane's visibility.
       
   861      *
       
   862      * @param aSearchField Pointer to search field control.
       
   863      * @param ispopup @c ETrue if popup find pane, @c EFalse if normal find 
       
   864      *        pane.
       
   865      * @param textchanged @c ETrue when text in @c CAknSearchField has changed.
       
   866      * @param aNeedRefresh @c ETrue when find pane is redrawn.
       
   867      */
       
   868     static void HandleFindPaneVisibility(CAknSearchField* aSearchField, 
       
   869                                          TBool ispopup, 
       
   870                                          TBool textchanged, 
       
   871                                          TBool &aNeedRefresh);
       
   872     };
       
   873 
       
   874 
       
   875 /** 
       
   876  * Utility class to initialize editor control. Use this in conjunction with @c
       
   877  * AknLayoutUtils::LayoutEdwin(). The class is not fully implemented yet.
       
   878  */
       
   879 class AknEditUtils
       
   880     {
       
   881     public:
       
   882     
       
   883     /** Basic elements that are needed for the basic editing functions. */
       
   884     struct SAknEditorParameters 
       
   885     {
       
   886         /** The maximum available space that can be used for one text. */
       
   887         TInt iEditingSpace;
       
   888         
       
   889         /** Size of the editing window. */
       
   890         TInt iEditingWindow;
       
   891         
       
   892         /**
       
   893          * Character case effects on the style of entering characters.
       
   894          * Available alternatives are Upper case, Lower case and Text case.
       
   895          */ 
       
   896         TInt iCharacterCase;
       
   897         
       
   898         /** 
       
   899          * Specifies from which edge the current line is filled with the
       
   900          * inserted characters.
       
   901          */
       
   902         TInt iJustification;
       
   903         
       
   904         /** Is user allowed to move the insertion point. */ 
       
   905         TBool iAllowedToMoveInsertionPoint;
       
   906         
       
   907         /** Is cursor blinking or not. */
       
   908         TBool iCursorYesNo;
       
   909         
       
   910         /** Is overflow active or not.  */  
       
   911         TBool iOverflowYesNo;
       
   912     };
       
   913 
       
   914     IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, TInt aResourceId);
       
   915     IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, TResourceReader& aReader);
       
   916     IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, const SAknEditorParameters &aParams);
       
   917 
       
   918 /**
       
   919  *  Configures edwin editor. Use AknLayoutUtils::LayoutEdwin() with this method.
       
   920  *
       
   921  *  @param aEdwin Edwins created with new.
       
   922  *  @param aEditingSpace maximum number of characters for the editor
       
   923  *  @param aEditingWindow maximum number of lines in the editor
       
   924  *  @param aCharacterCase initial character case:
       
   925  *          EAknEditorCharactersUpperCase = EAknEditorUpperCase,
       
   926  *          EAknEditorCharactersLowerCase = EAknEditorLowerCase,
       
   927  *          EAknEditorCharactersTextCase = EAknEditorTextCase,
       
   928  *          EAknEditorCharactersTitleCase = EAknEditorTitleCase
       
   929  *
       
   930  *  @param aJustification alignment for the editor text ( EAknEditorAlignCenter, 
       
   931  *         EAknEditorAlignLeft, EAknEditorAlignRight)
       
   932  *  @param aAllowedToMoveInsertionPoint user can move cursor
       
   933  *  @param aCursorYesNo is cursor visible or not.
       
   934  *  @param aOverflowYesNo
       
   935  */
       
   936     IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, 
       
   937                        TInt aEditingSpace, 
       
   938                        TInt aEditingWindow, 
       
   939                        TInt aCharacterCase, 
       
   940                        TInt aJustification, 
       
   941                        TBool aAllowedToMoveInsertionPoint, 
       
   942                        TBool aCursorYesNo, 
       
   943                        TBool aOverflowYesNo);
       
   944                        
       
   945 /**
       
   946  *  Configures edwin editor. Use AknLayoutUtils::LayoutEdwin() with this method.
       
   947  *  
       
   948  *  @param aEdwin Edwins created with new.
       
   949  *  @param aEditingSpace maximum number of characters for the editor
       
   950  *  @param aEditingWindow maximum number of lines in the editor
       
   951  *  @param aCharacterCase initial character case:
       
   952  *          EAknEditorCharactersUpperCase = EAknEditorUpperCase,
       
   953  *          EAknEditorCharactersLowerCase = EAknEditorLowerCase,
       
   954  *          EAknEditorCharactersTextCase = EAknEditorTextCase,
       
   955  *          EAknEditorCharactersTitleCase = EAknEditorTitleCase
       
   956  *
       
   957  *  @param aJustification alignment for the editor text ( EAknEditorAlignCenter, 
       
   958  *         EAknEditorAlignLeft, EAknEditorAlignRight)
       
   959  *  @param aAllowedToMoveInsertionPoint user can move cursor
       
   960  *  @param aCursorYesNo is cursor visible or not.
       
   961  *  @param aOverflowYesNo
       
   962  *  @param aIsResizeable is edwin resizeable (one line editor should use EFalse, in order to have proper scrolling)
       
   963  */
       
   964     IMPORT_C static void ConstructEditingL(CEikEdwin* aEdwin, 
       
   965                                               TInt aEditingSpace, 
       
   966                                               TInt aEditingWindow, 
       
   967                                               TInt aCharacterCase, 
       
   968                                               TInt aJustification, 
       
   969                                               TBool aAllowedToMoveInsertionPoint, 
       
   970                                               TBool aCursorYesNo, 
       
   971                                               TBool aOverflowYesNo,
       
   972                                               TBool aIsResizable);
       
   973 
       
   974     };
       
   975 
       
   976 /** Automatic numbering for list items. (DEPRECATED)
       
   977  * Just create this kind of object and attach it to a listbox, and you'll
       
   978  * have automatic numbering. 
       
   979  *
       
   980  *
       
   981  * You'll need to call UpdateL() each time you modify the listbox's model!
       
   982  */
       
   983 class CListBoxNumbers : public CBase
       
   984     {
       
   985 public:
       
   986     IMPORT_C CListBoxNumbers(CEikTextListBox* aListBox);
       
   987     IMPORT_C void ConstructL();
       
   988     IMPORT_C void UpdateL();
       
   989 private:
       
   990     CEikTextListBox* iListBox;
       
   991     };
       
   992 
       
   993 class CAknListBoxFilterItems;
       
   994 
       
   995     /** 
       
   996     * This class shows how application should build its model for filtered
       
   997     * items. Application should not use this directly, if it has it's own model
       
   998     * or if there's any special things needed for @c MatchableTextArray.
       
   999     * Application can derive from this though. All listboxes use 
       
  1000     * @c CAknFilteredTextListBoxModel by default. @c CreateFilter() call 
       
  1001     * enables it.
       
  1002     * @since S60 0.9
       
  1003     */
       
  1004 class CAknFilteredTextListBoxModel : public CTextListBoxModel, public MDesCArray
       
  1005     {
       
  1006 public: // public interface for apps
       
  1007     /**
       
  1008     * Creates a @c CAknListBoxFilterItems and thus enables filtering of list
       
  1009     * items.
       
  1010     * @param aListBox List box from which one or more items can be selected.
       
  1011     * @param aSearchField Search field control.
       
  1012     */
       
  1013     IMPORT_C void CreateFilterL(CEikListBox* aListBox, CAknSearchField* aSearchField);
       
  1014     /**
       
  1015      * removes previously added filter from model
       
  1016      */
       
  1017     IMPORT_C void RemoveFilter();
       
  1018     /**
       
  1019     * Access function for the filter.
       
  1020     * @return Pointer to the listbox filter.
       
  1021     */
       
  1022     IMPORT_C CAknListBoxFilterItems* Filter() const;
       
  1023     /**
       
  1024     * Destructor.
       
  1025     */
       
  1026     IMPORT_C ~CAknFilteredTextListBoxModel();
       
  1027 public: // from CTextListBoxMode
       
  1028     /**
       
  1029     * Implementation of @c CTextListBoxModel::NumberOfItems()
       
  1030     * @return The number of items the list box has.
       
  1031     */
       
  1032     IMPORT_C virtual TInt NumberOfItems() const;
       
  1033     /**
       
  1034     * Returns the text of the specified item.
       
  1035     * @param aItemIndex Index to the item.
       
  1036     * @return The text of item in given index.
       
  1037     */
       
  1038     IMPORT_C virtual TPtrC ItemText(TInt aItemIndex) const;
       
  1039 public: // from MEikTextListBoxModel (default filtering string conversions)
       
  1040     /**
       
  1041     * Implementation of @c CTextListBoxModel::MatchableTextArray()
       
  1042     * @return Pointer to the text array.
       
  1043     */
       
  1044     IMPORT_C const MDesCArray* MatchableTextArray() const;
       
  1045 
       
  1046 private:
       
  1047     CAknListBoxFilterItems* iFilter; // owned
       
  1048 private: // From MdesCArray (these implement default matchabletextarray for filtering.)
       
  1049     IMPORT_C TInt MdcaCount() const;
       
  1050     IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
       
  1051 private: // from MListBoxModel
       
  1052     IMPORT_C virtual TAny* MListBoxModel_Reserved();
       
  1053     };
       
  1054 
       
  1055     /** 
       
  1056     * Listbox item filtering. This class is designed to be stored inside
       
  1057     * a listbox model and the model should call this in its @c NumberOfItems()
       
  1058     * and @c ItemText() implementation. The model must be given to this class
       
  1059     * and it must have @c MatchableTextArray() implemented correctly.
       
  1060     * @c HandleOfferKeyEvent() should be called from the same offer key event
       
  1061     * implementation which forwards the keys to listbox and search field
       
  1062     * 
       
  1063     * If you have both markable list and find at the same time, you should call
       
  1064     * @c ResetFiltering() before executing the command for marked items. This
       
  1065     * ensures that the ListBox's @c SelectionIndexes() returns all items instead
       
  1066     * of only those items that are visible. Selected *items can be found under
       
  1067     * @c CAknListBoxFilterItems::SelectionIndexes().
       
  1068     *
       
  1069     * @since S60 0.9
       
  1070     * 
       
  1071     */
       
  1072 class CAknListBoxFilterItems : public CBase, public MCoeControlObserver
       
  1073     {
       
  1074 public:
       
  1075     /**
       
  1076     * Base class default constructor.
       
  1077     * @param aListBox Listbox to be filtered,
       
  1078     * @param aSearchField Listbox search field.
       
  1079     * @param aModel Listbox model,
       
  1080     * @param aView A list box view that displays the list items which are
       
  1081     * currently visible in a list box.
       
  1082     */
       
  1083     IMPORT_C CAknListBoxFilterItems(
       
  1084         CEikListBox *aListBox,
       
  1085         CAknSearchField *aSearchField,
       
  1086         MListBoxModel *aModel,
       
  1087         CListBoxView *aView);
       
  1088 
       
  1089     /**
       
  1090     * This is for setting empty list text.
       
  1091     */
       
  1092     IMPORT_C void ConstructL(); // for setting empty list text.
       
  1093     /** 
       
  1094     * This function is to be called when filter is cleared.
       
  1095     */
       
  1096     IMPORT_C void ResetFilteringL();
       
  1097     /** 
       
  1098     * This function will update filter items state from the search field and
       
  1099     * listbox. Also updates selection indexes.
       
  1100     */
       
  1101     IMPORT_C void UpdateCachedDataL(); // updates iOldSearchCriteria and selection indexes.
       
  1102     /**
       
  1103     * Destructor. Frees all resources owned by the object prior to its
       
  1104     * destruction.
       
  1105     */
       
  1106     IMPORT_C ~CAknListBoxFilterItems();    
       
  1107 
       
  1108 public: 
       
  1109     /** 
       
  1110     * This one gives all indices, not just the ones that are visible.
       
  1111     * @return Pointer to the array that has all indices.
       
  1112     */
       
  1113     IMPORT_C CArrayFix<TInt> *SelectionIndexes();
       
  1114     /** 
       
  1115     * This will synchronise the selection indices from the listbox.
       
  1116     * If you use @c SelectionIndexes(), call this before it.
       
  1117     * This is heavy operation and goes through all list items.
       
  1118     */
       
  1119     IMPORT_C void UpdateSelectionIndexesL();
       
  1120     /** 
       
  1121     * This will synchronise the selected index from the listbox.
       
  1122     * If you use @c SelectionIndexes(), call this before it.
       
  1123     * This is heavy operation and goes through all list items. 
       
  1124     * @param aVisibleIndex Index to be updated.
       
  1125     */
       
  1126     IMPORT_C void UpdateSelectionIndexL(TInt aVisibleIndex);
       
  1127 
       
  1128 public: // Applications should call this in their listbox model implementation
       
  1129     /** 
       
  1130     * This is used to ask how many list items are available after filter has
       
  1131     * been used. Counts visible list items.
       
  1132     * @return Number of items visible.
       
  1133     */
       
  1134     IMPORT_C TInt FilteredNumberOfItems() const;
       
  1135     /** 
       
  1136     * This is used to fetch the content of a list item after filter has been
       
  1137     * used.
       
  1138     * @param aVisibleItemIndex The index of visible item.
       
  1139     * @return Index to the original item array.
       
  1140     */
       
  1141     IMPORT_C TInt FilteredItemIndex(TInt aVisibleItemIndex) const;
       
  1142 
       
  1143 public: // Needed to change the correct item.
       
  1144 
       
  1145     /** 
       
  1146     * Returns number of original list items.
       
  1147     * @return Number of all items.
       
  1148     */
       
  1149     IMPORT_C TInt NonFilteredNumberOfItems() const; // this always returns >= FilteredNumberOfItems()
       
  1150     /** 
       
  1151     * Finds the list item on the screen when the item array index is given.
       
  1152     * @param aOriginalIndex Item index.
       
  1153     * @return Matching index from original array. Returns -1 if the Index is
       
  1154     * not visible.
       
  1155     */
       
  1156     IMPORT_C TInt VisibleItemIndex(TInt aOriginalIndex) const;
       
  1157 public: 
       
  1158     /** 
       
  1159     * For building @c MdcaPoint() of the model's @c MatchableTextArray.
       
  1160     * This method builds the default value for @c MatchableTextArray.
       
  1161     * @param aText Pointer descriptor.
       
  1162     * @return Modified text.
       
  1163     */
       
  1164     IMPORT_C TPtrC DefaultMatchableItemFromItem(TPtrC aText);
       
  1165 
       
  1166 public: 
       
  1167     /** 
       
  1168     * Applications should call this in @c OfferKeyEventL() which gives keys to
       
  1169     * listbox and search field.
       
  1170     */
       
  1171     IMPORT_C void HandleOfferkeyEventL();
       
  1172 
       
  1173    
       
  1174     /** 
       
  1175     * When you change the list item array you should call this method.
       
  1176     */
       
  1177     IMPORT_C void HandleItemArrayChangeL();
       
  1178 
       
  1179 public: // MCoeControlObserver
       
  1180     /**
       
  1181     * Sets the observer.
       
  1182     * @param aObserver Pointer to the observer.
       
  1183     */
       
  1184     IMPORT_C void SetObserver(MCoeControlObserver *aObserver);
       
  1185     /**
       
  1186     * Editor sends messages to this object as control events.
       
  1187     * @param aControl The control that sent the event.
       
  1188     * @param aEventType The event type.
       
  1189     */
       
  1190     IMPORT_C void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);
       
  1191 
       
  1192 public: // For FEP
       
  1193     /**
       
  1194     * Sends key events to FEP. This is used to resend key event to FEP if
       
  1195     * @c AknFind's @c HandleOfferKeyEventL() gets the key while search field
       
  1196     * has no focus. If search field has a focus, the key events go directly to
       
  1197     * the editor and this is not called.
       
  1198     * @param aValue The character code for an @c EEventKey.
       
  1199     */
       
  1200     IMPORT_C void DeferredSendKeyEventToFepL(TUint aValue);
       
  1201     /**
       
  1202     * This gets called from @c DeferredSendKeyEventToFepL().
       
  1203     * This does the actual sending of a key event. Does not support more than
       
  1204     * one event at the time.
       
  1205     * @param aFilterItems Pointer to the @c CAknListBoxFilterItems object.
       
  1206     * @return Always returns 0.
       
  1207     */
       
  1208     static TInt IdleCallBack(TAny *aFilterItems);
       
  1209 
       
  1210 public: // For size changed
       
  1211     /**
       
  1212     * @c AknFind uses this to inform us who is the parent control owning the
       
  1213     * listbox and search field. This control should be window-owning control and
       
  1214     * it will be used to resize the listbox when changes to the filtering
       
  1215     * happens.
       
  1216     * @param aControl Pointer to the control.
       
  1217     */
       
  1218     IMPORT_C void SetParentControl(CCoeControl *aControl);
       
  1219    /**
       
  1220     * @c AknFind uses this to inform us that we have popup find. Applications 
       
  1221     * shouldn't call this.
       
  1222     */
       
  1223     IMPORT_C void SetPopup();
       
  1224 
       
  1225 public: // For detaching and attaching list, findbox, model and view...
       
  1226     /**
       
  1227     * Attaches or detaches list used by the filtering.
       
  1228     * @since S60 2.0
       
  1229     * @param aListBox Pointer to listbox or @c NULL.
       
  1230     */
       
  1231     IMPORT_C void SetListBox(CEikListBox *aListBox);
       
  1232     /**
       
  1233     * Attaches or detaches find pane used by the filtering.
       
  1234     * @since S60 2.0
       
  1235     * @param aSearchField Pointer to findbox or @c NULL.
       
  1236     */
       
  1237     IMPORT_C void SetSearchField(CAknSearchField *aSearchField);
       
  1238     /**
       
  1239     * Attaches or detaches list model used by the filtering.
       
  1240     * @since S60 2.0
       
  1241     * @param aModel a pointer to list model or @c NULL.
       
  1242     */
       
  1243     IMPORT_C void SetModel(MListBoxModel *aModel);
       
  1244     /**
       
  1245     * Attaches or detaches list view used by the filtering.
       
  1246     * @since S60 2.0
       
  1247     * @param aView a pointer to list view or @c NULL.
       
  1248     */
       
  1249     IMPORT_C void SetView(CListBoxView *aView);
       
  1250     
       
  1251 public:
       
  1252     /**
       
  1253     * This function just returns pointer to the search field.
       
  1254     * @return Pointer to the search field.
       
  1255     */
       
  1256     IMPORT_C CCoeControl *FindBox() const;
       
  1257 
       
  1258     /**
       
  1259      * An improved version of DeferredSendKeyEventToFepL. It sends a 
       
  1260      * @c TKeyEvent rather than just key code. Thus the correct key 
       
  1261      * event can be send to FEP on QWERTY keyboard.
       
  1262      * @since S60 5.0
       
  1263      * @param aEvent Event send to FEP.
       
  1264      */
       
  1265     void DeferredSendFullKeyEventToFepL(const TKeyEvent& aEvent);
       
  1266 
       
  1267 private:
       
  1268     void NoCriteriaL(TBool aUpdateAS = ETrue); // remove criteria completely.
       
  1269     void TightenCriteriaL(const TDesC& aCriteria); // slow operation (do when adding new characters to search criteria)
       
  1270     void ReleaseCriteriaL(const TDesC& aCriteria); // very slow operation (do when removing characters from search criteria)
       
  1271     // EmptyListText handling
       
  1272     void InstallEmptyTextL();
       
  1273     void UninstallEmptyTextL();
       
  1274     // Selections -- these methods form a pair, 
       
  1275     // you must call Fetch first and then push.
       
  1276     void FetchSelectionIndexesFromListBoxL();
       
  1277     void PushSelectionIndexesToListBoxL();
       
  1278     void ClearNextChars();
       
  1279     TBool IsAdaptiveSearch() const; 	
       
  1280 
       
  1281     // HandleItemAddition without ResetFilteringL() call
       
  1282     void HandleItemAdditionL();
       
  1283     void HandleItemRemovalL();
       
  1284 private:
       
  1285     TBool IsItemVisible(const TDesC& aMatchableItemString, const TDesC& aSearchText);
       
  1286     static TBool IsSeparatorCharacter(TChar c);
       
  1287     TBool IsItemSelected(TInt aRealIndex) const;
       
  1288 private:
       
  1289     CArrayFix<TInt> *iShownIndexes; // own // uses non-filtered indexes
       
  1290     CArrayFix<TInt> *iSelectionIndexes; // own   // this uses non-filtered indexes
       
  1291     HBufC *iOldSearchCriteria; // own
       
  1292     MListBoxModel *iModel;
       
  1293     CListBoxView *iView;
       
  1294     TInt iOldItemCount;
       
  1295     HBufC* iEmptyListText; // own
       
  1296     CEikListBox* iListBox;
       
  1297     CAknSearchField* iSearchField;
       
  1298     TBuf<256> iMatchableText;
       
  1299     MCoeControlObserver *iObserver;
       
  1300     CFindExtension *iExtension;
       
  1301     TUint iKeyValue;
       
  1302     CCoeControl *iParentControl;
       
  1303     TBool iIsPopup;
       
  1304     TBool iDisableChangesToShownIndexes;  
       
  1305     };
       
  1306 
       
  1307 
       
  1308 /** Removing optimization that breaks listbox views 
       
  1309  * A view which removes optimization from CListBoxView which breaks with lists where all items are not
       
  1310  * the same layout.
       
  1311  * Use it like this: 
       
  1312  *   CListBoxView* MakeViewClassInstanceL() { return new(ELeave) NoOptimizationView<CListBoxView>; }
       
  1313  */
       
  1314 template<class T>
       
  1315 class NoOptimizationView : public T
       
  1316     {
       
  1317 public:
       
  1318     virtual void VScrollTo(TInt aNewTopItemIndex, TRect& aMinRedrawRect)
       
  1319     {
       
  1320     // AVKON LAF
       
  1321     if (this->RedrawDisabled())
       
  1322         return;
       
  1323     if (this->iTopItemIndex == aNewTopItemIndex)
       
  1324         return;
       
  1325     aMinRedrawRect.SetRect(this->iViewRect.iTl,this->iViewRect.Size());
       
  1326     this->SetTopItemIndex(aNewTopItemIndex);
       
  1327     this->Draw(&aMinRedrawRect);
       
  1328     // end of AVKON LAF
       
  1329     }
       
  1330     };
       
  1331 
       
  1332 
       
  1333 /** This is private class, do not use it except for drawing controls!
       
  1334  * 
       
  1335  * Do not use it in applications.
       
  1336  */
       
  1337 
       
  1338 
       
  1339 class AknLAFUtils 
       
  1340     {
       
  1341 public:
       
  1342     static void DrawLines(CGraphicsContext* aGc, 
       
  1343                   const TRect& mainpane,
       
  1344                   TInt x);
       
  1345     IMPORT_C static void ReplaceColumn(TPtr aTarget, TDesC* aSource,
       
  1346                                        TDesC* aReplacement, TChar aColumnSeparator,
       
  1347                                        TInt aColumn);
       
  1348     };
       
  1349 
       
  1350 
       
  1351 /**
       
  1352  * Resource reader class
       
  1353  *
       
  1354  * This is utility class for reading listbox resouces.
       
  1355  *
       
  1356  * This should be derived from and it reads resource file for you.
       
  1357  *
       
  1358  * This seems to be only used by listbox resource readers. (Do not use it in applications)
       
  1359  */
       
  1360 struct SAknLayoutGfx;
       
  1361 struct SAknLayoutText;
       
  1362 struct SAknLayoutCmd;
       
  1363 struct SAknLayoutGfx;
       
  1364 // Not for apps
       
  1365 struct SAknLayoutPos 
       
  1366     {
       
  1367     TInt l, t, r, b, W, H;
       
  1368 
       
  1369     typedef SAknLayoutPos ItemType;
       
  1370     static void ReadResource(TResourceReader& aReader, ItemType& aTarget);    
       
  1371     };
       
  1372 template<class T> class CArrayReader;
       
  1373 class CAknGenericReader : public CBase
       
  1374     {
       
  1375 public:
       
  1376     IMPORT_C void ConstructL(TInt aResourceId);
       
  1377     IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
       
  1378     IMPORT_C ~CAknGenericReader();
       
  1379 
       
  1380     IMPORT_C const SAknLayoutGfx* GfxItem(TInt aIndex) const;
       
  1381     IMPORT_C const SAknLayoutText* TextItem(TInt aIndex) const;
       
  1382     IMPORT_C const SAknLayoutCmd* CmdItem(TInt aIndex) const;
       
  1383     IMPORT_C const SAknLayoutGfx* AreaItem(TInt aIndex) const;
       
  1384 
       
  1385     CArrayReader<SAknLayoutGfx>* iGfx;
       
  1386     CArrayReader<SAknLayoutText>* iText;
       
  1387     CArrayReader<SAknLayoutCmd>* iCmd;
       
  1388     CArrayReader<SAknLayoutGfx>* iArea;
       
  1389     };
       
  1390 
       
  1391 
       
  1392 
       
  1393 
       
  1394 
       
  1395 // Use this to mark that the position in LAF specification is empty.
       
  1396 const TInt AknLayoutUtilsNoValue = ELayoutEmpty;
       
  1397 
       
  1398 /** Utility classes to build layout based on European LAF from resource files. (can be used by applications)
       
  1399  *
       
  1400  * Methods in this class are designed to be called from your control's SizeChanged() method!
       
  1401  *
       
  1402  * This class knows the specification's coordinate data format and ensures that different types of
       
  1403  * controls are positioned and setup correctly according to European LAF. 
       
  1404  * 
       
  1405  * This class helps you with positioning labels, controls, rects and other things to according to LAF specification.
       
  1406  * (It is NOT trivial to get it correct and this adjusts easily to changes in the LAF specification - if you're not
       
  1407  * using this, remember to read the whole LAF specification - especially the beginning and the end with color and
       
  1408  * especially how text margins and widths interact!!)
       
  1409  *
       
  1410  * (idea of this class is that when specification of one component changes, only resource file needs to be changed and when you 
       
  1411  * get new product with new specification format, only this module needs to be changed and resources rewritten from the specification. 
       
  1412  * And when component's specification changes, only the component need to be changed (usually only change is what components are
       
  1413  * inside it and how it calls this module.).. => all controls have common format that decides its layout!
       
  1414  *
       
  1415  * Parent rectangles are always coordinates of LAF specification's parent rectangle in the screen.
       
  1416  * 
       
  1417  * To use this, call one of the methods in your SizeChanged() and then you'll need to make sure you
       
  1418  * draw the area between controls using ClearBetweenRects() call from egul library. (CCoeControl::Rect() helps with that...)
       
  1419  *
       
  1420  * A Tip: You do not want to use any dynamic calculation of layouts! It is almost always an error to do so!
       
  1421  *        => Do not allow layouts that have not been specified!
       
  1422  *
       
  1423  * (If LAF spec has many numbers and you need to dynamically choose between them, then keep the numbers in
       
  1424  * code as function-local using SAknLayoutText/SAknLayoutRect/... -structs..)
       
  1425  *
       
  1426  * You'll want to use TAknLayoutRect and TAknLayoutText too to build layout
       
  1427  * for your custom controls.
       
  1428  */
       
  1429 class AknLayoutUtils
       
  1430     {
       
  1431 public:
       
  1432 
       
  1433     struct SAknLayoutText
       
  1434     {
       
  1435     TInt iFont, iC, iL, iR, iB, iW, iJ;
       
  1436     };
       
  1437     struct SAknLayoutTextMultiline
       
  1438     {
       
  1439     TInt iFont, iC, iL, iR, iB, iW, iJ, iNumberOfLinesShown, iNextLineB;
       
  1440     };
       
  1441     typedef SAknLayoutTextMultiline SAknLayoutLabel;
       
  1442     typedef SAknLayoutTextMultiline SAknLayoutEdwin;
       
  1443     typedef SAknLayoutText SAknLayoutMfne;
       
  1444     typedef SAknLayoutText SAknLayoutSecEd;
       
  1445     struct SAknLayoutRect
       
  1446     {
       
  1447     TInt iC, iL, iT, iR, iB, iW, iH;
       
  1448     };
       
  1449     typedef SAknLayoutRect SAknLayoutControl;
       
  1450     typedef SAknLayoutRect SAknLayoutImage;
       
  1451 
       
  1452     /**
       
  1453     * Deprecated! Do not use!
       
  1454     */
       
  1455     IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
       
  1456                                      const TRect& aLabelParent,
       
  1457                                      TInt aResourceId,
       
  1458                                      const CFont* aCustomFont=0);
       
  1459 
       
  1460     /**
       
  1461     * Deprecated! Do not use!
       
  1462     */
       
  1463     IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
       
  1464                                      const TRect& aLabelParent,
       
  1465                                      TResourceReader& aReader,
       
  1466                                      const CFont* aCustomFont=0);
       
  1467 
       
  1468     /** Layouts a label via a structure of layout parameters
       
  1469     @param aLayout   the structure
       
  1470      */
       
  1471     IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
       
  1472                                      const TRect& aLabelParent,
       
  1473                                      const SAknLayoutLabel& aLayout,
       
  1474                                      const CFont *aCustomFont=0);
       
  1475 
       
  1476     /** Layouts a label via a layout compiler output
       
  1477     @param aLayout   a define from aknlayout.lag file
       
  1478      */
       
  1479     IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
       
  1480                                      const TRect& aLabelParent,
       
  1481                                      const TAknMultiLineTextLayout& aLayout,
       
  1482                                      const CFont *aCustomFont=0);
       
  1483 
       
  1484     /** Layouts a label via a layout compiler output
       
  1485     @param aLayout   a define from aknlayout.lag file
       
  1486      */
       
  1487     IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
       
  1488                                      const TRect& aLabelParent,
       
  1489                                      const TAknTextLineLayout& aLayout,
       
  1490                                      const CFont *aCustomFont=0);
       
  1491 
       
  1492     /** Layouts a label via parameters from the specification
       
  1493     @param aLayout   a define from aknlayout.lag file
       
  1494     @param font      font id, ELatinPlain12, ELatinBold12, ELatinBold13, ELatinBold17, ELatinBold19 etc..
       
  1495     @param C         colour index, 0..255
       
  1496     @param l         left margin
       
  1497     @param r         right margin
       
  1498     @param B         Baseline from top of the parent rectangle
       
  1499     @param W         text width in pixels
       
  1500     @param J         justification. ELayoutAlignNone; ELayoutAlignCenter; ELayoutAlignLeft; ELayoutAlignRight; ELayoutAlignBidi
       
  1501     @param NextLineB baseline of 2nd line for multi-line labels/editors
       
  1502     @param aCustomFont   a font used, if resource file uses EFontCustom
       
  1503      */
       
  1504     IMPORT_C static void LayoutLabel(CEikLabel* aLabel,
       
  1505                                      const TRect& aLabelParent,
       
  1506                                      TInt font, TInt C,
       
  1507                                      TInt l, TInt r,
       
  1508                                      TInt B, TInt W,
       
  1509                                      TInt J, TInt NextLineB=0,
       
  1510                                      const CFont* aCustomFont=0);
       
  1511 
       
  1512     /**
       
  1513     * Deprecated! Do not use!
       
  1514     */
       
  1515     IMPORT_C static void LayoutEdwin(CEikEdwin* aEdwin,
       
  1516                                      const TRect& aEdwinParent,
       
  1517                                      TInt aResourceId,
       
  1518                                      TInt aNumberOfLines = 0,
       
  1519                                      const CFont* aCustomFont=0,
       
  1520                                      TBool aMinimizeEdwinView=EFalse);
       
  1521     /**
       
  1522     * Deprecated! Do not use!
       
  1523     */
       
  1524     IMPORT_C static void LayoutEdwin(CEikEdwin* aEdwin,
       
  1525                                      const TRect& aEdwinParent,
       
  1526                                      TResourceReader& aReader,
       
  1527                                      TInt aNumberOfLines = 0,
       
  1528                                      const CFont* aCustomFont=0,
       
  1529                                      TBool aMinimizeEdwinView=EFalse);
       
  1530 
       
  1531     /** Layouts an editor via a structure of layout parameters
       
  1532     @param aLayout   the structure
       
  1533      */
       
  1534     IMPORT_C static void LayoutEdwin(CEikEdwin* aEdwin,
       
  1535                                      const TRect& aEdwinParent,
       
  1536                                      const SAknLayoutEdwin& aLayout,
       
  1537                                      const CFont* aCustomFont=0,
       
  1538                                      TBool aMinimizeEdwinView=EFalse);
       
  1539 
       
  1540     /** Layouts an editor via a structure of layout parameters
       
  1541     @param aLayout   the structure
       
  1542      */
       
  1543 
       
  1544     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1545                                       const TRect& aEdwinParent,
       
  1546                                       const TAknMultiLineTextLayout& aLayout,
       
  1547                                       const CFont* aCustomFont=0,
       
  1548                                       TBool aMinimizeEdwinView=EFalse);
       
  1549 
       
  1550     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1551                                       const TRect& aEdwinParent,
       
  1552                                       const TAknMultiLineTextLayout& aLayout,
       
  1553                                       TAknsQsnTextColorsIndex aOverrideColor,
       
  1554                                       const CFont* aCustomFont=0,
       
  1555                                       TBool aMinimizeEdwinView=EFalse ); 
       
  1556         
       
  1557 
       
  1558 
       
  1559     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1560                                       const TRect& aEdwinParent,
       
  1561                                       const TAknTextLineLayout& aLayout,
       
  1562                                       const CFont* aCustomFont=0,
       
  1563                                       TBool aMinimizeEdwinView=EFalse );
       
  1564 
       
  1565     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1566                                       const TRect& aEdwinParent,
       
  1567                                       const TAknTextLineLayout& aLayout,
       
  1568                                       TAknsQsnTextColorsIndex aOverrideColor,
       
  1569                                       const CFont* aCustomFont=0,
       
  1570                                       TBool aMinimizeEdwinView=EFalse );
       
  1571 
       
  1572     /** 
       
  1573     * Routine to perform standard layout of a CEikEdwin editor.  Two elements from the S60 layout data are required: 
       
  1574     * The rectangle of the containing layout element, and the TAknTextLineLayout object created for the contained text pane element. 
       
  1575     * 
       
  1576     * Override parameters can be supplied for a different number of lines, a different baseline separation,
       
  1577     * or substituted skin color. Various "Do Not Override" values are to be passed if the values passed in aLayout are to be used. 
       
  1578     * Refer to the parameters' documentation.
       
  1579     * 
       
  1580     * The lower extent of the editor to be laid out (whether driven by the NumberOfLinesToShow() 
       
  1581     * feature of the TAknTextLineLayout object, or overridden by aNumberOfLinesToShowOverRide)
       
  1582     * will not extend below the lower limit of the rectangle aEdwinParent.  Thus the number of
       
  1583     * lines formatted is limited, and is available as an output parameter.
       
  1584     * 
       
  1585     * The height of the editor is also restricted by any value previously set in 
       
  1586     * CEikEdwin::SetMaximumHeightInLines().
       
  1587     * 
       
  1588     * @since 3.1 
       
  1589     * 
       
  1590     * @param aEdwin          pointer to the editor to be laid out 
       
  1591     * @param aEdwinParent    rectangle of the containing layout element 
       
  1592     * @param aLayout         object representing the layout of the text pane implemented by this editor 
       
  1593     * @param aNumberOfLinesToShowOverride  number of lines overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
       
  1594     * @param aBaselineSeparationOverride   vertical separation of baselines overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
       
  1595     * @param aOverrideColor      Avkon Skins color index to override with, if 
       
  1596     *                            not (TAknsQsnTextColorsIndex)KAknLayoutUtilsDoNotOverride 
       
  1597     * @param aNumberOfVisibleLines  Number of lines of editor actually laid out.
       
  1598     */ 
       
  1599     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1600                          const TRect& aEdwinParent,
       
  1601                          const TAknTextLineLayout& aLayout,
       
  1602                          TInt aNumberOfLinesToShowOverRide,
       
  1603                          TInt aBaselineSeparationOverRide,
       
  1604                          TAknsQsnTextColorsIndex aOverrideColor, 
       
  1605                          TInt& aNumberOfVisibleLines );
       
  1606                                  
       
  1607     /** Layouts an editor via parameters from the specification
       
  1608     @param aLayout   a define from aknlayout.lag file
       
  1609     @param font      font id, ELatinPlain12, ELatinBold12, ELatinBold13, ELatinBold17, ELatinBold19 etc..
       
  1610     @param C         colour index, 0..255
       
  1611     @param l         left margin
       
  1612     @param r         right margin
       
  1613     @param B         Baseline from top of the parent rectangle
       
  1614     @param W         text width in pixels
       
  1615     @param J         justification. ELayoutAlignNone; ELayoutAlignCenter; ELayoutAlignLeft; ELayoutAlignRight; ELayoutAlignBidi
       
  1616     @param aNumberOfLinesShown number of lines visible for the editor
       
  1617     @param NextLineB baseline of 2nd line for multi-line labels/editors
       
  1618     @param aMinimizeEdwinView whether to use minimum size. You need to use MinimizedEdwinRect() if you use ETrue here.
       
  1619      */
       
  1620     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1621                                       const TRect& aEdwinParent,
       
  1622                                       TInt font,
       
  1623                                       TInt C,
       
  1624                                       TInt l,
       
  1625                                       TInt r,
       
  1626                                       TInt B,
       
  1627                                       TInt W,
       
  1628                                       TInt J,
       
  1629                                       TInt aNumberOfLinesShown,
       
  1630                                       TInt aNextLineBaseline,
       
  1631                                       const CFont* aCustomFont=0 ,
       
  1632                                       TBool aMinimizeEdwinView=EFalse );
       
  1633 
       
  1634     IMPORT_C static void LayoutEdwin( CEikEdwin* aEdwin,
       
  1635                                       const TRect& aEdwinParent,
       
  1636                                       TInt font,
       
  1637                                       TInt C,
       
  1638                                       TInt l,
       
  1639                                       TInt r,
       
  1640                                       TInt B,
       
  1641                                       TInt W,
       
  1642                                       TInt J,
       
  1643                                       TInt aNumberOfLinesShown,
       
  1644                                       TInt aNextLineBaseline,
       
  1645                                       TAknsQsnTextColorsIndex aOverrideColor,
       
  1646                                       const CFont* aCustomFont=0 ,
       
  1647                                       TBool aMinimizeEdwinView=EFalse );
       
  1648     /** Use this, if you give aMinimizeEdwinView to LayoutEdwin as true.
       
  1649      * The edwin will not draw the whole rectangle allocated for the control.
       
  1650      */
       
  1651     IMPORT_C static TRect MinimizedEdwinRect(const CEikEdwin *aEdwin);
       
  1652 
       
  1653 
       
  1654     /**
       
  1655     * Deprecated! Do not use!
       
  1656     */
       
  1657     IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
       
  1658                                     const TRect& aMfneParent,
       
  1659                                     TInt aResourceId);
       
  1660     /**
       
  1661     * Deprecated! Do not use!
       
  1662     */
       
  1663     IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
       
  1664                                     const TRect& aMfneParent,
       
  1665                                     TResourceReader& aReader);
       
  1666 
       
  1667     IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
       
  1668                                     const TRect& aMfneParent,
       
  1669                                     const SAknLayoutMfne& aLayout);
       
  1670 
       
  1671     IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
       
  1672                                     const TRect& aMfneParent,
       
  1673                                     const TAknTextLineLayout& aLayout);
       
  1674 
       
  1675     IMPORT_C static void LayoutMfne(CEikMfne* aMfne,
       
  1676                                     const TRect& aMfneParent,
       
  1677                                     TInt font, TInt C, TInt l, TInt r,
       
  1678                                     TInt B, TInt W, TInt J);
       
  1679 
       
  1680     /**
       
  1681     * Deprecated! Do not use!
       
  1682     */
       
  1683     IMPORT_C static void LayoutControl(CCoeControl* aControl, 
       
  1684                                        const TRect& aControlParent,
       
  1685                                        TInt aResourceId);
       
  1686     /**
       
  1687     * Deprecated! Do not use!
       
  1688     */
       
  1689     IMPORT_C static void LayoutControl(CCoeControl* aControl,
       
  1690                                        const TRect& aControlParent,
       
  1691                                        TResourceReader& aReader);
       
  1692 
       
  1693     IMPORT_C static void LayoutControl(CCoeControl* aControl,
       
  1694                                        const TRect& aControlParent,
       
  1695                                        const SAknLayoutControl& aLayout);
       
  1696 
       
  1697     IMPORT_C static void LayoutControl(CCoeControl* aControl, 
       
  1698                                        const TRect& aControlParent,
       
  1699                                        const TAknWindowLineLayout& aLayout);
       
  1700 
       
  1701     IMPORT_C static void LayoutControl(CCoeControl* aControl,
       
  1702                                        const TRect& aControlParent,
       
  1703                                        TInt /*C*/, TInt l, TInt t, TInt r, TInt b,
       
  1704                                        TInt W, TInt H);
       
  1705 
       
  1706     /**
       
  1707     * Deprecated! Do not use!
       
  1708     */
       
  1709     IMPORT_C static void LayoutImage(CEikImage* aImage,
       
  1710                                      const TRect& aParent,
       
  1711                                      TInt aResourceId);
       
  1712     /**
       
  1713     * Deprecated! Do not use!
       
  1714     */    
       
  1715     IMPORT_C static void LayoutImage(CEikImage* aImage, 
       
  1716                                      const TRect& aParent,
       
  1717                                      TResourceReader& aReader);
       
  1718 
       
  1719     IMPORT_C static void LayoutImage(CEikImage* aImage, 
       
  1720                                      const TRect& aParent,
       
  1721                                      const SAknLayoutControl& aLayout);
       
  1722 
       
  1723     IMPORT_C static void LayoutImage(CEikImage* aImage,
       
  1724                                      const TRect& aParent,
       
  1725                                      const TAknWindowLineLayout& aLayout);
       
  1726 
       
  1727     IMPORT_C static void LayoutImage(CEikImage* aImage,
       
  1728                                      const TRect& aParent,
       
  1729                                      TInt C, TInt l, TInt t, TInt r, TInt b,
       
  1730                                      TInt W, TInt H);
       
  1731 
       
  1732     /** Sets CEikSecretEditor's position, colors and fonts based on LAF specification
       
  1733      *
       
  1734      */
       
  1735     IMPORT_C static void LayoutSecretEditor(CEikSecretEditor* aSecEd,
       
  1736                                             const TRect& aParent,
       
  1737                                             const SAknLayoutText& aLayout);
       
  1738 
       
  1739     IMPORT_C static void LayoutSecretEditor(CEikSecretEditor* aSecEd,
       
  1740                                             const TRect& aParent,
       
  1741                                             const TAknTextLineLayout& aLayout);
       
  1742 
       
  1743 public:
       
  1744     /** Different conversions
       
  1745      * Fonts: ELatinPlain12, ELatinBold12, ELatinBold13, ELatinBold17, ELatinBold19, ENumberPlain5, EClockBold30, ELatinClock14, EFontCustom
       
  1746      *        EAknLogicalFontPrimaryFont, EAknLogicalFontSecondaryFont, EAknLogicalFontTitleFont,
       
  1747      * Alignments: ELayoutAlignNone, ELayoutAlignCenter, ELayoutAlignLeft, ELayoutAlignRight, ELayoutAlignBidi with these..
       
  1748      */
       
  1749     IMPORT_C static TRect TextRectFromCoords(const TRect& aParent,
       
  1750                                              const CFont* aFont,
       
  1751                                              TInt l, TInt r,
       
  1752                                              TInt B, TInt W,
       
  1753                                              TInt LB = 0);
       
  1754 
       
  1755     IMPORT_C static TRect RectFromCoords(const TRect& aParent,
       
  1756                                          TInt l, TInt t, TInt r, TInt b,
       
  1757                                          TInt W, TInt H);
       
  1758 
       
  1759     /**
       
  1760     * Method to return a useable system font reference from a S60 font enumeration from among
       
  1761     * the supported list.
       
  1762     * 
       
  1763     * This method should only be used if application code needs to render its own graphics. That is, it
       
  1764     * is not using S60 controls and furthermore not using the recommended methods 
       
  1765     * AknLayoutUtils::LayoutEdwin(), AknLayoutUtils::LayoutLabel() or AknLayoutUtils::LayoutSecretEditor(). 
       
  1766     * 
       
  1767     * Fonts returned by this are not recommended to be stored in clients' member data, but should be
       
  1768     * accessed when they are required for use.
       
  1769     *
       
  1770     * Applications that are written to run with their layout dynamically adapting to different screen sizes 
       
  1771     * should use only the values found in the S60 logical font enumeration, TAknLogicalFontId.
       
  1772     * 
       
  1773     * @param aFontId        Input S60 font id.
       
  1774     * @param aCustomFont    Font to return if aFontId is given as EFontCustom
       
  1775     * @return               const pointer to a system font, or aCustomFont
       
  1776     */
       
  1777     IMPORT_C static const CFont* FontFromId(TInt aFontId, const CFont* aCustomFont=0);
       
  1778 
       
  1779     /**
       
  1780     * Method to return a system font reference from a S60 font id. This will always conform to type CAknLayoutFont
       
  1781     * 
       
  1782     * This method should only be used if application code needs to render its own graphics. That is, it
       
  1783     * is not using S60 controls and furthermore not using the recommended methods 
       
  1784     * AknLayoutUtils::LayoutEdwin(), AknLayoutUtils::LayoutLabel() or AknLayoutUtils::LayoutSecretEditor(). 
       
  1785     * 
       
  1786     * Fonts returned by this are not recommended to be stored in clients' member data, but should be
       
  1787     * accessed when they are required for use.
       
  1788     *
       
  1789     * Applications that are written to run with their layout dynamically adapting to different screen sizes 
       
  1790     * should use only the values found in the S60 logical font enumeration, TAknLogicalFontId.
       
  1791     * 
       
  1792     * @param aFontId        Input S60 font id.
       
  1793     * @param aCustomFont    Font to return if aFontId is given as EFontCustom
       
  1794     * @return               const pointer to a system font, or aCustomFont
       
  1795     */
       
  1796     IMPORT_C static const CAknLayoutFont* LayoutFontFromId(TInt aId, 
       
  1797                                                            const CAknLayoutFont *aCustomFont = 0);
       
  1798 
       
  1799     /**
       
  1800     * Return a fully constructed CAknLayoutFont object based upon the specification passed in.
       
  1801     * The Avkon font specifiation object uses TAknFontCategory to determine the font. 
       
  1802     *
       
  1803     * The font object is returned as non-const, since it is owned and will eventually be deleted by the client.
       
  1804     * 
       
  1805     * @param aSpec     S60 font specification object
       
  1806     * @return               pointer to a CAknLayoutFont object, owned by the caller
       
  1807     */
       
  1808     IMPORT_C static CAknLayoutFont* CreateLayoutFontFromSpecificationL( 
       
  1809         const TAknFontSpecification& aSpec );
       
  1810 
       
  1811     /**
       
  1812     * Return a fully constructed CAknLayoutFont object based upon the typeface and specification passed in.
       
  1813     * The TTypeface object contains a typeface name that is used as the primary key to select a font.  
       
  1814     * The S60  font specifiation object is also used, but any value of TAknFontCategory passed in is reset to 
       
  1815     * EAknFontCategoryUndefined, and is not used to select the font. 
       
  1816     *
       
  1817     * The font object is returned as non-const, since it is owned and will eventually be deleted by the client.
       
  1818     * 
       
  1819     * @param aTypeface      Symbian Typface object
       
  1820     * @param aSpec             S60 font specification object
       
  1821     * @return                       pointer to a CAknLayoutFont object, owned by the caller
       
  1822     */
       
  1823     IMPORT_C static CAknLayoutFont* CreateLayoutFontFromSpecificationL( 
       
  1824         const TTypeface& aTypeface, 
       
  1825         const TAknFontSpecification& aSpec);
       
  1826 
       
  1827     /**
       
  1828     * Deprecated! Do not use!
       
  1829     */
       
  1830     IMPORT_C static const CFont* FontFromName(const TDesC& aName); 
       
  1831 
       
  1832     IMPORT_C static CGraphicsContext::TTextAlign TextAlignFromId(TInt aId);
       
  1833 
       
  1834     IMPORT_C static TGulAlignment GulAlignFromId(TInt aId);
       
  1835 
       
  1836     IMPORT_C static TInt CursorHeightFromFont(const TFontSpec& aFont);
       
  1837 
       
  1838     IMPORT_C static TInt CursorWidthFromFont (const TFontSpec& aFont);
       
  1839 
       
  1840     IMPORT_C static TInt CursorAscentFromFont(const TFontSpec& aFont);
       
  1841 
       
  1842     IMPORT_C static void CursorExtensionsFromFont(const TFontSpec& /*aFont*/,
       
  1843                                                   TInt& aFirstExtension,
       
  1844                                                   TInt& aSecondExtension);
       
  1845 
       
  1846     IMPORT_C static TInt HighlightLeftPixelsFromFont (const TFontSpec& aFont);
       
  1847 
       
  1848     IMPORT_C static TInt HighlightRightPixelsFromFont(const TFontSpec& aFont);
       
  1849     static void HighlightExtensionsFromFont(const TInt fontid,
       
  1850                                             TInt& aLeft, TInt& aRight,
       
  1851                                             TInt&  aTop, TInt& aBottom);
       
  1852 
       
  1853     /**
       
  1854     * Access the system font array to see if there is a font that matches the  
       
  1855     * font specification presented in Twips. Device map is also passed in case the 
       
  1856     * system font array has fonts from different devices.
       
  1857     * 
       
  1858     * A null return value means that the system font array is not constructed yet, or does
       
  1859     * not contain a font that has the same TFontSpec or device map.
       
  1860     *
       
  1861     * @param aSpec  Symbian font specification object to match
       
  1862     * @param aMap   Device map to disambiguate fonts on different devices
       
  1863     * @return       NULL if no match was found; otherwise a CAknLayoutFont pointer
       
  1864     **/
       
  1865     static const CAknLayoutFont* MatchFontFromSystemFontArray( 
       
  1866         const TFontSpec& aSpec, MGraphicsDeviceMap* aMap );
       
  1867 
       
  1868     IMPORT_C static TBool LayoutMirrored();
       
  1869 
       
  1870     /*
       
  1871     * This method returns build variant based on which flag is active,
       
  1872     * __AVKON_ELAF__ or __AVKON_APAC__.
       
  1873     *
       
  1874     * If you need to decide which layout to use, do not do it based on this method.
       
  1875     * Instead, use CAknEnv::GetCurrentLayoutId().
       
  1876     *
       
  1877     * @return current variant
       
  1878     */
       
  1879     IMPORT_C static EVariantFlag Variant();
       
  1880 
       
  1881     IMPORT_C static ESubVariantFlag SubVariant();
       
  1882 
       
  1883     IMPORT_C static void OverrideControlColorL(
       
  1884         CCoeControl& aControl,
       
  1885         TLogicalColor aLogicalColor,
       
  1886         TRgb aColor);
       
  1887     
       
  1888     /*
       
  1889     * This method returns the default scrollbar type for the given application. 
       
  1890     * For non-layout aware applications (e.g. legacy apps designed for 176x208 screen) 
       
  1891     * this method returns always EArrowHead. But for layout aware apps the returned type 
       
  1892     * may vary depending on the type of scrollbar which has been set as preferred 
       
  1893     * scrollbar type in the device.
       
  1894     *
       
  1895     * Note that applications may use freely whatever scrollbartype, this method only 
       
  1896     * returns the default scrollbartype for the application.
       
  1897     * 
       
  1898     * @since  2.6
       
  1899     * @param  aApplication Application of which default scrollbar type is requested.
       
  1900     * @return Default scrollbar type for the given application
       
  1901     */
       
  1902     IMPORT_C static CEikScrollBarFrame::TScrollBarType DefaultScrollBarType(CAknAppUiBase* aApplication);
       
  1903 
       
  1904     /*
       
  1905     * This method sets the layout for vertical scrollbar of the given scrollbar frame. Layout
       
  1906     * can freely only be set for EDoubleSpan type scrollbars.
       
  1907     * 
       
  1908     * @since  2.6
       
  1909     * @param  aScrollBarFrame   Scrollbarframe of which vertical scrollbar layout will be set.
       
  1910     * @param  aControlParent    Rect of the parent control of the scrollbarframe.
       
  1911     * @param  aLayout           Layout for the vertical scrollbar.
       
  1912     *
       
  1913     *
       
  1914     * This method can also be useful when layout of the scrollbar needs to be changed for scrollbars
       
  1915     * which are owned by some other components such as e.g. ListBoxes, Editors or Grids.
       
  1916     *
       
  1917     * Example of use:
       
  1918     *
       
  1919     *  // Get a pointer to scrollbarframe of the listbox
       
  1920     *  CEikScrollBarFrame* frame = iListBox->ScrollBar();
       
  1921     *  
       
  1922     *  // Get the layout data
       
  1923     *  TAknWindowLineLayout layout = GetMyListBoxLayout();
       
  1924     *  Trect parentRect = GetMyListBoxParentRect();
       
  1925     *
       
  1926     *  // Set the layout
       
  1927     *  AknLayoutUtils::LayoutVerticalScrollBar(frame, parentRect, layout);
       
  1928     *
       
  1929     *  // The layout for scrollbar is now set.
       
  1930     *
       
  1931     */
       
  1932     IMPORT_C static void LayoutVerticalScrollBar(
       
  1933         CEikScrollBarFrame* aScrollBarFrame,
       
  1934         const TRect& aControlParent,
       
  1935         const TAknWindowLineLayout& aLayout);
       
  1936 
       
  1937     /*
       
  1938     * This method sets the layout for horizontal scrollbar of the given scrollbar frame. Layout
       
  1939     * can freely only be set for EDoubleSpan type scrollbars.
       
  1940     * 
       
  1941     * @since  2.6
       
  1942     * @param  aScrollBarFrame   Scrollbarframe of which horizontal scrollbar layout will be set.
       
  1943     * @param  aControlParent    Rect of the parent control of the scrollbarframe.
       
  1944     * @param  aLayout           Layout for the horizontal scrollbar.
       
  1945     *
       
  1946     *
       
  1947     * Usage of this method is similar as for LayoutVerticalScrollBar().
       
  1948     *
       
  1949     */
       
  1950     IMPORT_C static void LayoutHorizontalScrollBar(
       
  1951         CEikScrollBarFrame* aScrollBarFrame,
       
  1952         const TRect& aControlParent,
       
  1953         const TAknWindowLineLayout& aLayout);
       
  1954 
       
  1955 public:   // Metrics API
       
  1956 
       
  1957     /**
       
  1958     * Layout Metrics.
       
  1959     */
       
  1960     enum TAknLayoutMetrics
       
  1961     {
       
  1962         /** Screen. */
       
  1963         EScreen,
       
  1964         
       
  1965         /** Window that fills the entire screen. */
       
  1966         EApplicationWindow,
       
  1967         
       
  1968         /** Indicates common components for most of the applications. */
       
  1969         EStatusPane,
       
  1970         
       
  1971         /** The application main pane is used in all the applications */
       
  1972         EMainPane,
       
  1973         
       
  1974         /** Control pane. */
       
  1975         EControlPane,   
       
  1976         
       
  1977         /** The signal pane is used to indicate signal strength. */
       
  1978         ESignalPane,
       
  1979         
       
  1980         /** The context pane is used to indicate an active application. */
       
  1981         EContextPane,
       
  1982         
       
  1983         /** Used to indicate the subject or the name of the main pane content.*/
       
  1984         ETitlePane,
       
  1985         
       
  1986         /** The battery pane is used to indicate battery strength. */
       
  1987         EBatteryPane,
       
  1988         
       
  1989         /** 
       
  1990          * The universal indicator pane is used to indicate items that require
       
  1991          * the user's attention while browsing applications.
       
  1992          */
       
  1993         EUniversalIndicatorPane,
       
  1994         
       
  1995         /** 
       
  1996          * The navi pane is used to indicate navigation within an application,
       
  1997          * to provide context sensitive information to the user while entering
       
  1998          * or editing data, or to show additional information.
       
  1999          */
       
  2000         ENaviPane,
       
  2001         
       
  2002         /** 
       
  2003          * A fixed find pane is used with lists instead of the find pop-up
       
  2004          * window. */
       
  2005         EFindPane,
       
  2006         
       
  2007         /** Wallpaper pane. */
       
  2008         EWallpaperPane,
       
  2009         
       
  2010         /** 
       
  2011          * The universal indicator pane is used to indicate items that require
       
  2012          * the user's attention while browsing applications.
       
  2013          */
       
  2014         EIndicatorPane,
       
  2015         
       
  2016         /** Used generally to display small sized graphics or heading texts. */
       
  2017         EAColunm,
       
  2018         
       
  2019         /** Used generally to display large sized icons or heading texts. */
       
  2020         EBColunm,
       
  2021         
       
  2022         /** 
       
  2023          * Used generally to display data entered by the user. Overlaps with
       
  2024          * the D column.
       
  2025          */
       
  2026         ECColunm,
       
  2027         
       
  2028         /** 
       
  2029          * Used generally to display additional icons. Overlaps with
       
  2030          * the C column.
       
  2031          */
       
  2032         EDColunm,
       
  2033         
       
  2034         /** @deprecated, do not use */
       
  2035         EStatusPaneSecondary,
       
  2036         
       
  2037         /** deprecated, do not use */
       
  2038         EControlPaneSecondary,
       
  2039         
       
  2040         /** Top part of status and control panes in landscape layout. */
       
  2041         EStaconTop,
       
  2042         
       
  2043         /** Bottom part of status and control panes in landscape layout. */
       
  2044         EStaconBottom,
       
  2045 
       
  2046         /** */
       
  2047         EPopupParent,
       
  2048         
       
  2049         /** Bottom part of status pane in landscape layout. */
       
  2050         EStatusPaneBottom = EStatusPaneSecondary,
       
  2051         
       
  2052         /** Bottom part of control pane in landscape layout. */
       
  2053         EControlPaneBottom = EControlPaneSecondary,
       
  2054         
       
  2055         /** Top part of control pane in landscape layout. */
       
  2056         EControlPaneTop = EControlPane,
       
  2057         
       
  2058         /** Top part of status pane in landscape layout. */
       
  2059         EStatusPaneTop = EStatusPane
       
  2060     };
       
  2061 
       
  2062 
       
  2063     /**
       
  2064     * Fills given TRect with rectangle for given layout component. 
       
  2065     * Returns EFalse for status pane descendants if requested
       
  2066     * layout component is not available in current layout. For
       
  2067     * other components returns always ETrue (returned rectangle is
       
  2068     * from layout definition).
       
  2069     *
       
  2070     * @since  2.8
       
  2071     * @param  aParam   Layout component to be queried. 
       
  2072     * @param  aRect    Resulting rectangle.
       
  2073     * @param  ETrue    If requested value was available.
       
  2074     *         EFalse   Otherwise.
       
  2075     */
       
  2076     IMPORT_C static TBool LayoutMetricsRect(TAknLayoutMetrics aParam, TRect& aRect);
       
  2077 
       
  2078     /**
       
  2079     * This method returns size of rectangle for given layout component.
       
  2080     * Returns EFalse for status pane descendants if requested
       
  2081     * layout component is not available in current layout. For
       
  2082     * other components returns always ETrue (returned size is
       
  2083     * from layout definition).
       
  2084     *
       
  2085     * @since  2.8
       
  2086     * @param  aParam   Layout component to be queried. 
       
  2087     * @param  aSize    Resulting size.
       
  2088     * @param  ETrue    If requested value was available.
       
  2089     *         EFalse   Otherwise.
       
  2090     */
       
  2091     IMPORT_C static TBool LayoutMetricsSize(TAknLayoutMetrics aParam, TSize& aSize);
       
  2092 
       
  2093     /**
       
  2094     * This method returns position of top left corner for given layout component.
       
  2095     * Returns EFalse for status pane descendants if requested
       
  2096     * layout component is not available in current layout. For
       
  2097     * other components returns always ETrue (returned position is
       
  2098     * from layout definition).
       
  2099     *
       
  2100     * @since  2.8
       
  2101     * @param  aParam   Layout component to be queried. 
       
  2102     * @param  aPos     Resulting position.
       
  2103     * @param  ETrue    If requested value was available.
       
  2104     *         EFalse   Otherwise.
       
  2105     */
       
  2106     IMPORT_C static TBool LayoutMetricsPosition(TAknLayoutMetrics aParan, TPoint& aPos);
       
  2107 public:
       
  2108     /**
       
  2109     * This method returns a new value for a baseline, based upon a value for bottom and 
       
  2110     * a value for height. For legacy layout data, the baseline will be correct, and this
       
  2111     * method will detect that it is a legacy font id and just return aBottom. 
       
  2112     * However, for scalable layout data, the bottom value will be hidden inside 
       
  2113     * the old baseline variable, so call this method passing in 'iB', NOT passing in 'ib'
       
  2114     * ... e.g.: (the following line is an example, so is ok to have commented out code)
       
  2115     * TInt newbaseline = CorrectBaseline(myLayoutLine.iB, myLayoutLine.iFont);
       
  2116     *
       
  2117     * @since  2.8
       
  2118     * @param  aBottom  Baseline or Bottom value of text pane (found in TAknTextLineLayout.iB)
       
  2119     * @param  aFontId     FontId of text pane (for scalable layouts, this will encode the height)
       
  2120     * @return   new Baseline value
       
  2121     */
       
  2122     static TInt CorrectBaseline(TInt aParentHeight, TInt aBaseline, TInt aFontId);
       
  2123 
       
  2124     /**
       
  2125     * This method updates fontid if it has ELayoutEmpty or parent relative values
       
  2126     */
       
  2127     static void CorrectFontId(TRect aParent, TInt at, TInt aH, TInt ab, TInt &aFontId);
       
  2128 
       
  2129     /**
       
  2130     * This method tells if the scalable layout interface is available.
       
  2131     * 
       
  2132     * @internal
       
  2133     * @return ETrue if scalable layout interface can be used, otherwise EFalse.
       
  2134     */
       
  2135     IMPORT_C static TBool ScalableLayoutInterfaceAvailable();
       
  2136     
       
  2137     /*
       
  2138     * Enumeration of CBA's possible locations.
       
  2139     * @since 3.0
       
  2140     */
       
  2141     enum TAknCbaLocation
       
  2142         {
       
  2143         EAknCbaLocationBottom, //landscape and portrait
       
  2144         EAknCbaLocationRight,  //only landscape
       
  2145         EAknCbaLocationLeft    //only landscape
       
  2146         };
       
  2147     
       
  2148     /**
       
  2149     * This method tells location of softkeys (CBA) field in current running application. 
       
  2150     * Possible location of softkeys are bottom (portrait and landscape), left and right 
       
  2151     * (only landscape).
       
  2152     *
       
  2153     * @since 3.0
       
  2154     * @return TAknCbaLocation
       
  2155     */
       
  2156     IMPORT_C static TAknCbaLocation CbaLocation();
       
  2157 
       
  2158     /**
       
  2159     * Used by pop-ups to align themselves around the given highlighted area.
       
  2160     * @param aHighlightRect Highlighted area.
       
  2161     * @param aControl Control whose position should be calculated,
       
  2162     * @return TRect Size and position of pop-up.
       
  2163     */
       
  2164     static TRect HighlightBasedRect( const TRect& aHighlightRect, CCoeControl* aControl );
       
  2165 
       
  2166     /**
       
  2167      * Flags for main_pane status
       
  2168      */
       
  2169     enum TAknMainPaneState 
       
  2170         {
       
  2171         EAknMainPaneForTinyStatusPane = 0x0001  // for 3x4 grid or app shell list views
       
  2172         };
       
  2173     IMPORT_C static TAknMainPaneState MainPaneState();
       
  2174 
       
  2175     /**
       
  2176     * This method can be used to check whether pen support is enabled.
       
  2177     * @return ETrue if pen support is enabled, otherwise EFalse.
       
  2178     */
       
  2179     IMPORT_C static TBool PenEnabled();
       
  2180     
       
  2181     /**
       
  2182     * This method can be used to check whether MSK support is enabled.
       
  2183     * @return ETrue if MSK support is enabled, otherwise EFalse.
       
  2184     */
       
  2185     IMPORT_C static TBool MSKEnabled();
       
  2186 
       
  2187     /**
       
  2188     * Utility method to be used along side LayoutEdwin methods that take number of lines or 
       
  2189     * baseline separation overrides. 
       
  2190     * 
       
  2191     * This routine returns the edwin height in pixels required to fit exactly the passed-in layout,
       
  2192     * or the layout with overridden baseline separation and/or number of lines.
       
  2193     * 
       
  2194     * The vertical position of the editor is also returned. Note that the correct
       
  2195     * height of the parent layout item is needed in order for this to be calculated properly.
       
  2196     *
       
  2197     * Note that this API does not cause a layout of the editor.
       
  2198     * 
       
  2199     * @since 3.1
       
  2200     *
       
  2201     * @param aParentHeight  Height of the parent layout item
       
  2202     * @param aLayout        S60 layout object for the text to be laid out in the editor
       
  2203     * @param aBaselineSeparationOverride   vertical separation of baselines overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
       
  2204     *                                       aLayout, if not KAknLayoutUtilsDoNotOverride 
       
  2205     * @param aNumberOfLinesToShowOverride   number of lines overriding aLayout, 
       
  2206     *                                       if not KAknLayoutUtilsDoNotOverride 
       
  2207     * @param aEdwinVerticalPositionRelativeToParent     Returns the vertical postion of the editor 
       
  2208     *                                                   relative to its parent when laid out.
       
  2209     * @param aEdwinHeight   The height required in pixels to fit the required number of laid 
       
  2210     *                       out lines plus highlights.
       
  2211     */
       
  2212     IMPORT_C static void GetEdwinVerticalPositionAndHeightFromLines(
       
  2213         TInt aParentHeight,
       
  2214         const TAknTextLineLayout& aLayout,
       
  2215         TInt aBaselineSeparationOverRide,
       
  2216         TInt aNumberOfLinesToShowOverRide,
       
  2217         TInt& aEdwinVerticalPositionRelativeToParent,
       
  2218         TInt& aEdwinHeight
       
  2219         );
       
  2220        
       
  2221     /**
       
  2222     * Utility routine to give the number of text lines that will completely fit, 
       
  2223     * including room for highlights, within the given height, when the passed in layout is
       
  2224     * being used. 
       
  2225     *
       
  2226     * Note that the NumberOfLinesShown() value from the TAknTextLineLayout object is not taken into
       
  2227     * consideration. This routine ignores it, and returns number of lines based upon the font metrics,
       
  2228     * hightlight specification, and the passed in maximum height.
       
  2229     * 
       
  2230     * Note that this API does not cause a layout of the editor.
       
  2231     *
       
  2232     * @since 3.1
       
  2233     *
       
  2234     * @param aLayout    S60 layout object for the text to be laid out in the editor    
       
  2235     * @param aBaselineSeparationOverride   vertical separation of baselines 
       
  2236     *       overriding aLayout, if not KAknLayoutUtilsDoNotOverride 
       
  2237     * @param aMaxHeight     Input maximum height to use for the editor.
       
  2238     * @param aUsedHeight    Returns the number of pixels required for the lines that fit
       
  2239     * @return The number of lines which completely fit
       
  2240     */
       
  2241     IMPORT_C static TInt EdwinLinesWithinHeight (
       
  2242         const TAknTextLineLayout& aLayout,
       
  2243         TInt aBaselineSeparationOverride,
       
  2244         TInt aMaxHeight,
       
  2245         TInt& aUsedHeight
       
  2246         );
       
  2247 };
       
  2248 
       
  2249 /** Low level drawing based on European LAF document (can be used by application's custom controls)
       
  2250  *
       
  2251  * This class reads AVKON_LAYOUT_TEXT resources
       
  2252  */
       
  2253 class TAknLayoutText
       
  2254     {
       
  2255 public:
       
  2256     IMPORT_C TAknLayoutText();
       
  2257     /** Read resources and calculate information needed to draw text.
       
  2258      *
       
  2259      * LayoutText() call should be placed to control's SizeChanged() method.
       
  2260      */
       
  2261     IMPORT_C void LayoutText(const TRect& aParent, TInt aResourceId,
       
  2262                              const CFont* aCustomFont=0);
       
  2263 
       
  2264     IMPORT_C void LayoutText(const TRect& aParent, TResourceReader& aReader,
       
  2265                              const CFont* aCustomFont=0);
       
  2266 
       
  2267     IMPORT_C void LayoutText(const TRect& aParent, 
       
  2268                              const AknLayoutUtils::SAknLayoutText& aLayout,
       
  2269                              const CFont* aCustomFont=0);
       
  2270 
       
  2271     IMPORT_C void LayoutText(const TRect& aParent,
       
  2272                              const TAknTextLineLayout& aLayout,
       
  2273                              const CFont* aCustomFont=0);
       
  2274 
       
  2275     IMPORT_C void LayoutText(const TRect& aParent, TInt fontid, 
       
  2276                              TInt C, TInt l, TInt r, TInt B, TInt W, TInt J,
       
  2277                              const CFont* aCustomFont=0);
       
  2278 
       
  2279     /** Do the actual drawing, should be placed to control's Draw() method.
       
  2280      */
       
  2281     IMPORT_C void DrawText(CGraphicsContext& aGc, const TDesC& aText) const;
       
  2282     
       
  2283     /**
       
  2284     * In case of bidirectional text, which is already converted from logical to
       
  2285     * visual order, use this method with parameter 
       
  2286     * aUseLogicalToVisualConversion EFalse.
       
  2287     */
       
  2288     IMPORT_C void DrawText(
       
  2289         CGraphicsContext& aGc,
       
  2290         const TDesC& aText,
       
  2291         TBool aUseLogicalToVisualConversion ) const;
       
  2292 
       
  2293     IMPORT_C void DrawText(
       
  2294         CGraphicsContext& aGc,
       
  2295         const TDesC& aText,
       
  2296         TBool aUseLogicalToVisualConversion,
       
  2297         const TRgb &aColor) const;
       
  2298                            
       
  2299 
       
  2300 public:
       
  2301     /** This returns rectangle that is used to draw the text.
       
  2302      *
       
  2303      * This allows you to divide screen space for egul's TextUtils::ClearBetweenRect()
       
  2304      * without knowing exact coordinates => when coordinates change, your code 
       
  2305      * does not need to change.
       
  2306      */
       
  2307     IMPORT_C TRect TextRect() const;
       
  2308     const CFont *Font() const { return iFont; }
       
  2309     TRgb Color() const { return AKN_LAF_COLOR_STATIC(iColor); }
       
  2310     CGraphicsContext::TTextAlign Align() const { return iAlign; }
       
  2311     /**
       
  2312     * Returns the baseline position for the font set in this object.
       
  2313     * This value, together with TextRect(), are the metrics that are used to 
       
  2314     * parametrise a call to DrawText, for example:
       
  2315     *      void CGraphicsContext::DrawText( 
       
  2316     *            const TDesC& aText, 
       
  2317     *            const TRect& aBox, 
       
  2318     *            TInt aBaselineOffset, 
       
  2319     *            TTextAlign aAlignment = ELeft,
       
  2320     *            TInt aLeftMargin = 0);
       
  2321     * 
       
  2322     *  TAknLayoutText's own DrawText methods are recommended, however.
       
  2323     * 
       
  2324     *  Notice that this value is relative to the top of the TextRect() rectangle, 
       
  2325     *  which is generally made to bound all accents. Thus this offset value 
       
  2326     *  is usually larger than the CFont::AscentInPixels value.
       
  2327     * 
       
  2328     * @since 3.1 
       
  2329     * @return   distance in pixels measured from the top of the textpane down to the baseline
       
  2330     */
       
  2331     TInt BaselineOffset() const;
       
  2332 private:
       
  2333     TRect iTextRect;
       
  2334     const CFont *iFont; // not owned..
       
  2335     TInt iColor;
       
  2336     TInt iOffset;
       
  2337     CGraphicsContext::TTextAlign iAlign;
       
  2338     friend class CBubbleOutlookNumberEntry;
       
  2339     };
       
  2340 
       
  2341 /** Low level rectangle management based on European LAF document (can be used by application's custom controls)
       
  2342  * 
       
  2343  * This allows you to draw images, rectangles, lines or just calculate rectangles based on LAF spec.
       
  2344  *
       
  2345  * This class reads AVKON_LAYOUT_RECT resources.
       
  2346  *
       
  2347  * Instances of this class should be placed inside controls for reading low level layout from resources.
       
  2348  */
       
  2349 class TAknLayoutRect
       
  2350     {    
       
  2351 public:
       
  2352     IMPORT_C TAknLayoutRect();
       
  2353     /** LayoutRect should be called from control's SizeChanged() method.
       
  2354      */
       
  2355     IMPORT_C void LayoutRect(const TRect &aParent, TInt aResourceId);
       
  2356     IMPORT_C void LayoutRect(const TRect &aParent, TResourceReader &aReader);
       
  2357     IMPORT_C void LayoutRect(const TRect &aParent, 
       
  2358                              const AknLayoutUtils::SAknLayoutRect &aLayout);
       
  2359 
       
  2360     IMPORT_C void LayoutRect(const TRect &aParent,
       
  2361                              const TAknWindowLineLayout &aLayout);
       
  2362 
       
  2363     IMPORT_C void LayoutRect(const TRect &aParent, 
       
  2364                              TInt C, TInt l, TInt t, TInt r, TInt b,
       
  2365                              TInt W, TInt H);
       
  2366     
       
  2367     /** Color() can be called from control's Draw() method. 
       
  2368     
       
  2369     DO NOT CALL it in SizeChanged(), ConstructL() or ActivateL() method, because 
       
  2370     it messes up color scheme changes. Especially if you're using colors 226-248.
       
  2371     If you store color values, be prepared to update TRgb's you store when color
       
  2372     palette is changed! Best thing to do is to make your Draw() methods call
       
  2373     AKN_LAF_COLOR().
       
  2374      */    
       
  2375     IMPORT_C TRgb Color() const;
       
  2376     /** Rect() can be called from control's Draw() or in SizeChanged() as input for some other table's layout code.
       
  2377      */
       
  2378     IMPORT_C TRect Rect() const;
       
  2379     TBool Valid() const;
       
  2380 
       
  2381     /** DrawRect() and DrawImage() should be called from control's Draw() method.
       
  2382      */
       
  2383     IMPORT_C void DrawRect(CWindowGc& aGc) const;
       
  2384     IMPORT_C void DrawOutLineRect(CWindowGc& aGc) const;
       
  2385     IMPORT_C void DrawImage(CBitmapContext& aGc, CFbsBitmap* aBitmap, CFbsBitmap* aMask) const;
       
  2386 private:
       
  2387     TInt iColor;
       
  2388     TRect iRect;
       
  2389     };
       
  2390 
       
  2391 /**
       
  2392  * Helper functions for drawing empty lists and window shadows
       
  2393  */
       
  2394 class AknDraw 
       
  2395     {
       
  2396 public:
       
  2397     /** 
       
  2398     Draws standard empty list
       
  2399     @param aRect the client rectangle
       
  2400     @param aGc   the graphics context
       
  2401     @param aText text for empty list in format "Line1\nLine2"
       
  2402      */
       
  2403     IMPORT_C static void DrawEmptyList(
       
  2404         const TRect& aRect,
       
  2405         CWindowGc& aGc,
       
  2406         TPtrC aText);
       
  2407 
       
  2408     /** 
       
  2409     Draws empty list for setting item editing
       
  2410     @param aRect the rectangle of setting page's content
       
  2411     @param aGc   the graphics context
       
  2412     @param aText text for empty list in format "Line1\nLine2"
       
  2413      */
       
  2414     IMPORT_C static void DrawEmptyListForSettingPage(
       
  2415         const TRect &aRect,
       
  2416         CWindowGc &aGc,
       
  2417         TPtrC text); // only for setting page with empty layout.
       
  2418 
       
  2419     /** 
       
  2420     Draws empty list for lists with find
       
  2421     @param aRect the client rectangle
       
  2422     @param aGc   the graphics context
       
  2423     @param aText text for empty list in format "Line1\nLine2"
       
  2424      */
       
  2425     IMPORT_C static void DrawEmptyListWithFind(
       
  2426         const TRect& aClientRect,
       
  2427         CWindowGc& aGc,
       
  2428         TPtrC aText); // only for fixed find pane used with single graphics listbox.
       
  2429 
       
  2430     /** 
       
  2431     Draws empty list for lists with heading
       
  2432     @param aRect the client rectangle
       
  2433     @param aGc   the graphics context
       
  2434     @param aText text for empty list in format "Line1\nLine2"
       
  2435      */
       
  2436     IMPORT_C static void DrawEmptyListHeading(
       
  2437         const TRect &aClientRect,
       
  2438         CWindowGc& aGc,
       
  2439         TPtrC aText); // only heading style lists.
       
  2440 
       
  2441     // The following is optimization for drawing window shadows.
       
  2442     /** 
       
  2443     Draws a window shadow
       
  2444     @param aCoverRect the area covered by the shadow
       
  2445     @param aSecondShadowRect the area used for second shadow
       
  2446     @param aFirstShadowRect  the area of first shadow
       
  2447     @param aOutliineFrameRect the area of black outline frame
       
  2448     @param aInsideAreaRect   the area of content inside the window
       
  2449      */
       
  2450     IMPORT_C static void DrawWindowShadow(
       
  2451         CWindowGc& aGc,
       
  2452         const TAknLayoutRect& aCoverRect,
       
  2453         const TAknLayoutRect& aSecondShadowRect,
       
  2454         const TAknLayoutRect& aFirstShadowRect,
       
  2455         const TAknLayoutRect& aOutlineFrameRect,
       
  2456         const TAknLayoutRect& aInsideAreaRect);
       
  2457 
       
  2458 public:
       
  2459 
       
  2460     /** 
       
  2461     * The main implementation routine for empty list drawing.
       
  2462     * @param aRect the client rectangle
       
  2463     * @param aGc   the graphics context
       
  2464     * @param aText text for empty list in one of following formats:
       
  2465     *
       
  2466     * layouts with large font:
       
  2467     * "Line 1"
       
  2468     * "Long line. This will be wrapped to 2 lines and 2nd will be trunca..."
       
  2469     * "Line 1\nLine 2"
       
  2470     *
       
  2471     * layout with 1 line of large font and up to 3 lines with small font:
       
  2472     * "Line 1\nLong line, will be wrapped up to 3 lines with small font and..."
       
  2473     *
       
  2474     *
       
  2475     * @param aLayoutLine1 Resource id of AVKON_LAYOUT_TEXT for first line layout 
       
  2476     * @param aLayoutLine2 Resource id of AVKON_LAYOUT_TEXT for second line layout 
       
  2477      */
       
  2478     IMPORT_C static void DrawEmptyListImpl( const TRect& aRect,
       
  2479                                             CWindowGc& aGc,
       
  2480                                             TPtrC aText,
       
  2481                                             TInt aLayoutLine1,
       
  2482                                             TInt aLayoutLine2 );
       
  2483     
       
  2484     };
       
  2485 
       
  2486 /**
       
  2487  * Helper functions for drawing empty lists and window shadows
       
  2488  */
       
  2489 class AknDrawWithSkins
       
  2490     {
       
  2491 public:
       
  2492     /** 
       
  2493     Draws standard empty list
       
  2494     @param aRect the client rectangle
       
  2495     @param aGc   the graphics context
       
  2496     @param aText text for empty list in format "Line1\nLine2"
       
  2497      */
       
  2498     IMPORT_C static void DrawEmptyList(
       
  2499         const TRect& aRect,
       
  2500         CWindowGc& aGc,
       
  2501         TPtrC aText,
       
  2502         CCoeControl *aControl);
       
  2503 
       
  2504     /** 
       
  2505     Draws empty list for setting item editing
       
  2506     @param aRect the rectangle of setting page's content
       
  2507     @param aGc   the graphics context
       
  2508     @param aText text for empty list in format "Line1\nLine2"
       
  2509      */
       
  2510     IMPORT_C static void DrawEmptyListForSettingPage(
       
  2511         const TRect &aRect,
       
  2512         CWindowGc &aGc,
       
  2513         TPtrC text,
       
  2514         CCoeControl *aControl); // only for setting page with empty layout.
       
  2515 
       
  2516     /** 
       
  2517     Draws empty list for lists with find
       
  2518     @param aRect the client rectangle
       
  2519     @param aGc   the graphics context
       
  2520     @param aText text for empty list in format "Line1\nLine2"
       
  2521      */
       
  2522     IMPORT_C static void DrawEmptyListWithFind(
       
  2523         const TRect& aClientRect,
       
  2524         CWindowGc& aGc,
       
  2525         TPtrC aText,
       
  2526         CCoeControl *aControl); // only for fixed find pane used with single graphics listbox.
       
  2527 
       
  2528     /** 
       
  2529     Draws empty list for lists with heading
       
  2530     @param aRect the client rectangle
       
  2531     @param aGc   the graphics context
       
  2532     @param aText text for empty list in format "Line1\nLine2"
       
  2533      */
       
  2534     IMPORT_C static void DrawEmptyListHeading(
       
  2535         const TRect &aClientRect,
       
  2536         CWindowGc& aGc,
       
  2537         TPtrC aText,
       
  2538         CCoeControl *aControl); // only heading style lists.
       
  2539 
       
  2540     // The following is optimization for drawing window shadows.
       
  2541     /** 
       
  2542     Draws a window shadow
       
  2543     @param aCoverRect the area covered by the shadow
       
  2544     @param aSecondShadowRect the area used for second shadow
       
  2545     @param aFirstShadowRect  the area of first shadow
       
  2546     @param aOutliineFrameRect the area of black outline frame
       
  2547     @param aInsideAreaRect   the area of content inside the window
       
  2548      */
       
  2549     IMPORT_C static void DrawWindowShadow(
       
  2550         CWindowGc& aGc,
       
  2551         const TAknLayoutRect& aCoverRect,
       
  2552         const TAknLayoutRect& aSecondShadowRect,
       
  2553         const TAknLayoutRect& aFirstShadowRect,
       
  2554         const TAknLayoutRect& aOutlineFrameRect,
       
  2555         const TAknLayoutRect& aInsideAreaRect,
       
  2556         CCoeControl *aControl);
       
  2557     
       
  2558     };
       
  2559 
       
  2560 
       
  2561 
       
  2562 
       
  2563 // Browser and calculator fonts will not be placed here. Application
       
  2564 // can use them themselves with CEikonEnv::Static()->Font() call.
       
  2565 IMPORT_C const CFont *LatinPlain12();
       
  2566 IMPORT_C const CFont *LatinBold12();
       
  2567 IMPORT_C const CFont *LatinBold13();
       
  2568 IMPORT_C const CFont *LatinBold16(); // since 2.0
       
  2569 IMPORT_C const CFont *LatinBold17();
       
  2570 IMPORT_C const CFont *LatinBold19(); 
       
  2571 IMPORT_C const CFont *NumberPlain5();
       
  2572 IMPORT_C const CFont *ClockBold30();
       
  2573 IMPORT_C const CFont *LatinClock14();
       
  2574 const CFont *CalcBold21();
       
  2575 const CFont *CalcOperBold21();
       
  2576 const CFont *CalcOperBold13();
       
  2577 
       
  2578 
       
  2579 
       
  2580 IMPORT_C const CFont *ApacPlain12();
       
  2581 IMPORT_C const CFont *ApacPlain16();
       
  2582 
       
  2583 
       
  2584 /**
       
  2585 * CompletePathWithAppPath
       
  2586 *   All the components that are specified in the given descriptor (drive letter,
       
  2587 *   path and file name, including extension) are put into the result;
       
  2588 *   any missing components (path and drive letter) are taken from the app's path.
       
  2589 *
       
  2590 *   Can be used e.g. to load a bitmap file when an application don't know where
       
  2591 *   it has been installed.
       
  2592 *
       
  2593 *   Example1:
       
  2594 *        TFilename fname = _L("\testdir\pics.mbm"); // Use _LIT instead
       
  2595 *        CompletePathWithAppPath( fname );
       
  2596 *        Result:
       
  2597 *            fname == "c:\testdir\pics.mbm" if application was installed to c:
       
  2598 *
       
  2599 *   Example2:
       
  2600 *        TFilename fname = _L("pics.mbm"); // Use _LIT instead
       
  2601 *        CompletePathWithAppPath( fname );
       
  2602 *        Result:
       
  2603 *            fname == "c:\system\apps\myapp\pics.mbm" if application was 
       
  2604 *                installed to c:\system\apps\myapp
       
  2605 *
       
  2606 * @param    aFileName   FileName which will be completed with application's path
       
  2607 * @return   Error code if an error occured. In case of an error aFileName will
       
  2608 *               not be changed
       
  2609 */
       
  2610 IMPORT_C TInt CompleteWithAppPath( TDes& aFileName );
       
  2611 
       
  2612 /**
       
  2613  * Test whether the value falls within the parent relative range
       
  2614  * as defined in AknLayout2Def.h
       
  2615  *
       
  2616  * @since 2.8
       
  2617  * @param aVal value
       
  2618  * @return ETrue if value is within the parent relative range, EFalse otherwise
       
  2619  */
       
  2620 TBool IsParentRelative(TInt aVal);
       
  2621 
       
  2622 /**
       
  2623  * Returns default input language that corresponds to the UI language.
       
  2624  *
       
  2625  * @since 3.0
       
  2626  * @param aUiLanguage Language code of the UI language
       
  2627  * @return Language code of the default input language
       
  2628  */
       
  2629 IMPORT_C TInt DefaultInputLanguageFromUILanguage(const TInt aUiLanguage);
       
  2630 
       
  2631     /**
       
  2632     * Sets the key block mode.
       
  2633     * Has the same functionality as SetKeyBlockMode in AknAppUi,
       
  2634     * but this can be used from a non app-framework application.
       
  2635     * The default mode blocks simultaneous key presses.
       
  2636     * @param aMode @c ENoKeyBlock if no key block, otherwise
       
  2637     * @c EDefaultBlockMode
       
  2638     */
       
  2639 IMPORT_C void SetKeyblockMode( TAknKeyBlockMode aMode );
       
  2640 
       
  2641 namespace AknDateTimeUtils
       
  2642     {
       
  2643     /**
       
  2644     * Converts given UTC time to home time.
       
  2645     * This conversion is used e.g. when showing time stamps of files in UI.
       
  2646     * In Symbian OS file system, time stamps are in UTC time, but in UI
       
  2647     * they should be shown in home time.
       
  2648     *
       
  2649     * @param aTime UTC time to be converted to home time.
       
  2650     * @since 3.1
       
  2651     */
       
  2652     IMPORT_C void ConvertUtcTimeToHomeTime( TTime& aTime );
       
  2653     }
       
  2654 
       
  2655 #define KAknLanguageMask 0x3FF
       
  2656 #define KAknDialectMask 0xFC00
       
  2657 
       
  2658 namespace AknLangUtils
       
  2659     {
       
  2660     /**
       
  2661     * Returns the RFC 3066 tag of the current display language.
       
  2662     * @since 3.1
       
  2663     * @ret RFC 3066 tag, ownership transferred to the caller.
       
  2664     */
       
  2665     IMPORT_C HBufC* DisplayLanguageTagL();
       
  2666     
       
  2667     TLanguage UserLanguage();
       
  2668     
       
  2669     }
       
  2670 
       
  2671 /**
       
  2672  * Helper functions for Popups
       
  2673  * 
       
  2674  * @since S60 v5.2
       
  2675  */
       
  2676 class AknPopupUtils
       
  2677     {
       
  2678 public:
       
  2679     /** 
       
  2680      * Calculates proper position for a popup control. Returned value depends
       
  2681      * on currently active layout and softkey visibility.
       
  2682      * 
       
  2683      * @param aSize             The size of the popup.
       
  2684      * @param aSoftkeysVisible  ETrue if softkeys are visible.
       
  2685      * @return                  Corrent popup position.
       
  2686      */
       
  2687     IMPORT_C static TPoint Position( const TSize& aSize,
       
  2688         TBool aSoftkeysVisible );
       
  2689 
       
  2690     /** 
       
  2691      * Calculates proper position for a popup control. Returned value depends
       
  2692      * on currently active layout and softkey visibility which is checked from
       
  2693      * aControl via MOP chain.
       
  2694      * 
       
  2695      * @param aSize         The size of the popup.
       
  2696      * @param aControl      Control who's position should be calculated.
       
  2697      * @return              Corrent popup position.
       
  2698      */
       
  2699     IMPORT_C static TPoint Position( const TSize& aSize,
       
  2700         CCoeControl* aControl );
       
  2701     };
       
  2702 
       
  2703 #endif //  __AKNUTILS_H__
       
  2704 
       
  2705 // End of file
       
  2706