uifw/AvKon/src/PictograhGrouping.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Defined avkon pictograph ranges to show in SCT
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "PictograhGrouping.h"
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // PictograhGrouping::AllocStringLC
       
    27 // Return pictograph string to show in SCT
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 HBufC* PictograhGrouping::AllocStringLC(
       
    31     TAknPictographGroupType aType)
       
    32     {
       
    33 
       
    34     struct TPictograhGrouping
       
    35         {
       
    36         TUint iStart;
       
    37         TUint iEnd;
       
    38         };
       
    39     static const TPictograhGrouping pictograph1[] = 
       
    40         {
       
    41         { 0xE63E, 0xE6A5 },
       
    42         { 0xE6AC, 0xE6AE },
       
    43         { 0xE6B1, 0xE6B3 },
       
    44         { 0xE6B7, 0xE6BA },
       
    45         { 0xE6CE, 0xE70B }
       
    46         };
       
    47     static const TPictograhGrouping pictograph2[] = 
       
    48         {
       
    49         { 0xE70C, 0xE757 }
       
    50         };
       
    51 
       
    52     const TPictograhGrouping* base = 
       
    53                 (aType == TAknPictographGroup2)? pictograph2 : pictograph1;
       
    54     const TInt sizeoftable = 
       
    55                 (aType == TAknPictographGroup2)? sizeof(pictograph2) : sizeof(pictograph1);
       
    56     const TPictograhGrouping* end = base + 
       
    57                 ( sizeoftable / sizeof(base[0]) -1);
       
    58     const TUint len = end->iEnd - base->iStart + 1;
       
    59 
       
    60     HBufC* buf = HBufC::NewLC(len);
       
    61     TPtr ptr(buf->Des());
       
    62 
       
    63     TInt count = 0;
       
    64     while (base <= end)
       
    65         {
       
    66         for ( TChar ch = base->iStart; ch <= TChar(base->iEnd); )
       
    67             {
       
    68             ptr.Append(ch);
       
    69             count++;
       
    70             ch += 1;
       
    71             }
       
    72         base++;
       
    73         }
       
    74     return buf;
       
    75     }
       
    76 
       
    77 //  End of File