80 { |
79 { |
81 FUNC_LOG; |
80 FUNC_LOG; |
82 // Create label |
81 // Create label |
83 HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId ); |
82 HBufC* aTextBuf = StringLoader::LoadLC( aLabelTextId ); |
84 TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC(); |
83 TPtrC captionText = aTextBuf ? aTextBuf->Des() : TPtrC(); |
85 |
84 iLabel = new ( ELeave ) CNcsLabel( *this, NULL ); |
86 if( AknLayoutUtils::PenEnabled() ) |
85 iLabel->SetTextL( captionText ); |
87 { |
86 |
88 // Create a frameless button that has no observer |
87 // S60 Skin support |
89 // This is done like this to make Subject: field appear similar as |
88 iLabel->SetBrushStyle(CWindowGc::ENullBrush); |
90 // other header fields (To:, Cc:), although it doesn't have other |
89 |
91 // button-like features |
90 iTextEditor = new ( ELeave ) CNcsEditor( iSizeObserver, ETrue, ENcsEditorSubject, captionText ); |
92 TRect buttRect( 10, 10, 70, 100 ); |
|
93 iButton = CAknButton::NewL( NULL, NULL, NULL, NULL, |
|
94 captionText, TPtrC(), |
|
95 KAknButtonTextLeft | KAknButtonNoFrame , |
|
96 0 ); |
|
97 iButton->SetTextColorIds( |
|
98 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG63 ); |
|
99 iButton->SetContainerWindowL( *iParentControl ); |
|
100 iButton->SetRect( buttRect ); |
|
101 iButton->EnableFeedback( EFalse ); |
|
102 iButton->MakeVisible( ETrue ); |
|
103 iButton->ActivateL(); |
|
104 } |
|
105 else |
|
106 { |
|
107 iLabel = new ( ELeave ) CNcsLabel( *this, NULL ); |
|
108 iLabel->SetTextL( captionText ); |
|
109 |
|
110 // S60 Skin support |
|
111 iLabel->SetBrushStyle(CWindowGc::ENullBrush); |
|
112 } |
|
113 |
|
114 iTextEditor = new ( ELeave ) CNcsEditor( |
|
115 iSizeObserver, ETrue, ENcsEditorSubject, captionText ); |
|
116 CleanupStack::PopAndDestroy( aTextBuf ); |
91 CleanupStack::PopAndDestroy( aTextBuf ); |
117 } |
92 } |
118 |
93 |
119 // --------------------------------------------------------------------------- |
94 // --------------------------------------------------------------------------- |
120 // Destructor |
95 // Destructor |
123 CNcsSubjectField::~CNcsSubjectField() |
98 CNcsSubjectField::~CNcsSubjectField() |
124 { |
99 { |
125 FUNC_LOG; |
100 FUNC_LOG; |
126 delete iTextEditor; |
101 delete iTextEditor; |
127 delete iLabel; |
102 delete iLabel; |
128 delete iButton; |
103 // Platform layout change |
|
104 /*if ( iFont ) |
|
105 { |
|
106 ControlEnv()->ScreenDevice()->ReleaseFont( iFont ); |
|
107 iFont = NULL; |
|
108 }*/ |
129 } |
109 } |
130 |
110 |
131 // ----------------------------------------------------------------------------- |
111 // ----------------------------------------------------------------------------- |
132 // CNcsSubjectField::SetContainerWindowL() const |
112 // CNcsSubjectField::SetContainerWindowL() const |
133 // ----------------------------------------------------------------------------- |
113 // ----------------------------------------------------------------------------- |
134 // |
114 // |
135 void CNcsSubjectField::SetContainerWindowL( const CCoeControl& aContainer ) |
115 void CNcsSubjectField::SetContainerWindowL(const CCoeControl& aContainer) |
136 { |
116 { |
137 FUNC_LOG; |
117 FUNC_LOG; |
138 CCoeControl::SetContainerWindowL( aContainer ); |
118 CCoeControl::SetContainerWindowL(aContainer); |
139 |
119 |
140 // Create the component array |
120 // Create the component array |
141 InitComponentArrayL(); |
121 InitComponentArrayL(); |
142 CCoeControlArray& controls = Components(); |
122 CCoeControlArray& controls = Components(); |
143 controls.SetControlsOwnedExternally( ETrue ); |
123 controls.SetControlsOwnedExternally(ETrue); |
144 if ( iButton ) |
124 controls.AppendLC(iLabel); |
145 { |
125 CleanupStack::Pop(iLabel); |
146 controls.AppendLC( iButton ); |
126 controls.AppendLC(iTextEditor); |
147 CleanupStack::Pop( iButton ); |
127 CleanupStack::Pop(iTextEditor); |
148 } |
|
149 else |
|
150 { |
|
151 controls.AppendLC( iLabel ); |
|
152 CleanupStack::Pop( iLabel ); |
|
153 } |
|
154 controls.AppendLC( iTextEditor ); |
|
155 CleanupStack::Pop( iTextEditor ); |
|
156 |
128 |
157 // Setup text editor |
129 // Setup text editor |
158 iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 ); |
130 iTextEditor->ConstructL( &aContainer, KMaxAddressFieldLines, 0 ); |
159 iTextEditor->SetBorder( TGulBorder::ENone ); |
131 iTextEditor->SetBorder( TGulBorder::ENone ); |
160 iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
132 iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
161 iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( |
133 iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
162 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
163 iTextEditor->SetEdwinSizeObserver( this ); |
134 iTextEditor->SetEdwinSizeObserver( this ); |
164 iTextEditor->SetupEditorL(); |
135 iTextEditor->SetupEditorL(); |
165 // Setup label |
136 // Setup label |
166 UpdateFontSize(); |
137 UpdateFontSize(); |
167 UpdateColors(); |
138 UpdateColors(); |
197 void CNcsSubjectField::SizeChanged() |
168 void CNcsSubjectField::SizeChanged() |
198 { |
169 { |
199 FUNC_LOG; |
170 FUNC_LOG; |
200 |
171 |
201 const TRect rect( Rect() ); |
172 const TRect rect( Rect() ); |
202 if ( iButton ) |
173 NcsUtility::LayoutCaptionLabel( iLabel, rect ); |
203 { |
174 NcsUtility::LayoutDetailEdwinTouch( iTextEditor, rect, iEditorLineCount, EFalse ); |
204 NcsUtility::LayoutCaptionButton( iButton, rect ); |
|
205 } |
|
206 else |
|
207 { |
|
208 NcsUtility::LayoutCaptionLabel( iLabel, rect ); |
|
209 } |
|
210 |
|
211 NcsUtility::LayoutDetailEdwinTouch( |
|
212 iTextEditor, rect, iEditorLineCount, EFalse ); |
|
213 |
175 |
214 if ( iTextEditor->ScrollBarFrame() ) |
176 if (iTextEditor->ScrollBarFrame()) |
215 { |
177 { |
216 TRect rc = iTextEditor->Rect(); |
178 TRect rc = iTextEditor->Rect(); |
217 if ( AknLayoutUtils::LayoutMirrored() ) |
179 if (AknLayoutUtils::LayoutMirrored()) |
218 { |
180 { |
219 rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth( |
181 rc.iTl.iX += iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical); |
220 CEikScrollBar::EVertical ); |
|
221 } |
182 } |
222 else |
183 else |
223 { |
184 { |
224 rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth( |
185 rc.iBr.iX -= iTextEditor->ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical); |
225 CEikScrollBar::EVertical ); |
|
226 } |
186 } |
227 iTextEditor->SetRect( rc ); |
187 iTextEditor->SetRect(rc); |
228 } |
188 } |
229 |
189 |
230 // Setup text alignment according the mirrored/normal layout. |
190 // Setup text alignment according the mirrored/normal layout. |
231 if ( iLabel ) |
191 if ( AknLayoutUtils::LayoutMirrored() ) |
232 { |
192 { |
233 if ( AknLayoutUtils::LayoutMirrored() ) |
193 iLabel->SetAlignment( EHLeftVCenter ); |
234 { |
194 iLabel->SetLabelAlignment( ELayoutAlignLeft ); |
235 iLabel->SetAlignment( EHLeftVCenter ); |
195 } |
236 iLabel->SetLabelAlignment( ELayoutAlignLeft ); |
196 else |
237 } |
197 { |
238 else |
198 iLabel->SetAlignment( EHRightVCenter ); |
239 { |
199 iLabel->SetLabelAlignment( ELayoutAlignRight ); |
240 iLabel->SetAlignment( EHRightVCenter ); |
200 } |
241 iLabel->SetLabelAlignment( ELayoutAlignRight ); |
201 |
242 } |
|
243 } |
|
244 |
|
245 // this needs to be bidi as in mirrored layout |
202 // this needs to be bidi as in mirrored layout |
246 // writing language left to right can be set |
203 // writing language left to right can be set |
247 iTextEditor->SetAlignment( EAknEditorAlignBidi ); |
204 iTextEditor->SetAlignment( EAknEditorAlignBidi ); |
248 |
205 |
249 UpdateFontSize(); |
206 UpdateFontSize(); |
251 iTextEditor->UpdateCustomDrawer(); |
208 iTextEditor->UpdateCustomDrawer(); |
252 } |
209 } |
253 |
210 |
254 // ----------------------------------------------------------------------------- |
211 // ----------------------------------------------------------------------------- |
255 // CNcsSubjectField::PositionChanged() |
212 // CNcsSubjectField::PositionChanged() |
|
213 // set size |
256 // ----------------------------------------------------------------------------- |
214 // ----------------------------------------------------------------------------- |
257 // |
215 // |
258 void CNcsSubjectField::PositionChanged() |
216 void CNcsSubjectField::PositionChanged() |
259 { |
217 { |
260 FUNC_LOG; |
218 FUNC_LOG; |
261 // empty |
219 //SizeChanged(); |
262 } |
220 } |
263 |
221 |
264 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
265 // CNcsSubjectField::OfferKeyEventL() |
223 // CNcsSubjectField::OfferKeyEventL() |
266 // Handles key events |
224 // Handles key events |
267 // ----------------------------------------------------------------------------- |
225 // ----------------------------------------------------------------------------- |
268 // |
226 // |
269 TKeyResponse CNcsSubjectField::OfferKeyEventL( |
227 TKeyResponse CNcsSubjectField::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
270 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
271 { |
228 { |
272 FUNC_LOG; |
229 FUNC_LOG; |
273 TKeyResponse ret( EKeyWasNotConsumed ); |
230 TKeyResponse ret( EKeyWasNotConsumed ); |
274 |
231 |
275 ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType ); |
232 ret = iTextEditor->OfferKeyEventL( aKeyEvent, aType ); |
281 // Handles pointer events |
238 // Handles pointer events |
282 // ----------------------------------------------------------------------------- |
239 // ----------------------------------------------------------------------------- |
283 // |
240 // |
284 void CNcsSubjectField::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
241 void CNcsSubjectField::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
285 { |
242 { |
286 FUNC_LOG; |
243 FUNC_LOG; |
287 CCoeControl::HandlePointerEventL( aPointerEvent ); |
244 iTextEditor->HandlePointerEventL( aPointerEvent ); |
288 } |
245 } |
289 |
246 |
290 // ----------------------------------------------------------------------------- |
247 // ----------------------------------------------------------------------------- |
291 // CNcsSubjectField::FocusChanged() |
248 // CNcsSubjectField::FocusChanged() |
292 // ----------------------------------------------------------------------------- |
249 // ----------------------------------------------------------------------------- |
293 // |
250 // |
294 void CNcsSubjectField::FocusChanged( TDrawNow aDrawNow ) |
251 void CNcsSubjectField::FocusChanged( TDrawNow aDrawNow ) |
295 { |
252 { |
296 FUNC_LOG; |
253 FUNC_LOG; |
297 if ( IsFocused() ) |
254 if ( IsFocused() ) |
298 { |
255 { |
299 iTextEditor->SetFocus( ETrue, aDrawNow ); |
256 iTextEditor->SetFocus( ETrue ); |
300 if ( iParentControl ) |
257 //TRAP_IGNORE( iTextEditor->SetCursorPosL( iTextEditor->TextLength(), EFalse ) ); |
301 { |
258 |
302 TRAP_IGNORE( iParentControl->SetMskL() ); |
259 // make sure that control is visible on screen |
303 } |
260 if ( Rect().iTl.iY < 0 ) |
304 } |
261 { |
305 else |
262 TPoint pt = TPoint( 0, 0 ); |
306 { |
263 Reposition( pt, Rect().Width() ); |
307 iTextEditor->SetFocus( EFalse, aDrawNow ); |
264 iSizeObserver->UpdateFieldPosition( this ); |
308 } |
265 } |
309 |
266 else |
310 if ( aDrawNow ) |
267 { |
311 { |
268 TPoint pos = PositionRelativeToScreen(); |
312 DrawNow(); |
269 pos.iY += Size().iHeight; |
313 } |
270 CWsScreenDevice* screenDev = ControlEnv()->ScreenDevice(); |
314 } |
271 TPixelsAndRotation pix; |
|
272 screenDev->GetDefaultScreenSizeAndRotation( pix ); |
|
273 const TInt h = pix.iPixelSize.iHeight; |
|
274 if ( pos.iY >= h - h / 3 ) |
|
275 { |
|
276 TPoint pt = TPoint( 0, h / 3 ); |
|
277 Reposition( pt, Rect().Width() ); |
|
278 iSizeObserver->UpdateFieldPosition( this ); |
|
279 } |
|
280 } |
|
281 |
|
282 if ( iParentControl ) |
|
283 { |
|
284 TRAP_IGNORE( iParentControl->SetMskL() ); |
|
285 } |
|
286 } |
|
287 else |
|
288 { |
|
289 iTextEditor->SetFocus( EFalse ); |
|
290 } |
|
291 |
|
292 if ( aDrawNow ) |
|
293 { |
|
294 DrawNow(); |
|
295 } |
|
296 } |
315 |
297 |
316 // ----------------------------------------------------------------------------- |
298 // ----------------------------------------------------------------------------- |
317 // CNcsSubjectField::MinimumHeight() |
299 // CNcsSubjectField::MinimumHeight() |
318 // return height of subject control |
300 // return height of subject control |
319 // ----------------------------------------------------------------------------- |
301 // ----------------------------------------------------------------------------- |
320 // |
302 // |
321 TInt CNcsSubjectField::MinimumHeight() |
303 TInt CNcsSubjectField::MinimumHeight() |
322 { |
304 { |
323 FUNC_LOG; |
305 FUNC_LOG; |
|
306 // Platform layout changes |
|
307 /* |
|
308 TNcsMeasures m = NcsUtility::Measures(); |
|
309 TInt height = m.iAifHeight - m.iAifEditorHeight + iEditorMinimumHeight + m.iSubjectExtraHeightBottom; |
|
310 TInt height2 = m.iAifHeight + m.iSubjectExtraHeightBottom; |
|
311 // if followup icon and priority icon are both visible increase the subject field height |
|
312 if ( iFollowUp && iPriority != EMsgPriorityNormal ) |
|
313 { |
|
314 height2 += KIconHeightFollowUp; |
|
315 } |
|
316 return Max( height, height2 ); |
|
317 */ |
|
318 //return NcsUtility::MinimumHeaderSize( Rect(), iEditorLineCount ).iHeight; |
|
319 // Platform layout changes |
324 return 0; |
320 return 0; |
325 } |
321 } |
326 |
322 |
327 // ----------------------------------------------------------------------------- |
323 // ----------------------------------------------------------------------------- |
328 // CNcsSubjectField::SetSubjectL() |
324 // CNcsSubjectField::SetSubjectL() |
342 } |
338 } |
343 |
339 |
344 RMemReadStream inputStream( aSubject.Ptr(), aSubject.Size() ); |
340 RMemReadStream inputStream( aSubject.Ptr(), aSubject.Size() ); |
345 CleanupClosePushL( inputStream ); |
341 CleanupClosePushL( inputStream ); |
346 |
342 |
347 iTextEditor->RichText()->ImportTextL( |
343 iTextEditor->RichText()->ImportTextL( 0, inputStream, CPlainText::EOrganiseByParagraph ); |
348 0, inputStream, CPlainText::EOrganiseByParagraph ); |
|
349 |
344 |
350 // Activating the field will set the control to the end of the text |
345 // Activating the field will set the control to the end of the text |
351 iTextEditor->ActivateL(); |
346 iTextEditor->ActivateL(); |
352 iTextEditor->SetCursorPosL( 0, EFalse ); |
347 iTextEditor->SetCursorPosL(0,EFalse); |
353 |
348 |
354 CleanupStack::PopAndDestroy( &inputStream ); |
349 CleanupStack::PopAndDestroy( &inputStream ); |
355 } |
350 } |
356 } |
351 } |
357 |
352 |
361 // |
356 // |
362 TBool CNcsSubjectField::HandleEdwinSizeEventL( CEikEdwin* /*aEdwin*/, |
357 TBool CNcsSubjectField::HandleEdwinSizeEventL( CEikEdwin* /*aEdwin*/, |
363 TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize ) |
358 TEdwinSizeEvent /*aEventType*/, TSize aDesirableEdwinSize ) |
364 { |
359 { |
365 FUNC_LOG; |
360 FUNC_LOG; |
|
361 // Platform layout chage |
|
362 /* |
366 TInt ret( EFalse ); |
363 TInt ret( EFalse ); |
367 TInt htLine = iTextEditor->GetLineHeightL(); |
364 TInt htLine = iTextEditor->GetLineHeightL(); |
368 TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
365 TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
|
366 |
|
367 if ( numLinesDesired < KMaxAddressFieldLines && |
|
368 iEditorMinimumHeight != aDesirableEdwinSize.iHeight ) |
|
369 { |
|
370 iEditorMinimumHeight = aDesirableEdwinSize.iHeight; |
|
371 iTextEditor->CreateScrollBarFrameL()->SetScjrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
372 if ( iSizeObserver ) |
|
373 { |
|
374 ret = iSizeObserver->UpdateFieldSizeL(); |
|
375 } |
|
376 } |
|
377 else if ( iEditorMinimumHeight != htLine * KMaxAddressFieldLines ) |
|
378 { |
|
379 //We may still need to resize the controll. |
|
380 iEditorMinimumHeight = htLine * KMaxAddressFieldLines; |
|
381 iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn ); |
|
382 if ( iSizeObserver ) |
|
383 { |
|
384 ret = iSizeObserver->UpdateFieldSizeL(); |
|
385 } |
|
386 } |
|
387 */ |
|
388 |
|
389 TInt ret( EFalse ); |
|
390 TInt htLine = iTextEditor->GetLineHeightL(); |
|
391 TInt numLinesDesired = aDesirableEdwinSize.iHeight / htLine; |
|
392 // commented because of EGWG-83ECSR, no negative feedback after removing |
|
393 //CEikScrollBarFrame& scrollBarFrame( *iTextEditor->CreateScrollBarFrameL() ); |
369 iEditorLineCount = numLinesDesired; |
394 iEditorLineCount = numLinesDesired; |
|
395 //scrollBarFrame.SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
370 if ( iSizeObserver ) |
396 if ( iSizeObserver ) |
371 { |
397 { |
372 ret = iSizeObserver->UpdateFieldSizeL(); |
398 ret = iSizeObserver->UpdateFieldSizeL(); |
373 } |
399 } |
374 return ret; |
400 return ret; |
465 // CNcsSubjectField::Reposition |
492 // CNcsSubjectField::Reposition |
466 // ----------------------------------------------------------------------------- |
493 // ----------------------------------------------------------------------------- |
467 void CNcsSubjectField::Reposition(TPoint& aPt, TInt /*aWidth*/) |
494 void CNcsSubjectField::Reposition(TPoint& aPt, TInt /*aWidth*/) |
468 { |
495 { |
469 FUNC_LOG; |
496 FUNC_LOG; |
|
497 /* |
|
498 const TSize size( aWidth, MinimumHeight() ); |
|
499 SetExtent( aPt, size ); |
|
500 aPt.iY += size.iHeight; |
|
501 */ |
470 SetPosition( aPt ); |
502 SetPosition( aPt ); |
|
503 // Platform layout changes |
471 } |
504 } |
472 |
505 |
473 // ----------------------------------------------------------------------------- |
506 // ----------------------------------------------------------------------------- |
474 // CNcsSubjectField::GetLineRectL |
507 // CNcsSubjectField::GetLineRectL |
475 // ----------------------------------------------------------------------------- |
508 // ----------------------------------------------------------------------------- |
476 void CNcsSubjectField::GetLineRect( TRect& aLineRect ) const |
509 void CNcsSubjectField::GetLineRectL( TRect& aLineRect ) const |
477 { |
510 { |
478 FUNC_LOG; |
511 FUNC_LOG; |
479 return iTextEditor->GetLineRect( aLineRect ); |
512 return iTextEditor->GetLineRectL( aLineRect ); |
480 } |
513 } |
481 |
514 |
482 // ----------------------------------------------------------------------------- |
515 // ----------------------------------------------------------------------------- |
483 // CNcsSubjectField::SetMaxLabelLength |
516 // CNcsSubjectField::SetMaxLabelLength |
484 // ----------------------------------------------------------------------------- |
517 // ----------------------------------------------------------------------------- |
485 void CNcsSubjectField::SetMaxLabelLength( TInt aMaxLength ) |
518 void CNcsSubjectField::SetMaxLabelLength( TInt aMaxLength ) |
502 // --------------------------------------------------------------------------- |
535 // --------------------------------------------------------------------------- |
503 // |
536 // |
504 void CNcsSubjectField::UpdateColors() |
537 void CNcsSubjectField::UpdateColors() |
505 { |
538 { |
506 FUNC_LOG; |
539 FUNC_LOG; |
507 |
540 // Platform layout change |
508 if ( iLabel ) |
541 TRgb textColor = KRgbBlack; |
|
542 if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, |
|
543 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ) != KErrNone ) |
|
544 { |
|
545 textColor = KRgbBlack; |
|
546 } |
|
547 TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, textColor ) ); |
|
548 // Platform layout change |
|
549 |
|
550 CFreestyleEmailUiAppUi* appUi = |
|
551 static_cast<CFreestyleEmailUiAppUi*>( ControlEnv()->AppUi() ); |
|
552 iBorderColor = appUi->LayoutHandler()->ComposerFieldBorderColor(); |
|
553 iBgColor = appUi->LayoutHandler()->ComposerFieldBackgroundColor(); |
|
554 } |
|
555 |
|
556 // Platform layout changes |
|
557 // --------------------------------------------------------------------------- |
|
558 // CNcsSubjectField::UpdateFontSize() |
|
559 // --------------------------------------------------------------------------- |
|
560 // |
|
561 void CNcsSubjectField::UpdateFontSize() |
|
562 { |
|
563 FUNC_LOG; |
|
564 /*if ( iFont ) |
|
565 { |
|
566 ControlEnv()->ScreenDevice()->ReleaseFont( iFont ); |
|
567 iFont = NULL; |
|
568 } |
|
569 |
|
570 TNcsMeasures m = NcsUtility::Measures(); |
|
571 if ( !iFont ) |
509 { |
572 { |
510 TRgb textColor = KRgbBlack; |
573 TRAP_IGNORE( iFont = NcsUtility::GetNearestFontL(EAknLogicalFontPrimarySmallFont, |
511 if ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor, |
574 m.iLabelFontHeightPx) ); |
512 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ) != KErrNone ) |
575 }*/ |
513 { |
576 iFont = NcsUtility::GetLayoutFont( iLabel->Rect(), NcsUtility::ENcsHeaderCaptionFont ); |
514 textColor = KRgbBlack; |
577 iLabel->SetFont( iFont ); |
515 } |
|
516 TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, textColor ) ); |
|
517 } |
|
518 } |
|
519 |
|
520 // --------------------------------------------------------------------------- |
|
521 // CNcsSubjectField::UpdateFontSize() |
|
522 // --------------------------------------------------------------------------- |
|
523 // |
|
524 void CNcsSubjectField::UpdateFontSize() |
|
525 { |
|
526 FUNC_LOG; |
|
527 CCoeControl* control = |
|
528 iButton ? ( CCoeControl* )iButton : ( CCoeControl* )iLabel; |
|
529 iFont = NcsUtility::GetLayoutFont( |
|
530 control->Rect(), NcsUtility::ENcsHeaderCaptionFont ); |
|
531 if( control == iButton ) |
|
532 { |
|
533 iButton->SetTextFont( iFont ); |
|
534 } |
|
535 else |
|
536 { |
|
537 iLabel->SetFont( iFont ); |
|
538 } |
|
539 iTextEditor->UpdateFontSize(); |
578 iTextEditor->UpdateFontSize(); |
540 UpdateColors(); |
579 UpdateColors(); |
541 } |
580 } |
542 |
581 |
543 // --------------------------------------------------------------------------- |
582 // --------------------------------------------------------------------------- |
551 if ( aType == KAknsMessageSkinChange || |
590 if ( aType == KAknsMessageSkinChange || |
552 aType == KEikMessageColorSchemeChange ) |
591 aType == KEikMessageColorSchemeChange ) |
553 { |
592 { |
554 UpdateFontSize(); |
593 UpdateFontSize(); |
555 UpdateColors(); |
594 UpdateColors(); |
556 iTextEditor->HandleResourceChange( aType ); |
595 // Platform layout changes |
557 } |
596 iTextEditor->HandleResourceChange( aType ) ;//CreateScrollBarFrameL()->DrawScrollBarsNow(); |
558 } |
597 // Platform layout changes |
559 |
598 } |
560 // --------------------------------------------------------------------------- |
599 } |
561 // CNcsSubjectField::EnableKineticScrollingL() |
600 |
562 // --------------------------------------------------------------------------- |
601 void CNcsSubjectField::EnableKineticScrollingL(CAknPhysics* aPhysics) |
563 // |
602 { |
564 void CNcsSubjectField::EnableKineticScrollingL( CAknPhysics* aPhysics ) |
603 iTextEditor->EnableKineticScrollingL(aPhysics); |
565 { |
|
566 iTextEditor->EnableKineticScrollingL( aPhysics ); |
|
567 iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue ); |
604 iTextEditor->TextLayout()->RestrictScrollToTopsOfLines( ETrue ); |
568 } |
605 } |
569 |
606 |
570 // --------------------------------------------------------------------------- |
|
571 // CNcsSubjectField::SetPhysicsEmulationOngoing() |
|
572 // --------------------------------------------------------------------------- |
|
573 // |
|
574 void CNcsSubjectField::SetPhysicsEmulationOngoing( TBool aPhysOngoing ) |
607 void CNcsSubjectField::SetPhysicsEmulationOngoing( TBool aPhysOngoing ) |
575 { |
608 { |
576 iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing ); |
609 iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing ); |
577 } |
610 } |