115 iEikLabel->SetDimmed(IsDimmed()); |
115 iEikLabel->SetDimmed(IsDimmed()); |
116 iEikLabel->SetTextL(KNullDesC); |
116 iEikLabel->SetTextL(KNullDesC); |
117 SetAlignment(iStyle & KSwtAlignmentMask); |
117 SetAlignment(iStyle & KSwtAlignmentMask); |
118 RetrieveDefaultFontL(); |
118 RetrieveDefaultFontL(); |
119 DoSetFontL(&iDefaultFont->Font()); |
119 DoSetFontL(&iDefaultFont->Font()); |
120 |
120 UpdateTextColor(); |
121 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
122 TRgb defaultColor; |
|
123 if (AknsUtils::GetCachedColor(skin, defaultColor, |
|
124 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6) == KErrNone) |
|
125 { |
|
126 iEikLabel->OverrideColorL(EColorLabelText, defaultColor); |
|
127 } |
|
128 |
121 |
129 // Correct position of CEikLabel will be set in PositionChanged() |
122 // Correct position of CEikLabel will be set in PositionChanged() |
130 } |
123 } |
131 |
124 |
132 // --------------------------------------------------------------------------- |
125 // --------------------------------------------------------------------------- |
833 } |
826 } |
834 else if (iStyle & KSwtStyleSeparator) |
827 else if (iStyle & KSwtStyleSeparator) |
835 { |
828 { |
836 CreateSeparatorL(); |
829 CreateSeparatorL(); |
837 } |
830 } |
838 // If label foreground color has not been set then set ceiklabel to new skin default color |
831 |
839 if ((!iForegroundColor) && iEikLabel) |
832 if (aType == KAknsMessageSkinChange) |
840 { |
833 { |
841 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
834 UpdateTextColor(); |
842 TRgb defaultColor; |
|
843 if (AknsUtils::GetCachedColor(skin, defaultColor, |
|
844 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6) == KErrNone) |
|
845 { |
|
846 iEikLabel->OverrideColorL(EColorLabelText, defaultColor); |
|
847 } |
|
848 } |
835 } |
849 } |
836 } |
850 else if (aType == KEikDynamicLayoutVariantSwitch) |
837 else if (aType == KEikDynamicLayoutVariantSwitch) |
851 { |
838 { |
852 SetAlignment(iStyle & KSwtAlignmentMask); |
839 SetAlignment(iStyle & KSwtAlignmentMask); |
1225 |
1212 |
1226 Redraw(); |
1213 Redraw(); |
1227 } |
1214 } |
1228 |
1215 |
1229 // --------------------------------------------------------------------------- |
1216 // --------------------------------------------------------------------------- |
1230 // CSwtLabel::DefaultFont |
1217 // CSwtLabel::UpdateTextColor |
|
1218 // --------------------------------------------------------------------------- |
|
1219 // |
|
1220 void CSwtLabel::UpdateTextColor() |
|
1221 { |
|
1222 // This method is used only when label has parent, that has gained focus |
|
1223 // highlight. In such case label gets focus highlight and text color |
|
1224 // has to be updated |
|
1225 if (iEikLabel) |
|
1226 { |
|
1227 TRgb color(0); |
|
1228 TInt err(KErrNone); |
|
1229 |
|
1230 if (HasHighlight()) |
|
1231 { |
|
1232 // Highlighted foreground color, overrides all others. |
|
1233 err = AknsUtils::GetCachedColor(AknsUtils::SkinInstance() |
|
1234 , color |
|
1235 , KAknsIIDQsnTextColors |
|
1236 , KHighlightedTextColor); |
|
1237 } |
|
1238 else if (iCustomFg) |
|
1239 { |
|
1240 // Custom foreground color, overrides the default. |
|
1241 color = iCustomFg->RgbValue(); |
|
1242 } |
|
1243 else |
|
1244 { |
|
1245 // Default foreground color. |
|
1246 err = AknsUtils::GetCachedColor(AknsUtils::SkinInstance() |
|
1247 , color |
|
1248 , KAknsIIDQsnTextColors |
|
1249 , KNonHighlightedTextColor); |
|
1250 } |
|
1251 |
|
1252 if (err == KErrNone) |
|
1253 { |
|
1254 TRAP_IGNORE(iEikLabel->OverrideColorL(EColorLabelText, color)); |
|
1255 } |
|
1256 } |
|
1257 } |
|
1258 |
|
1259 // --------------------------------------------------------------------------- |
|
1260 // CSwtLabel::HandleHighlightChange |
|
1261 // From MSwtControl |
|
1262 // --------------------------------------------------------------------------- |
|
1263 // |
|
1264 void CSwtLabel::HandleHighlightChange() |
|
1265 { |
|
1266 UpdateTextColor(); |
|
1267 } |
|
1268 |
|
1269 // --------------------------------------------------------------------------- |
|
1270 // CSwtLabel::SetForegroundL |
1231 // From MSwtControl |
1271 // From MSwtControl |
1232 // --------------------------------------------------------------------------- |
1272 // --------------------------------------------------------------------------- |
1233 // |
1273 // |
1234 void CSwtLabel::SetForegroundL(const MSwtColor* aColor) |
1274 void CSwtLabel::SetForegroundL(const MSwtColor* aColor) |
1235 { |
1275 { |
1236 ASwtControlBase::DoSetForegroundL(aColor); |
1276 ASwtControlBase::DoSetForegroundL(aColor); |
1237 SetColorL(EColorLabelText, aColor); |
1277 SetColorL(EColorLabelText, aColor); |
1238 |
1278 iCustomFg = aColor; |
1239 // if color is null then reset label to default color |
1279 UpdateTextColor(); |
1240 if (aColor == NULL && iEikLabel != NULL) |
|
1241 { |
|
1242 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1243 TRgb defaultColor; |
|
1244 if (AknsUtils::GetCachedColor(skin, defaultColor, |
|
1245 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6) == KErrNone) |
|
1246 { |
|
1247 iEikLabel->OverrideColorL(EColorLabelText, defaultColor); |
|
1248 } |
|
1249 } |
|
1250 |
|
1251 iForegroundColor = aColor; |
|
1252 Redraw(); |
1280 Redraw(); |
1253 } |
1281 } |
1254 |
1282 |
1255 // --------------------------------------------------------------------------- |
1283 // --------------------------------------------------------------------------- |
1256 // CSwtLabel::DefaultFont |
1284 // CSwtLabel::DefaultFont |