textinput/peninputcommonlayout/src/peninputclientlayoutinfo.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:  client layout implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // User includes
       
    20 #include "peninputclientlayoutinfo.h"
       
    21 
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ------------------------------------------------------------------------
       
    26 // CPeninputControlInfo::NewL
       
    27 // (other items were commented in a header)
       
    28 // ------------------------------------------------------------------------
       
    29 //
       
    30 EXPORT_C CPeninputControlInfo* CPeninputControlInfo::NewL( 
       
    31     TResourceReader& aReader )
       
    32     {
       
    33     CPeninputControlInfo* self = new ( ELeave ) CPeninputControlInfo();
       
    34     CleanupStack::PushL( self );
       
    35     self->ConstructL( aReader );
       
    36     CleanupStack::Pop( self );
       
    37     
       
    38     return self;
       
    39     }
       
    40 
       
    41 // ------------------------------------------------------------------------
       
    42 // CPeninputControlInfo::~CPeninputControlInfo
       
    43 // (other items were commented in a header)
       
    44 // ------------------------------------------------------------------------
       
    45 //
       
    46 EXPORT_C CPeninputControlInfo::~CPeninputControlInfo()
       
    47     {
       
    48     }
       
    49 
       
    50 // ------------------------------------------------------------------------
       
    51 // CPeninputControlInfo::ConstructL
       
    52 // (other items were commented in a header)
       
    53 // ------------------------------------------------------------------------
       
    54 //
       
    55 void CPeninputControlInfo::ConstructL( TResourceReader& aReader )
       
    56     {
       
    57     ConstructFromResourceL( aReader );
       
    58     }
       
    59 
       
    60 // ------------------------------------------------------------------------
       
    61 // CPeninputControlInfo::ConstructFromResourceL
       
    62 // (other items were commented in a header)
       
    63 // ------------------------------------------------------------------------
       
    64 //
       
    65 void CPeninputControlInfo::ConstructFromResourceL( TResourceReader& aReader )
       
    66     {
       
    67     iControlID = aReader.ReadInt16();
       
    68     iControlType = aReader.ReadInt16();
       
    69     iBeginRow = aReader.ReadInt16();
       
    70     iBeginColumn = aReader.ReadInt16();
       
    71     iEndRow = aReader.ReadInt16();
       
    72     iEndColumn = aReader.ReadInt16();
       
    73     }
       
    74 
       
    75 // ------------------------------------------------------------------------
       
    76 // CPeninputClientLayoutInfo::NewL
       
    77 // (other items were commented in a header)
       
    78 // ------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C CPeninputClientLayoutInfo* CPeninputClientLayoutInfo::NewL( 
       
    81     TResourceReader& aReader )
       
    82     {
       
    83     CPeninputClientLayoutInfo* self = NewLC( aReader );
       
    84     CleanupStack::Pop( self );
       
    85 
       
    86     return self;
       
    87     }
       
    88 
       
    89 // ------------------------------------------------------------------------
       
    90 // CPeninputClientLayoutInfo::NewLC
       
    91 // (other items were commented in a header)
       
    92 // ------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C CPeninputClientLayoutInfo* CPeninputClientLayoutInfo::NewLC( 
       
    95     TResourceReader& aReader )
       
    96     {
       
    97     CPeninputClientLayoutInfo* self = 
       
    98         new ( ELeave ) CPeninputClientLayoutInfo();
       
    99     CleanupStack::PushL( self );
       
   100     self->ConstructL( aReader );
       
   101 
       
   102     return self;
       
   103     }
       
   104 
       
   105 // ------------------------------------------------------------------------
       
   106 // CPeninputClientLayoutInfo::~CPeninputClientLayoutInfo
       
   107 // (other items were commented in a header)
       
   108 // ------------------------------------------------------------------------
       
   109 //
       
   110 EXPORT_C CPeninputClientLayoutInfo::~CPeninputClientLayoutInfo()
       
   111     {
       
   112     iControlInfoList.ResetAndDestroy();
       
   113     }
       
   114 
       
   115 // ------------------------------------------------------------------------
       
   116 // CPeninputClientLayoutInfo::ConstructFromResourceL
       
   117 // (other items were commented in a header)
       
   118 // ------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C void CPeninputClientLayoutInfo::ConstructFromResourceL( 
       
   121     TResourceReader& aReader )
       
   122     {
       
   123     iLayoutID = aReader.ReadInt16();
       
   124     iColumns = aReader.ReadInt16();
       
   125     iRows = aReader.ReadInt16();
       
   126 
       
   127     const TInt count = aReader.ReadInt16();
       
   128     for ( TInt i = 0; i < count; i++ )
       
   129         {
       
   130         CPeninputControlInfo* controlInfo = 
       
   131             CPeninputControlInfo::NewL( aReader );
       
   132         AddControlInfo( controlInfo );
       
   133         }
       
   134     }
       
   135 
       
   136 // ------------------------------------------------------------------------
       
   137 // CPeninputClientLayoutInfo::FindControlInfo
       
   138 // (other items were commented in a header)
       
   139 // ------------------------------------------------------------------------
       
   140 //
       
   141 EXPORT_C CPeninputControlInfo* CPeninputClientLayoutInfo::FindControlInfo( 
       
   142     const TInt aControlID )
       
   143     {
       
   144     const TInt count = iControlInfoList.Count();
       
   145     
       
   146     for ( TInt i = 0; i < count; i++ )
       
   147         {
       
   148         if ( iControlInfoList[i]->ControlID() == aControlID )
       
   149             {
       
   150             return iControlInfoList[i];
       
   151             }
       
   152         }
       
   153 
       
   154     return NULL;
       
   155     }
       
   156 
       
   157 // ------------------------------------------------------------------------
       
   158 // CPeninputClientLayoutInfo::AddControlInfo
       
   159 // (other items were commented in a header)
       
   160 // ------------------------------------------------------------------------
       
   161 // 
       
   162 EXPORT_C void CPeninputClientLayoutInfo::AddControlInfo( 
       
   163     CPeninputControlInfo* aControlInfo )
       
   164     {
       
   165     iControlInfoList.Append( aControlInfo );
       
   166     }
       
   167 
       
   168 // ------------------------------------------------------------------------
       
   169 // CPeninputClientLayoutInfo::RemoveControlInfo
       
   170 // (other items were commented in a header)
       
   171 // ------------------------------------------------------------------------
       
   172 //
       
   173 EXPORT_C void CPeninputClientLayoutInfo::RemoveControlInfo( 
       
   174     CPeninputControlInfo* aControlInfo )
       
   175     {
       
   176     CPeninputControlInfo* controlInfo = 
       
   177         FindControlInfo( aControlInfo->ControlID() );
       
   178     if ( controlInfo )
       
   179         {
       
   180         RemoveControlInfo( controlInfo->ControlID() );
       
   181         }
       
   182     }
       
   183 
       
   184 // ------------------------------------------------------------------------
       
   185 // CPeninputClientLayoutInfo::RemoveControlInfo
       
   186 // (other items were commented in a header)
       
   187 // ------------------------------------------------------------------------
       
   188 //
       
   189 EXPORT_C void CPeninputClientLayoutInfo::RemoveControlInfo( 
       
   190     const TInt aControlID )
       
   191     {
       
   192     const TInt count = iControlInfoList.Count();
       
   193 
       
   194     for ( TInt i = 0; i < count; i++ )
       
   195         {
       
   196         if ( iControlInfoList[i]->ControlID() == aControlID )
       
   197             {
       
   198             CPeninputControlInfo* controlInfo = iControlInfoList[i];
       
   199             delete controlInfo;
       
   200             iControlInfoList.Remove( i );
       
   201             break;
       
   202             }
       
   203         }
       
   204     }
       
   205 
       
   206 // ------------------------------------------------------------------------
       
   207 // CPeninputClientLayoutInfo::ConstructL
       
   208 // (other items were commented in a header)
       
   209 // ------------------------------------------------------------------------
       
   210 //
       
   211 void CPeninputClientLayoutInfo::ConstructL( TResourceReader& aReader )
       
   212     {
       
   213     ConstructFromResourceL( aReader );
       
   214     }