191 CAknControl::SetDimmed(coeParent.IsDimmed()); |
191 CAknControl::SetDimmed(coeParent.IsDimmed()); |
192 |
192 |
193 UpdateDefaultFontL(); |
193 UpdateDefaultFontL(); |
194 DoSetFont(&iDefaultFont->Font()); |
194 DoSetFont(&iDefaultFont->Font()); |
195 UpdateMarginValues(); |
195 UpdateMarginValues(); |
196 UpdateSkinColor(); |
|
197 SetBackground(this); // Back will be drawn by ASwtControlBase::Draw |
196 SetBackground(this); // Back will be drawn by ASwtControlBase::Draw |
198 |
197 |
199 #ifdef RD_TACTILE_FEEDBACK |
198 #ifdef RD_TACTILE_FEEDBACK |
200 iFeedback = MTouchFeedback::Instance(); |
199 iFeedback = MTouchFeedback::Instance(); |
201 #endif // RD_TACTILE_FEEDBACK |
200 #endif // RD_TACTILE_FEEDBACK |
214 UpdateDefaultFontL(); |
213 UpdateDefaultFontL(); |
215 DoSetFont(&iDefaultFont->Font()); |
214 DoSetFont(&iDefaultFont->Font()); |
216 UpdateMarginValues(); |
215 UpdateMarginValues(); |
217 BuildDrawableFragmentsListL(TextRect()); |
216 BuildDrawableFragmentsListL(TextRect()); |
218 } |
217 } |
219 else if (aType == KAknsMessageSkinChange) |
218 } |
220 { |
|
221 if (!iCustomTextColor) |
|
222 { |
|
223 UpdateSkinColor(); |
|
224 } |
|
225 } |
|
226 } |
|
227 |
|
228 /** |
|
229 * Updates skin colors |
|
230 */ |
|
231 void CSwtLink::UpdateSkinColor() |
|
232 { |
|
233 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
234 iTextColor, |
|
235 KAknsIIDQsnTextColors, |
|
236 EAknsCIQsnTextColorsCG6); |
|
237 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
238 iLinkColor, |
|
239 KAknsIIDQsnHighlightColors, |
|
240 EAknsCIQsnHighlightColorsCG3); |
|
241 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
242 iHighlightColor, |
|
243 KAknsIIDQsnHighlightColors, |
|
244 EAknsCIQsnHighlightColorsCG2); |
|
245 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
246 iHighlightedLinkColor, |
|
247 KAknsIIDQsnTextColors, |
|
248 EAknsCIQsnTextColorsCG24); |
|
249 } |
|
250 |
|
251 |
219 |
252 /** |
220 /** |
253 * Updates default font |
221 * Updates default font |
254 */ |
222 */ |
255 void CSwtLink::UpdateDefaultFontL() |
223 void CSwtLink::UpdateDefaultFontL() |
1004 { |
972 { |
1005 CSwtDrawableLinkFragment* fragment = iDrawableLinkFragments[i]; |
973 CSwtDrawableLinkFragment* fragment = iDrawableLinkFragments[i]; |
1006 TRect rect = fragment->Rect(); |
974 TRect rect = fragment->Rect(); |
1007 rect.Move(textRect.iTl); |
975 rect.Move(textRect.iTl); |
1008 |
976 |
1009 TRgb textColor = iTextColor; |
977 TRgb textColor = TextColor(); |
1010 if (fragment->FragmentDescriptor()->Target()) |
978 if (fragment->FragmentDescriptor()->Target()) |
1011 { |
979 { |
1012 textColor = iLinkColor; |
980 textColor = LinkColor(); |
1013 } |
981 } |
1014 |
982 |
1015 // Same background highlight as that of HyperLink |
983 // Same background highlight as that of HyperLink |
1016 if (fragment->FragmentDescriptor() == iFocusedFragment |
984 if (fragment->FragmentDescriptor() == iFocusedFragment |
1017 && (iPressed || iDisplay.UiUtils().NaviKeyInput())) |
985 && (iPressed || iDisplay.UiUtils().NaviKeyInput())) |
1018 { |
986 { |
1019 textColor = iHighlightedLinkColor; |
987 textColor = PressedLinkColor(); |
1020 gc.SetPenStyle(CGraphicsContext::ENullPen); |
988 gc.SetPenStyle(CGraphicsContext::ENullPen); |
1021 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
989 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
1022 gc.SetBrushColor(iHighlightColor); |
990 gc.SetBrushColor(LinkBgColor()); |
1023 gc.DrawRect(rect); |
991 gc.DrawRect(rect); |
1024 } |
992 } |
1025 |
993 |
1026 gc.UseFont(font); |
994 gc.UseFont(font); |
1027 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
995 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
1207 // --------------------------------------------------------------------------- |
1175 // --------------------------------------------------------------------------- |
1208 // |
1176 // |
1209 void CSwtLink::SetForegroundL(const MSwtColor* aColor) |
1177 void CSwtLink::SetForegroundL(const MSwtColor* aColor) |
1210 { |
1178 { |
1211 ASwtControlBase::DoSetForegroundL(aColor); |
1179 ASwtControlBase::DoSetForegroundL(aColor); |
1212 aColor ? iCustomTextColor = ETrue : iCustomTextColor = EFalse; |
1180 iCustomFg = aColor; |
1213 if (iCustomTextColor) |
|
1214 { |
|
1215 TRgb rgb; |
|
1216 TBool overrideColorSet(GetColor(EColorControlText, rgb)); |
|
1217 ASSERT(overrideColorSet); |
|
1218 iTextColor = rgb; |
|
1219 iLinkColor = rgb; |
|
1220 } |
|
1221 else |
|
1222 { |
|
1223 UpdateSkinColor(); |
|
1224 } |
|
1225 Redraw(); |
1181 Redraw(); |
1226 } |
1182 } |
1227 |
1183 |
1228 |
|
1229 // --------------------------------------------------------------------------- |
1184 // --------------------------------------------------------------------------- |
1230 // From class MSwtControl. |
1185 // From class MSwtControl. |
1231 // --------------------------------------------------------------------------- |
1186 // --------------------------------------------------------------------------- |
1232 // |
1187 // |
1233 TSize CSwtLink::ComputeSizeL(TInt aWHint, TInt aHHint) |
1188 TSize CSwtLink::ComputeSizeL(TInt aWHint, TInt aHHint) |
1238 } |
1193 } |
1239 |
1194 |
1240 return ComputeTextSizeL(aWHint, aHHint); |
1195 return ComputeTextSizeL(aWHint, aHHint); |
1241 } |
1196 } |
1242 |
1197 |
|
1198 // --------------------------------------------------------------------------- |
|
1199 // CSwtLink::DefaultFont |
|
1200 // From MSwtControl |
|
1201 // --------------------------------------------------------------------------- |
|
1202 // |
|
1203 void CSwtLink::SetFontL(const MSwtFont* aFont) |
|
1204 { |
|
1205 ASwtControlBase::DoSetFontL(aFont); |
|
1206 DoSetFont(&GetFont()->Font()); |
|
1207 Redraw(); |
|
1208 } |
|
1209 |
|
1210 TBool CSwtLink::SetSwtFocus(TInt aReason /*= KSwtFocusByApi*/) |
|
1211 { |
|
1212 TBool prevFocused = IsFocusControl(); |
|
1213 TBool res = ASwtControlBase::SetSwtFocus(aReason); |
|
1214 |
|
1215 // Gaines focus by pointer |
|
1216 if (IsFocusControl() && !prevFocused) |
|
1217 { |
|
1218 iFocusChanged = ETrue; |
|
1219 } |
|
1220 |
|
1221 return res; |
|
1222 } |
|
1223 |
|
1224 TInt CSwtLink::PressBackgroundPolicy() const |
|
1225 { |
|
1226 return EEmbeddedPressBackground; |
|
1227 } |
1243 |
1228 |
1244 // --------------------------------------------------------------------------- |
1229 // --------------------------------------------------------------------------- |
1245 // CSwtLink::ComputeTextSizeL |
1230 // CSwtLink::ComputeTextSizeL |
1246 // --------------------------------------------------------------------------- |
1231 // --------------------------------------------------------------------------- |
1247 // |
1232 // |
1448 result = ETrue; |
1433 result = ETrue; |
1449 } |
1434 } |
1450 return result; |
1435 return result; |
1451 } |
1436 } |
1452 |
1437 |
1453 // --------------------------------------------------------------------------- |
1438 TRgb CSwtLink::TextColor() const |
1454 // CSwtLink::DefaultFont |
1439 { |
1455 // From MSwtControl |
1440 TBool highlighted = HasHighlight(); |
1456 // --------------------------------------------------------------------------- |
1441 if (!highlighted && iCustomFg) |
1457 // |
1442 { |
1458 void CSwtLink::SetFontL(const MSwtFont* aFont) |
1443 return iCustomFg->RgbValue(); |
1459 { |
1444 } |
1460 ASwtControlBase::DoSetFontL(aFont); |
1445 else |
1461 DoSetFont(&GetFont()->Font()); |
1446 { |
1462 Redraw(); |
1447 TRgb res(0); |
1463 } |
1448 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
1464 |
1449 res, |
|
1450 KAknsIIDQsnTextColors, |
|
1451 highlighted ? KHighlightedTextColor : KNonHighlightedTextColor); |
|
1452 return res; |
|
1453 } |
|
1454 } |
|
1455 |
|
1456 TRgb CSwtLink::LinkColor() const |
|
1457 { |
|
1458 TBool highlighted = HasHighlight(); |
|
1459 if (!highlighted && iCustomFg) |
|
1460 { |
|
1461 return iCustomFg->RgbValue(); |
|
1462 } |
|
1463 else |
|
1464 { |
|
1465 TRgb res(0); |
|
1466 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
1467 res, |
|
1468 KAknsIIDQsnHighlightColors, |
|
1469 EAknsCIQsnHighlightColorsCG3); |
|
1470 return res; |
|
1471 } |
|
1472 } |
|
1473 |
|
1474 TRgb CSwtLink::PressedLinkColor() const |
|
1475 { |
|
1476 TRgb res(0); |
|
1477 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
1478 res, |
|
1479 KAknsIIDQsnTextColors, |
|
1480 EAknsCIQsnTextColorsCG24); |
|
1481 return res; |
|
1482 } |
|
1483 |
|
1484 TRgb CSwtLink::LinkBgColor() const |
|
1485 { |
|
1486 TRgb res(0); |
|
1487 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
|
1488 res, |
|
1489 KAknsIIDQsnHighlightColors, |
|
1490 EAknsCIQsnHighlightColorsCG2); |
|
1491 return res; |
|
1492 } |
1465 |
1493 |
1466 void CSwtLink::DoSetFont(const CFont* aFont) |
1494 void CSwtLink::DoSetFont(const CFont* aFont) |
1467 { |
1495 { |
1468 iLineGap = Max(aFont->FontLineGap() - aFont->FontMaxHeight(), |
1496 iLineGap = Max(aFont->FontLineGap() - aFont->FontMaxHeight(), |
1469 KSwtMinLinePadding); |
1497 KSwtMinLinePadding); |
1562 { |
1590 { |
1563 iFocusedFragment = NULL; |
1591 iFocusedFragment = NULL; |
1564 } |
1592 } |
1565 } |
1593 } |
1566 |
1594 |
1567 TBool CSwtLink::SetSwtFocus(TInt aReason /*= KSwtFocusByApi*/) |
|
1568 { |
|
1569 TBool prevFocused = IsFocusControl(); |
|
1570 TBool res = ASwtControlBase::SetSwtFocus(aReason); |
|
1571 |
|
1572 // Gaines focus by pointer |
|
1573 if (IsFocusControl() && !prevFocused) |
|
1574 { |
|
1575 iFocusChanged = ETrue; |
|
1576 } |
|
1577 |
|
1578 return res; |
|
1579 } |
|
1580 |
|
1581 // --------------------------------------------------------------------------- |
1595 // --------------------------------------------------------------------------- |
1582 // CSwtLinkFragmentDescriptor |
1596 // CSwtLinkFragmentDescriptor |
1583 // --------------------------------------------------------------------------- |
1597 // --------------------------------------------------------------------------- |
1584 // |
1598 // |
1585 /** |
1599 /** |