textinput/peninputhwrtrui/src/truiappradiobutton.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 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:  Implement of class CTruiRadioButton
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <eiklabel.h>
       
    20 #include <barsread.h>
       
    21 #include <eikenv.h>
       
    22 #include <avkon.rsg>
       
    23 #include <AknIconUtils.h>
       
    24 #include <AknsSkinInstance.h>
       
    25 #include <AknsDrawUtils.h>
       
    26 #include <aknlayoutscalable_apps.cdl.h>
       
    27 #include <AknUtils.h>
       
    28 #include <AknBidiTextUtils.h> 
       
    29 #include <bidivisual.h>
       
    30 #include <featmgr.h>
       
    31 
       
    32 #ifdef RD_TACTILE_FEEDBACK 
       
    33 #include <touchfeedback.h>  
       
    34 #endif //RD_TACTILE_FEEDBACK
       
    35 
       
    36 #include "truiappradiobutton.h"
       
    37 #include "truiradiobuttonobserver.h"
       
    38 #include "truicontainerbase.h"
       
    39 
       
    40 // The amount of icons of bitmap files for ratio button
       
    41 const TInt KRadioButtonIconCounts = 2;
       
    42 
       
    43 const TInt KSpaceBetweenItems = 10;
       
    44 
       
    45 // ======== MEMBER FUNCTIONS ========
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Two-phased constructor.
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CTruiRadioButton* CTruiRadioButton::NewL( CCoeControl* aParent, 
       
    52                               TSelectionType aSelectionType,
       
    53                               MTruiRadioButtonObserver* aObserver )
       
    54     {
       
    55     CTruiRadioButton* self = CTruiRadioButton::NewLC( aParent, aSelectionType, 
       
    56                                                       aObserver );
       
    57     CleanupStack::Pop( self );
       
    58     return self;
       
    59     }
       
    60     
       
    61 // ---------------------------------------------------------------------------
       
    62 // Two-phased constructor.
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CTruiRadioButton* CTruiRadioButton::NewLC( CCoeControl* aParent, 
       
    66                               TSelectionType aSelectionType,
       
    67                               MTruiRadioButtonObserver* aObserver )
       
    68     {
       
    69     CTruiRadioButton* self = new ( ELeave ) CTruiRadioButton( aObserver, 
       
    70                                                               aSelectionType );
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL( aParent );
       
    73     return self;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CTruiHwrBox::CTruiHwrBox()
       
    78 // C++ default constructor can NOT contain any code, that might leave.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CTruiRadioButton::CTruiRadioButton( MTruiRadioButtonObserver* aObserver,
       
    82                                     TSelectionType aSelectionType )
       
    83                  :iObserver( aObserver ), iSelectionType( aSelectionType )
       
    84     {
       
    85     // No implementation required
       
    86     }
       
    87 
       
    88     
       
    89 // -----------------------------------------------------------------------------
       
    90 // CTruiRadioButton::ConstructL()
       
    91 // Symbian 2nd phase constructor can leave.
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CTruiRadioButton::ConstructL( CCoeControl* aParent )
       
    95     {
       
    96     SetContainerWindowL( *aParent );
       
    97     CreateBitmapForRadioButtonL();    
       
    98     #ifdef RD_TACTILE_FEEDBACK  
       
    99         iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); 
       
   100     #endif // RD_TACTILE_FEEDBACK    
       
   101     }
       
   102     
       
   103 // -----------------------------------------------------------------------------
       
   104 // Convert texts into Label and update them in radio buttons.
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CTruiRadioButton::HandleItemAdditionL()
       
   108     {
       
   109     // Re-init control array
       
   110     delete iControlArray;
       
   111     iControlArray = NULL;
       
   112     if ( iTextArray.Count() > 0 )
       
   113         {        
       
   114         iControlArray = new (ELeave) CArrayPtrFlat<CCoeControl>
       
   115                                                     ( iTextArray.Count() );
       
   116         }
       
   117     // text layout
       
   118     // Add items for radio button
       
   119     for ( TInt i = 0; i < iTextArray.Count(); i++ )
       
   120         {
       
   121         // Create label
       
   122         CEikLabel* label = new (ELeave) CEikLabel();
       
   123         CleanupStack::PushL( label );
       
   124         label->SetContainerWindowL( *this );
       
   125         label->SetObserver( this );
       
   126         label->SetTextL( *iTextArray[i] );
       
   127 
       
   128         // Add label to control array
       
   129         iControlArray->AppendL( label );        
       
   130         CleanupStack::Pop( label );
       
   131         }        
       
   132     }
       
   133     
       
   134 // -----------------------------------------------------------------------------
       
   135 // Add one item to radio button.
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 void CTruiRadioButton::AddItem( const HBufC* aText, TRadioButtonStatus aStatus )
       
   139     {
       
   140     iTextArray.Append( aText );
       
   141     iStatusArray.Append( aStatus );
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CTruiRadioButton::~CTruiRadioButton()
       
   146 // Destructor.
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 CTruiRadioButton::~CTruiRadioButton()
       
   150     {
       
   151     iStatusArray.Close();
       
   152     iTextArray.ResetAndDestroy();
       
   153     if ( iControlArray )
       
   154         {
       
   155         iControlArray->ResetAndDestroy();
       
   156         delete iControlArray;
       
   157         }        
       
   158     delete iRadioButtonSelectedBmp;
       
   159     delete iRadioButtonSelectedBmpm;
       
   160     delete iRadioButtonNonSelectedBmp;
       
   161     delete iRadioButtonNonSelectedBmpm;
       
   162     iIconLayout.Close();
       
   163     }
       
   164     
       
   165 // ---------------------------------------------------------------------------
       
   166 // Handles an event from an observed control.
       
   167 // ---------------------------------------------------------------------------
       
   168 //
       
   169 void CTruiRadioButton::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType )
       
   170     {
       
   171     TInt index;
       
   172     for ( index = 0; index < iControlArray->Count(); index++ )
       
   173         {
       
   174         if ( aControl == iControlArray->At( index ) )
       
   175             {
       
   176             break;
       
   177             }                    
       
   178         }
       
   179     if ( iSelectionType == ERadioButton )
       
   180         {
       
   181         HandlePointerRadioButtonL( index, aEventType );
       
   182         }
       
   183     else
       
   184         {
       
   185         HandlePointerCheckBox( index, aEventType );
       
   186         }    
       
   187     DrawNow();
       
   188     }
       
   189 
       
   190 // ---------------------------------------------------------------------------
       
   191 // Handle pointer on radio button.
       
   192 // ---------------------------------------------------------------------------
       
   193 //
       
   194 void CTruiRadioButton::HandlePointerRadioButtonL( TInt aIndex, TCoeEvent aEventType )
       
   195     {
       
   196     if ( aIndex < iStatusArray.Count() && aEventType == EEventRequestFocus )
       
   197         {
       
   198         for ( TInt i = 0; i < iStatusArray.Count(); i++ )
       
   199             {
       
   200             if ( i == aIndex )
       
   201                 {
       
   202                 if ( iStatusArray[aIndex] == ENonSelected )
       
   203                     {
       
   204                     iStatusArray[aIndex] = ESelected;
       
   205                     if ( iObserver )
       
   206                         {
       
   207                         iObserver->SelectChangedL( aIndex );
       
   208                         }
       
   209                     }
       
   210                 }
       
   211             else
       
   212                 {
       
   213                 iStatusArray[i] = ENonSelected;
       
   214                 }            
       
   215             } 
       
   216         }
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // Handle pointer on checkbox.
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 void CTruiRadioButton::HandlePointerCheckBox( TInt aIndex, TCoeEvent aEventType )
       
   224     {
       
   225     if ( aIndex < iControlArray->Count() && aEventType == EEventRequestFocus )
       
   226         {
       
   227         iStatusArray[aIndex] = ( iStatusArray[aIndex] == ENonSelected ) 
       
   228                                             ? ESelected : ENonSelected;        
       
   229         }
       
   230     }
       
   231         
       
   232 // ---------------------------------------------------------------------------
       
   233 // Handles an event from an observed control.
       
   234 // ---------------------------------------------------------------------------
       
   235 //
       
   236 void CTruiRadioButton::SizeChanged()
       
   237     {        
       
   238     LoadIconsLayout( 0 );    
       
   239     for ( TInt i = 0; i < iIconLayout.Count(); i++ )
       
   240         {
       
   241         TSize iconSize = iIconLayout[i].Rect().Size();
       
   242         AknIconUtils::SetSize( iRadioButtonSelectedBmp, iconSize );
       
   243         AknIconUtils::SetSize( iRadioButtonSelectedBmpm, iconSize );
       
   244         AknIconUtils::SetSize( iRadioButtonNonSelectedBmpm, iconSize );
       
   245         AknIconUtils::SetSize( iRadioButtonNonSelectedBmpm, iconSize );
       
   246         }
       
   247     // list_single_hwr_training_symbol_option_pane_t1  
       
   248     if ( iControlArray && iTextArray.Count() > 0 )
       
   249         {
       
   250         for ( TInt i = 0; i < iTextArray.Count(); i++ )
       
   251             {
       
   252             TAknTextComponentLayout option_pane_t1_layout = 
       
   253                        AknLayoutScalable_Apps::                       
       
   254                        list_single_hwr_training_symbol_option_pane_t1( 0 );                       
       
   255             CEikLabel* label = static_cast<CEikLabel*>( iControlArray->At( i ) );
       
   256             AknLayoutUtils::LayoutLabel( label, 
       
   257                                          Rect(), 
       
   258                                          iMultilineLayout );
       
   259             // Set color for label
       
   260             TRgb labelColor = KRgbBlack;
       
   261             TInt error = GetCachedLabelTextColor( labelColor );
       
   262             if ( error == KErrNone )
       
   263                 {
       
   264                 TRAP_IGNORE( label->OverrideColorL( EColorLabelText, labelColor ) );
       
   265                 }
       
   266             TRAP_IGNORE( ClipToFitLabelL( label, i ) );
       
   267             // Set font for label
       
   268             if ( TBidiText::ScriptDirectionality( User::Language() )
       
   269                  ==  TBidiText::ERightToLeft )
       
   270                 { // arabic,hebrew, set text RTL
       
   271                 label->SetLabelAlignment( ELayoutAlignBidi );                
       
   272                 }
       
   273             }            
       
   274         }
       
   275     }
       
   276     
       
   277 // -----------------------------------------------------------------------------
       
   278 // Draws control to given area
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 void CTruiRadioButton::Draw( const TRect& /*aRect*/ ) const
       
   282     {
       
   283     CWindowGc& gc = SystemGc();
       
   284     // Gets the control's extent
       
   285     TRect rect( Rect() );
       
   286     // Clears the screen       
       
   287     Window().SetBackgroundColor( TRgb( ~0 ) );
       
   288     
       
   289     TSize pixSize = iRadioButtonSelectedBmp->SizeInPixels();
       
   290     for ( TInt i = 0; i < iStatusArray.Count(); i++ )
       
   291         {
       
   292         TPoint tl( rect.iTl.iX, rect.iTl.iY + pixSize.iWidth * i 
       
   293                    +  KSpaceBetweenItems * i );
       
   294         if ( iStatusArray[i] == ESelected )
       
   295             {
       
   296             iIconLayout[0].DrawImage( gc, iRadioButtonSelectedBmp, iRadioButtonSelectedBmpm );
       
   297             }
       
   298         else if ( iStatusArray[i] == ENonSelected )
       
   299             {
       
   300             iIconLayout[0].DrawImage( gc, iRadioButtonNonSelectedBmp, 
       
   301                                           iRadioButtonNonSelectedBmpm );
       
   302             }        
       
   303         }
       
   304     }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // Gets the number of controls contained in a compound control.
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 TInt CTruiRadioButton::CountComponentControls() const
       
   311     {
       
   312     if ( iControlArray )
       
   313         {
       
   314         return iControlArray->Count();
       
   315         }
       
   316     return 0;
       
   317     }
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 // Gets an indexed component of a compound control.
       
   321 // -----------------------------------------------------------------------------
       
   322 //
       
   323 CCoeControl* CTruiRadioButton::ComponentControl( TInt aIndex ) const
       
   324     {
       
   325     if ( iControlArray && aIndex < iControlArray->Count() )
       
   326         {
       
   327         return iControlArray->At( aIndex );
       
   328         }
       
   329     return NULL;
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // From class CCoeControl.
       
   334 // Handles a change to the control's resources.
       
   335 // ---------------------------------------------------------------------------
       
   336 //
       
   337 void CTruiRadioButton::HandleResourceChange( TInt aType )
       
   338     {   
       
   339     CCoeControl::HandleResourceChange( aType );    
       
   340     if ( aType == KAknsMessageSkinChange && iControlArray )
       
   341         {        
       
   342         TRgb labelColor = KRgbBlack;
       
   343         TInt error = GetCachedLabelTextColor( labelColor );
       
   344         if ( error == KErrNone )
       
   345             {
       
   346             for ( TInt i = 0; i < iControlArray->Count(); i++ )
       
   347                 {
       
   348                 CCoeControl* label = iControlArray->At( i );
       
   349                 TRAP_IGNORE( label->OverrideColorL( EColorLabelText, labelColor ) );
       
   350                 }
       
   351             }  
       
   352         TRAP_IGNORE( CreateBitmapForRadioButtonL() ); 
       
   353         SizeChanged();       
       
   354         }    
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // Gets an indexed component of a compound control.
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 void CTruiRadioButton::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   362     {
       
   363     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   364         {
       
   365         // Click the area of icon
       
   366         TSize pixSize = iRadioButtonSelectedBmp->SizeInPixels();
       
   367         TRect rect( Rect() );
       
   368         for ( TInt i = 0; i < iControlArray->Count(); i++ )
       
   369             {
       
   370             if ( iIconLayout[i].Rect().Contains( aPointerEvent.iPosition ) )            
       
   371                 {
       
   372                 // Handle the event to point on Icon
       
   373                 HandleControlEventL(  iControlArray->At( i ),
       
   374                                       EEventRequestFocus );
       
   375                 }        
       
   376             }
       
   377         #ifdef RD_TACTILE_FEEDBACK 
       
   378         if ( iTactileSupported )
       
   379             {
       
   380             MTouchFeedback::Instance()->InstantFeedback( ETouchFeedbackBasic );
       
   381             }        
       
   382         #endif // RD_TACTILE_FEEDBACK
       
   383         }
       
   384     CCoeControl::HandlePointerEventL( aPointerEvent );
       
   385     }
       
   386     
       
   387 // -----------------------------------------------------------------------------
       
   388 // Return the control's minisize.
       
   389 // -----------------------------------------------------------------------------
       
   390 //
       
   391 TSize CTruiRadioButton::MinimumSize()
       
   392     {
       
   393     TInt miniWidth = 0;
       
   394     TInt miniHeight = 0;
       
   395     for ( TInt i = 0; i < iControlArray->Count(); i++ )
       
   396         {
       
   397         TSize itemMiniSize = iControlArray->At( i )->Size();
       
   398         miniHeight += itemMiniSize.iHeight + KSpaceBetweenItems * i;
       
   399         miniWidth = itemMiniSize.iWidth 
       
   400                     + iRadioButtonSelectedBmp->SizeInPixels().iWidth;
       
   401         }
       
   402     return TSize( miniWidth, miniHeight );
       
   403     }
       
   404             
       
   405 // -----------------------------------------------------------------------------
       
   406 // Create radio button's bitmap.
       
   407 // -----------------------------------------------------------------------------
       
   408 //
       
   409 void CTruiRadioButton::CreateBitmapForRadioButtonL()
       
   410     {
       
   411     delete iRadioButtonSelectedBmp;
       
   412     delete iRadioButtonSelectedBmpm;
       
   413     delete iRadioButtonNonSelectedBmp;
       
   414     delete iRadioButtonNonSelectedBmpm;
       
   415     // Read resource file
       
   416     TResourceReader reader;
       
   417     TInt btnResource;
       
   418     if ( iSelectionType == ERadioButton )
       
   419         {
       
   420         btnResource = R_AVKON_SETTING_PAGE_RADIOBUTTON_ICONS;
       
   421         }
       
   422     else
       
   423         {
       
   424         btnResource= R_AVKON_SETTING_PAGE_CHECKBOX_ICONS;
       
   425         }
       
   426     iEikonEnv->CreateResourceReaderLC( reader, btnResource );
       
   427     reader.ReadInt16(); //not needed, simple or complex
       
   428     HBufC* bmpFile = reader.ReadHBufCL();
       
   429     CleanupStack::PushL( bmpFile );
       
   430     TInt count = reader.ReadInt16(); // count    
       
   431     if( count < KRadioButtonIconCounts )
       
   432         {
       
   433         User::Leave(KErrCorrupt);
       
   434         }    
       
   435     TInt32 bmpSelected = reader.ReadInt32();
       
   436     TInt32 bmpSelectedM = reader.ReadInt32();
       
   437     TInt32 bmpNonSelected = reader.ReadInt32();
       
   438     TInt32 bmpNonSelectedM = reader.ReadInt32();
       
   439     CleanupStack::Pop( bmpFile );
       
   440     CleanupStack::PopAndDestroy(); // reader
       
   441     
       
   442     CleanupStack::PushL( bmpFile );
       
   443     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   444     AknsUtils::CreateColorIconL( skin,
       
   445                                  KAknsIIDQgnIndiRadiobuttOn,
       
   446                                  KAknsIIDQsnIconColors,
       
   447                                  EAknsCIQsnIconColorsCG14,
       
   448                                  iRadioButtonSelectedBmp,
       
   449                                  iRadioButtonSelectedBmpm,
       
   450                                  *bmpFile,
       
   451                                  bmpSelected,
       
   452                                  bmpSelectedM,
       
   453                                  KRgbBlack
       
   454                                  );
       
   455     
       
   456     AknsUtils::CreateColorIconL( skin,
       
   457                                  KAknsIIDQgnIndiRadiobuttOff,
       
   458                                  KAknsIIDQsnIconColors,
       
   459                                  EAknsCIQsnIconColorsCG14,
       
   460                                  iRadioButtonNonSelectedBmp,
       
   461                                  iRadioButtonNonSelectedBmpm,                                  
       
   462                                  *bmpFile,
       
   463                                  bmpNonSelected,
       
   464                                  bmpNonSelectedM,
       
   465                                  KRgbBlack
       
   466                                  );
       
   467     CleanupStack::PopAndDestroy( bmpFile );   
       
   468     }
       
   469 
       
   470 // ---------------------------------------------------------------------------
       
   471 // Get cached color of skin for label control
       
   472 // ---------------------------------------------------------------------------
       
   473 // 
       
   474 TInt CTruiRadioButton::GetCachedLabelTextColor( TRgb& aColor )
       
   475     {
       
   476     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   477     // Set pen color to the color of test in main area
       
   478     return AknsUtils::GetCachedColor( skin,
       
   479                                       aColor,
       
   480                                       KAknsIIDQsnTextColors,
       
   481                                       EAknsCIQsnTextColorsCG6 );
       
   482     }
       
   483 
       
   484 // ---------------------------------------------------------------------------
       
   485 // Load layouts for icons from LAF.
       
   486 // ---------------------------------------------------------------------------
       
   487 // 
       
   488 void CTruiRadioButton::LoadIconsLayout( TInt aVarity )
       
   489     {
       
   490     TRect rect = Rect();
       
   491     iIconLayout.Reset();
       
   492     // Caculate list_single_hwr_training_symbol_option_pane_g1 for line1
       
   493     TAknWindowComponentLayout icon_checked_layout = 
       
   494          AknLayoutScalable_Apps::list_single_hwr_training_symbol_option_pane_g1         
       
   495                                         ( aVarity );
       
   496     TAknLayoutRect icon_checked_layout_rect;
       
   497     icon_checked_layout_rect.LayoutRect( rect, icon_checked_layout );    
       
   498     iIconLayout.Append( icon_checked_layout_rect );
       
   499     }
       
   500 // -----------------------------------------------------------------------------
       
   501 // Convert logical name to visual name for label when needed.
       
   502 // -----------------------------------------------------------------------------
       
   503 //
       
   504 void CTruiRadioButton::ConvertToVisualForEdwinL( CEikLabel* aLabel, 
       
   505                                                  const TDesC& aLogicalTxt, 
       
   506                                                  const CFont& aFont, 
       
   507                                                  TInt aLineWidth )
       
   508     {
       
   509     HBufC* visualText = HBufC::NewLC( aLogicalTxt.Length() 
       
   510                                       + TBidiLogicalToVisual::KMinCharAvailable
       
   511                                       + KExtraSize );
       
   512     TPtr visualTextPtr = visualText->Des();
       
   513     AknBidiTextUtils::ConvertToVisualAndClip( aLogicalTxt, visualTextPtr, 
       
   514                                               aFont, aLineWidth, aLineWidth );
       
   515     aLabel->SetTextL( *visualText ); 
       
   516     aLabel->SetLabelAlignment( ELayoutAlignBidi );
       
   517     CleanupStack::PopAndDestroy( visualText );   
       
   518     }
       
   519 
       
   520 // -----------------------------------------------------------------------------
       
   521 // Clip text of editor to fit editor width.
       
   522 // -----------------------------------------------------------------------------
       
   523 //
       
   524 void CTruiRadioButton::ClipToFitLabelL( CEikLabel* aLabel, TInt aIndex )
       
   525     {    
       
   526     if ( aLabel && aLabel->Size().iWidth > 0 )
       
   527         {                
       
   528         // Get font fo editor from LAF
       
   529         const CFont* edwinFont = AknLayoutUtils::FontFromId
       
   530                                  ( iMultilineLayout.FontId() );
       
   531         // Prepare text to set into editor
       
   532         HBufC* textInArray = iTextArray[aIndex];
       
   533         // Create a new HBufC to store text for editor
       
   534         HBufC* edwinText = HBufC::NewLC( textInArray->Length()
       
   535                                          + KExtraSize );
       
   536         TPtr edwinTextPtr = edwinText->Des();        
       
   537         edwinTextPtr.Copy( *textInArray );
       
   538         // Clip text for editor
       
   539         AknTextUtils::ClipToFit( edwinTextPtr, *edwinFont, 
       
   540             aLabel->Size().iWidth );        
       
   541         aLabel->SetTextL( *edwinText );    
       
   542         CleanupStack::PopAndDestroy( edwinText );        
       
   543         }    
       
   544     }
       
   545