textinput/peninputcommonlayout/src/peninputrangebarinfo.cpp
changeset 27 694fa80c203c
parent 24 fc42a86c98e3
child 35 0f326f2e628e
equal deleted inserted replaced
24:fc42a86c98e3 27:694fa80c203c
     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:  range bar layout implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // User includes
       
    20 #include "peninputrangebarinfo.h"
       
    21 
       
    22 // ======== MEMBER FUNCTIONS ========
       
    23 
       
    24 // ------------------------------------------------------------------------
       
    25 // CPeninputRangeInfo::NewL
       
    26 // (other items were commented in a header)
       
    27 // ------------------------------------------------------------------------
       
    28 //
       
    29 EXPORT_C CPeninputRangeInfo* CPeninputRangeInfo::NewL( 
       
    30     TResourceReader& aReader )                            
       
    31     {
       
    32     CPeninputRangeInfo* self = NewLC( aReader );
       
    33     CleanupStack::Pop( self );
       
    34     
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ------------------------------------------------------------------------
       
    39 // CPeninputRangeInfo::NewLC
       
    40 // (other items were commented in a header)
       
    41 // ------------------------------------------------------------------------
       
    42 //
       
    43 EXPORT_C CPeninputRangeInfo* CPeninputRangeInfo::NewLC( 
       
    44     TResourceReader& aReader )
       
    45     {
       
    46     CPeninputRangeInfo* self = new ( ELeave ) CPeninputRangeInfo();
       
    47 
       
    48     CleanupStack::PushL( self );
       
    49     self->ConstructL( aReader );
       
    50 
       
    51     return self;
       
    52     }
       
    53 
       
    54 // ------------------------------------------------------------------------
       
    55 // CPeninputRangeInfo::~CPeninputRangeInfo
       
    56 // (other items were commented in a header)
       
    57 // ------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C CPeninputRangeInfo::~CPeninputRangeInfo()
       
    60     {
       
    61     }
       
    62 
       
    63 // ------------------------------------------------------------------------
       
    64 // CPeninputRangeInfo::ConstructL
       
    65 // (other items were commented in a header)
       
    66 // ------------------------------------------------------------------------
       
    67 //
       
    68 void CPeninputRangeInfo::ConstructL( TResourceReader& aReader )
       
    69     {
       
    70     ConstructFromResourceL( aReader );
       
    71     }
       
    72 
       
    73 // ------------------------------------------------------------------------
       
    74 // CPeninputRangeInfo::ConstructFromResourceL
       
    75 // (other items were commented in a header)
       
    76 // ------------------------------------------------------------------------
       
    77 //
       
    78 void CPeninputRangeInfo::ConstructFromResourceL( TResourceReader& aReader )
       
    79     {
       
    80     User::LeaveIfError( iRangeId = aReader.ReadInt16() );    
       
    81     
       
    82     TInt responseStyle = aReader.ReadInt16();
       
    83     
       
    84     switch ( responseStyle )
       
    85         {     
       
    86         case 0:
       
    87             {
       
    88             iResponseStyle = EPeninputRangeResponseNoAction;
       
    89             }
       
    90             break;
       
    91         case 1:
       
    92             {
       
    93             iResponseStyle = EPeninputRangeResponseSwitchRange;
       
    94             }
       
    95             break;
       
    96         case 2:
       
    97             {
       
    98             iResponseStyle = EPeninputRangeResponsePopupChoiceItem;
       
    99             }
       
   100             break;
       
   101         default:
       
   102             {
       
   103             iResponseStyle = EPeninputRangeResponseNoAction;
       
   104             }
       
   105             break;
       
   106         }
       
   107 
       
   108     iClientLayoutId = aReader.ReadInt16();
       
   109     iVkbLayoutId = aReader.ReadInt16();
       
   110 
       
   111     }
       
   112 
       
   113 // ------------------------------------------------------------------------
       
   114 // CPeninputRangeBarInfo::NewL
       
   115 // (other items were commented in a header)
       
   116 // ------------------------------------------------------------------------
       
   117 //
       
   118 EXPORT_C CPeninputRangeBarInfo* CPeninputRangeBarInfo::NewL( 
       
   119     TResourceReader& aReader )                                    
       
   120     {
       
   121     CPeninputRangeBarInfo* self = NewLC( aReader );
       
   122     CleanupStack::Pop( self );
       
   123     
       
   124     return self;
       
   125     }
       
   126 
       
   127 // ------------------------------------------------------------------------
       
   128 // CPeninputRangeBarInfo::NewLC
       
   129 // (other items were commented in a header)
       
   130 // ------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C CPeninputRangeBarInfo* CPeninputRangeBarInfo::NewLC( 
       
   133     TResourceReader& aReader )
       
   134     {
       
   135     CPeninputRangeBarInfo* self = new ( ELeave ) CPeninputRangeBarInfo();
       
   136 
       
   137     CleanupStack::PushL( self );
       
   138     self->ConstructL( aReader );
       
   139 
       
   140     return self;
       
   141     }
       
   142 
       
   143 // ------------------------------------------------------------------------
       
   144 // CPeninputRangeBarInfo::~CPeninputRangeBarInfo
       
   145 // (other items were commented in a header)
       
   146 // ------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C CPeninputRangeBarInfo::~CPeninputRangeBarInfo()
       
   149     {
       
   150     iRanges.ResetAndDestroy();
       
   151     iRanges.Close();
       
   152     }
       
   153 
       
   154 // ------------------------------------------------------------------------
       
   155 // CPeninputRangeBarInfo::FindRange
       
   156 // (other items were commented in a header)
       
   157 // ------------------------------------------------------------------------
       
   158 //
       
   159 EXPORT_C CPeninputRangeInfo* CPeninputRangeBarInfo::FindRange( TInt aRangeId )
       
   160     {
       
   161     const TInt count = iRanges.Count();
       
   162 
       
   163     for ( TInt i = 0; i < count; i++ )
       
   164         {
       
   165         if ( iRanges[i]->RangeId() == aRangeId )
       
   166             {
       
   167             return iRanges[i];
       
   168             }
       
   169         }
       
   170 
       
   171     return NULL;
       
   172     }
       
   173 
       
   174 // ------------------------------------------------------------------------
       
   175 // CPeninputRangeBarInfo::ConstructL
       
   176 // (other items were commented in a header)
       
   177 // ------------------------------------------------------------------------
       
   178 //
       
   179 void CPeninputRangeBarInfo::ConstructL( TResourceReader& aReader )
       
   180     {
       
   181     ConstructFromResourceL( aReader );
       
   182     }
       
   183 
       
   184 // ------------------------------------------------------------------------
       
   185 // CPeninputRangeBarInfo::ConstructFromResourceL
       
   186 // (other items were commented in a header)
       
   187 // ------------------------------------------------------------------------
       
   188 //
       
   189 void CPeninputRangeBarInfo::ConstructFromResourceL( 
       
   190     TResourceReader& aReader )
       
   191     {
       
   192     iRangeStyle = aReader.ReadInt16();
       
   193     
       
   194     TInt count = aReader.ReadInt16();
       
   195     for ( TInt i = 0; i < count; i++ )
       
   196         {
       
   197         CPeninputRangeInfo* rangeInfo = CPeninputRangeInfo::NewL( aReader );
       
   198         iRanges.Append( rangeInfo );
       
   199         }
       
   200     }