meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrcheckbox.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 16 b5fbb9b25d57
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
    54 
    54 
    55 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    56 // CESMRCheckbox::CESMRCheckbox
    56 // CESMRCheckbox::CESMRCheckbox
    57 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    58 //
    58 //
    59 CESMRCheckBox::CESMRCheckBox( MESMRFieldValidator* aValidator ) 
    59 CESMRCheckBox::CESMRCheckBox( MESMRFieldValidator* aValidator )
    60 : iChecked( EFalse )
    60 : iChecked( EFalse )
    61     {
    61     {
    62     FUNC_LOG;
    62     FUNC_LOG;
    63     
    63 
    64     iValidator = aValidator;
    64     iValidator = aValidator;
    65     
    65 
    66     SetFieldId( EESMRFieldAllDayEvent );
    66     SetFieldId( EESMRFieldAllDayEvent );
    67     SetFocusType ( EESMRHighlightFocus );
    67     SetFocusType ( EESMRHighlightFocus );
    68     }
    68     }
    69 
    69 
    70 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    74 void CESMRCheckBox::ConstructL()
    74 void CESMRCheckBox::ConstructL()
    75     {
    75     {
    76     FUNC_LOG;
    76     FUNC_LOG;
    77     iLabel = CMRLabel::NewL();
    77     iLabel = CMRLabel::NewL();
    78     iLabel->SetParent( this );
    78     iLabel->SetParent( this );
    79     
    79 
    80     CESMRField::ConstructL( iLabel ); //ownership transfered
    80     CESMRField::ConstructL( iLabel ); //ownership transfered
    81     
    81 
    82     HBufC* txt = StringLoader::LoadLC ( R_QTN_MEET_REQ_ALL_DAY_EVENT );
    82     HBufC* txt = StringLoader::LoadLC ( R_QTN_MEET_REQ_ALL_DAY_EVENT );
    83     iLabel->SetTextL( *txt );
    83     iLabel->SetTextL( *txt );
    84     CleanupStack::PopAndDestroy( txt );
    84     CleanupStack::PopAndDestroy( txt );
    85 
    85 
    86     // Creating field icon
    86     // Creating field icon
    87     SetIconL ( iChecked );    
    87     SetIconL ( iChecked );
    88     }
    88     }
    89 
    89 
    90 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
    91 // CESMRCheckbox::~CESMRCheckbox
    91 // CESMRCheckbox::~CESMRCheckbox
    92 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
   123     TBool isUsed( EFalse );
   123     TBool isUsed( EFalse );
   124     // EAknCmdOpen is added for the Pointer events, see ListPane
   124     // EAknCmdOpen is added for the Pointer events, see ListPane
   125     if( aCommand == EESMRCmdCheckEvent || aCommand == EAknCmdOpen )
   125     if( aCommand == EESMRCmdCheckEvent || aCommand == EAknCmdOpen )
   126         {
   126         {
   127     	HandleTactileFeedbackL();
   127     	HandleTactileFeedbackL();
   128     
   128 
   129         HandleCheckEventL();
   129         HandleCheckEventL();
   130         SwitchMSKLabelL();
   130         SwitchMSKLabelL();
   131         SendFieldChangeEventL( EESMRFieldAllDayEvent );
   131         SendFieldChangeEventL( EESMRFieldAllDayEvent );
   132         isUsed = ETrue;
   132         isUsed = ETrue;
   133         }
   133         }
   199 //
   199 //
   200 void CESMRCheckBox::SizeChanged()
   200 void CESMRCheckBox::SizeChanged()
   201     {
   201     {
   202     FUNC_LOG;
   202     FUNC_LOG;
   203     TRect rect = Rect();
   203     TRect rect = Rect();
   204     
   204 
   205     TAknLayoutRect rowLayoutRect =
   205     TAknLayoutRect rowLayoutRect =
   206      NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   206      NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   207     rect = rowLayoutRect.Rect();
   207     rect = rowLayoutRect.Rect();
   208     
   208 
   209     TAknWindowComponentLayout iconLayout =
   209     TAknWindowComponentLayout iconLayout =
   210      NMRLayoutManager::GetWindowComponentLayout( 
   210      NMRLayoutManager::GetWindowComponentLayout(
   211              NMRLayoutManager::EMRLayoutTextEditorIcon );
   211              NMRLayoutManager::EMRLayoutTextEditorIcon );
   212     AknLayoutUtils::LayoutImage( iFieldIcon, rect, iconLayout );
   212     AknLayoutUtils::LayoutImage( iFieldIcon, rect, iconLayout );
   213     
   213 
   214     TAknLayoutRect bgLayoutRect =
   214     TAknLayoutRect bgLayoutRect =
   215      NMRLayoutManager::GetLayoutRect( 
   215      NMRLayoutManager::GetLayoutRect(
   216              rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   216              rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   217     TRect bgRect( bgLayoutRect.Rect() );
   217     TRect bgRect( bgLayoutRect.Rect() );
   218     // Move focus rect so that it's relative to field's position.
   218     // Move focus rect so that it's relative to field's position.
   219     bgRect.Move( -Position() );
   219     bgRect.Move( -Position() );
   220     SetFocusRect( bgRect );
   220     SetFocusRect( bgRect );
   221     
   221 
   222     TAknLayoutText labelLayout = 
   222     TAknTextComponentLayout editorLayout =
   223      NMRLayoutManager::GetLayoutText( 
   223             NMRLayoutManager::GetTextComponentLayout(
   224              rect, NMRLayoutManager::EMRTextLayoutTextEditor );
   224                     NMRLayoutManager::EMRTextLayoutTextEditor );
   225     iLabel->SetRect( labelLayout.TextRect() );
   225 
   226         
   226     AknLayoutUtils::LayoutLabel( iLabel, rect, editorLayout );
   227     // Setting font also for the label
       
   228     iLabel->SetFont( labelLayout.Font() );
       
   229     }
   227     }
   230 
   228 
   231 // ---------------------------------------------------------------------------
   229 // ---------------------------------------------------------------------------
   232 // CESMRCheckbox::InternalizeL
   230 // CESMRCheckbox::InternalizeL
   233 // ---------------------------------------------------------------------------
   231 // ---------------------------------------------------------------------------
   265 void CESMRCheckBox::SetIconL( TBool aChecked )
   263 void CESMRCheckBox::SetIconL( TBool aChecked )
   266     {
   264     {
   267     FUNC_LOG;
   265     FUNC_LOG;
   268     delete iFieldIcon;
   266     delete iFieldIcon;
   269     iFieldIcon = NULL;
   267     iFieldIcon = NULL;
   270     
   268 
   271     NMRBitmapManager::TMRBitmapId iconID;
   269     NMRBitmapManager::TMRBitmapId iconID;
   272     if( aChecked )
   270     if( aChecked )
   273         {
   271         {
   274         iconID = NMRBitmapManager::EMRBitmapCheckBoxOn;
   272         iconID = NMRBitmapManager::EMRBitmapCheckBoxOn;
   275         }
   273         }
   276     else
   274     else
   277         {
   275         {
   278         iconID = NMRBitmapManager::EMRBitmapCheckBoxOff;
   276         iconID = NMRBitmapManager::EMRBitmapCheckBoxOff;
   279         }
   277         }
   280     
   278 
   281     iFieldIcon = CMRImage::NewL( iconID );
   279     iFieldIcon = CMRImage::NewL( iconID );
   282     iFieldIcon->SetParent( this );
   280     iFieldIcon->SetParent( this );
   283 
   281 
   284     SizeChanged();
   282     SizeChanged();
   285     }
   283     }
   341 
   339 
   342 // ---------------------------------------------------------------------------
   340 // ---------------------------------------------------------------------------
   343 // CESMRCheckbox::SetContainerWindowL
   341 // CESMRCheckbox::SetContainerWindowL
   344 // ---------------------------------------------------------------------------
   342 // ---------------------------------------------------------------------------
   345 //
   343 //
   346 void CESMRCheckBox::SetContainerWindowL( 
   344 void CESMRCheckBox::SetContainerWindowL(
   347         const CCoeControl& aContainer )
   345         const CCoeControl& aContainer )
   348     {
   346     {
   349     CCoeControl::SetContainerWindowL( aContainer );
   347     CCoeControl::SetContainerWindowL( aContainer );
   350     iLabel->SetContainerWindowL( aContainer );
   348     iLabel->SetContainerWindowL( aContainer );
   351     iLabel->SetParent( this );
   349     iLabel->SetParent( this );
   369         event->AddParamL( field );
   367         event->AddParamL( field );
   370         CleanupStack::Pop( field );
   368         CleanupStack::Pop( field );
   371         CESMRFieldEventValue* checked = CESMRFieldEventValue::NewLC(
   369         CESMRFieldEventValue* checked = CESMRFieldEventValue::NewLC(
   372                 CESMRFieldEventValue::EESMRInteger, &iChecked );
   370                 CESMRFieldEventValue::EESMRInteger, &iChecked );
   373         event->AddParamL( checked );
   371         event->AddParamL( checked );
   374         CleanupStack::Pop( checked );     
   372         CleanupStack::Pop( checked );
   375         iEventQueue->NotifyEventL( *event );
   373         iEventQueue->NotifyEventL( *event );
   376         CleanupStack::PopAndDestroy( event );
   374         CleanupStack::PopAndDestroy( event );
   377         }
   375         }
   378     }
   376     }
   379 // EOF
   377 // EOF