meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp
branchRCL_3
changeset 60 d620048b4810
parent 29 6b8f3b30d0ec
equal deleted inserted replaced
52:efd4f1afd43e 60:d620048b4810
    95 //
    95 //
    96 void CESMRResponseField::ConstructL()
    96 void CESMRResponseField::ConstructL()
    97     {
    97     {
    98     FUNC_LOG;
    98     FUNC_LOG;
    99 
    99 
       
   100     CESMRField::ConstructL( NULL );
       
   101 
   100     // Add pls resopond item to this field.
   102     // Add pls resopond item to this field.
   101     CESMRResponseItem* responseItem =
   103     CESMRResponseItem* responseItem =
   102         CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
   104         CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
       
   105     responseItem->SetContainerWindowL( *this );
   103     iResponseItemArray.AppendL( responseItem );
   106     iResponseItemArray.AppendL( responseItem );
   104     CleanupStack::Pop( responseItem );
   107     CleanupStack::Pop( responseItem );
   105     }
   108     }
   106 
   109 
   107 // -----------------------------------------------------------------------------
   110 // -----------------------------------------------------------------------------
   145     {
   148     {
   146     FUNC_LOG;
   149     FUNC_LOG;
   147     TInt count( iResponseItemArray.Count() );
   150     TInt count( iResponseItemArray.Count() );
   148     TRect parentRect( Rect() );
   151     TRect parentRect( Rect() );
   149     TRect rect;
   152     TRect rect;
   150     for( TInt i = 1; i <= count; ++i )
   153     for( TInt i = 0; i < count; ++i )
   151         {
   154         {
   152         TAknLayoutRect choiceLayoutRect =
   155         TAknLayoutRect choiceLayoutRect =
   153             NMRLayoutManager::GetFieldRowLayoutRect( parentRect, i );
   156             NMRLayoutManager::GetFieldRowLayoutRect( parentRect, i + 1 );
   154         rect = parentRect;
   157         rect = parentRect;
   155         // Move the row down then it will be drawn to correct position.
   158         // Move the row down then it will be drawn to correct position.
   156         // controlIndex+1 tells the fields index.
   159         // controlIndex+1 tells the fields index.
   157         TInt movement = choiceLayoutRect.Rect().Height();
   160         TInt movement = choiceLayoutRect.Rect().Height();
   158         rect.Move( 0, movement * ( i - 1 ) );
   161         rect.Move( 0, movement * i );
   159 
   162 
   160         TInt leftMargin = choiceLayoutRect.Rect().iTl.iX;
   163         TInt leftMargin = choiceLayoutRect.Rect().iTl.iX;
   161         TInt rightMargin = choiceLayoutRect.Rect().iBr.iX;
   164         TInt rightMargin = choiceLayoutRect.Rect().iBr.iX;
   162         if ( AknLayoutUtils::LayoutMirrored() )
   165         leftMargin -= parentRect.iTl.iX;
   163             {
   166         rightMargin -= parentRect.iTl.iX;
   164             leftMargin -= parentRect.iTl.iX;
       
   165             rightMargin -= parentRect.iTl.iX;
       
   166             }
       
   167 
   167 
   168         AknLayoutUtils::LayoutControl(
   168         AknLayoutUtils::LayoutControl(
   169                 ControlItem( i - 1 ),
   169                 ComponentControl( i ),
   170                 rect,
   170                 rect,
   171                 choiceLayoutRect.Color().Value(),
   171                 choiceLayoutRect.Color().Value(),
   172                 leftMargin,
   172                 leftMargin,
   173                 0,
   173                 0,
   174                 rightMargin,
   174                 rightMargin,
   175                 choiceLayoutRect.Rect().iBr.iY,
   175                 choiceLayoutRect.Rect().iBr.iY,
   176                 choiceLayoutRect.Rect().Width(),
   176                 choiceLayoutRect.Rect().Width(),
   177                 choiceLayoutRect.Rect().Height() );
   177                 choiceLayoutRect.Rect().Height() );
   178         }
   178         }
       
   179     RecordField();
   179     }
   180     }
   180 
   181 
   181 // -----------------------------------------------------------------------------
   182 // -----------------------------------------------------------------------------
   182 // CESMRResponseField::MinimumSize
   183 // CESMRResponseField::MinimumSize
   183 // -----------------------------------------------------------------------------
   184 // -----------------------------------------------------------------------------
   299     if ( iConflicted )
   300     if ( iConflicted )
   300         {
   301         {
   301         // Construct the item to show conflicts info, and insert it to the beginning of array
   302         // Construct the item to show conflicts info, and insert it to the beginning of array
   302         CESMRResponseItem* conflictItem =
   303         CESMRResponseItem* conflictItem =
   303             CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
   304             CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
       
   305         conflictItem->SetContainerWindowL( *this );
   304         iResponseItemArray.Insert( conflictItem, 0 );
   306         iResponseItemArray.Insert( conflictItem, 0 );
   305         CleanupStack::Pop( conflictItem );
   307         CleanupStack::Pop( conflictItem );
   306 
   308 
   307         HBufC* conflictString;
   309         HBufC* conflictString;
   308         conflictString = StringLoader::LoadLC(
   310         conflictString = StringLoader::LoadLC(
   687         }
   689         }
   688 
   690 
   689     return handled;
   691     return handled;
   690     }
   692     }
   691 
   693 
   692 // -----------------------------------------------------------------------------
       
   693 // CESMRResponseField::ControlItem
       
   694 // -----------------------------------------------------------------------------
       
   695 //
       
   696 CCoeControl* CESMRResponseField::ControlItem( TInt aIndex )
       
   697     {
       
   698     CCoeControl* control = NULL;
       
   699     if( aIndex < iResponseItemArray.Count() )
       
   700         {
       
   701         control = static_cast<CCoeControl*>( iResponseItemArray[aIndex] );
       
   702         }
       
   703 
       
   704     return control;
       
   705     }
       
   706 
       
   707 // EOF
   694 // EOF
   708 
   695