--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcaptionedcontrol.cpp Thu Jul 15 18:31:06 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcaptionedcontrol.cpp Thu Aug 19 09:48:13 2010 +0300
@@ -148,9 +148,6 @@
iDefaultFont->RemoveRef();
iDefaultFont = NULL;
}
-
- // Not Own
- iForegroundColor = NULL;
}
// ---------------------------------------------------------------------------
@@ -175,9 +172,10 @@
iControl->SetFocusing(ETrue);
iControl->ActivateL();
- SetDefaultForegroundL();
SetBackground(this); // Back will be drawn by ASwtControlBase::Draw
ActivateL();
+
+ UpdateTextColor();
}
// ---------------------------------------------------------------------------
@@ -231,20 +229,6 @@
}
// ---------------------------------------------------------------------------
-// CSwtCaptionedControl::SetEmphasis
-// ---------------------------------------------------------------------------
-//
-void CSwtCaptionedControl::SetEmphasis(TDrawNow /*aDrawNow*/)
-{
- // If foreground color has not been set then update according to focus
- if (!iForegroundColor)
- {
- TRAP_IGNORE(SetDefaultForegroundL());
- }
- Redraw();
-}
-
-// ---------------------------------------------------------------------------
// CSwtCaptionedControl::ComputeInnerRect
// ---------------------------------------------------------------------------
//
@@ -313,29 +297,6 @@
}
// ---------------------------------------------------------------------------
-// CSwtCaptionedControl::SetDefaultForegroundL
-// ---------------------------------------------------------------------------
-//
-void CSwtCaptionedControl::SetDefaultForegroundL()
-{
- TRgb defaultColor;
- TAknsQsnTextColorsIndex colorIndex;
- if (iDisplay.UiUtils().NaviKeyInput() && IsFocusedOrChildIsFocused())
- {
- colorIndex = EAknsCIQsnTextColorsCG10;
- }
- else
- {
- colorIndex = EAknsCIQsnTextColorsCG6;
- }
- if (AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), defaultColor,
- KAknsIIDQsnTextColors, colorIndex) == KErrNone)
- {
- OverrideColorL(EColorLabelText, defaultColor);
- }
-}
-
-// ---------------------------------------------------------------------------
// CSwtCaptionedControl::GetRecursiveChildrenL
// ---------------------------------------------------------------------------
//
@@ -694,14 +655,6 @@
//
void CSwtCaptionedControl::SwtHandleResourceChangeL(TInt aType)
{
- if (aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch)
- {
- if (!iForegroundColor)
- {
- SetDefaultForegroundL();
- }
- }
-
CEikCaptionedControl::HandleResourceChange(aType);
CCoeControl* coeChild = CoeChild();
@@ -751,6 +704,11 @@
}
}
}
+
+ if (aType == KAknsMessageSkinChange)
+ {
+ UpdateTextColor();
+ }
}
}
@@ -762,13 +720,62 @@
void CSwtCaptionedControl::SetForegroundL(const MSwtColor* aColor)
{
ASwtControlBase::DoSetForegroundL(aColor);
- SetColorL(EColorLabelText, aColor);
- if (!aColor)
+ iCustomFg = aColor;
+ UpdateTextColor();
+ Redraw();
+}
+
+// ---------------------------------------------------------------------------
+// CSwtCaptionedControl::UpdateTextColor
+// From MSwtControl
+// ---------------------------------------------------------------------------
+//
+void CSwtCaptionedControl::UpdateTextColor()
+{
+ TRgb color(0);
+ TInt err(KErrNone);
+
+ if (HasHighlight())
+ {
+ // Highlighted foreground color, overrides all others.
+ err = AknsUtils::GetCachedColor(AknsUtils::SkinInstance()
+ , color
+ , KAknsIIDQsnTextColors
+ , KHighlightedTextColor);
+ }
+ else if (iCustomFg)
{
- SetDefaultForegroundL();
+ // Custom foreground color, overrides the default.
+ color = iCustomFg->RgbValue();
+ }
+ else
+ {
+ // Default foreground color.
+ err = AknsUtils::GetCachedColor(AknsUtils::SkinInstance()
+ , color
+ , KAknsIIDQsnTextColors
+ , KNonHighlightedTextColor);
+ }
+
+ if (err == KErrNone)
+ {
+ TRAP_IGNORE(OverrideColorL(EColorLabelText, color));
}
- iForegroundColor = aColor;
- Redraw();
+}
+
+// ---------------------------------------------------------------------------
+// CSwtCaptionedControl::HandleHighlightChange
+// From MSwtControl
+// ---------------------------------------------------------------------------
+//
+void CSwtCaptionedControl::HandleHighlightChange()
+{
+ UpdateTextColor();
+ MSwtControl* child = Child();
+ if (child)
+ {
+ child->HandleHighlightChange();
+ }
}
// ---------------------------------------------------------------------------
@@ -779,7 +786,6 @@
void CSwtCaptionedControl::FocusChanged(TDrawNow aDrawNow)
{
HandleFocusChanged(aDrawNow);
- SetEmphasis(aDrawNow);
}
// ---------------------------------------------------------------------------
@@ -1630,7 +1636,6 @@
//
void CSwtCaptionedControl::ChildFocusChanged(MSwtControl& aControl)
{
- SetEmphasis(ENoDrawNow);
GetParent()->ChildFocusChanged(aControl);
}
@@ -1816,7 +1821,6 @@
iCaption->SetMopParent(this); // Absolutely necessary
iCaption->MakeVisible(IsVisible());
iCaption->SetDimmed(IsDimmed());
- SetEmphasis(ENoDrawNow);
if (AknLayoutUtils::LayoutMirrored())
{
iCaption->SetAlignment(EHRightVCenter);
@@ -1841,6 +1845,8 @@
{
iCaption->iMargin.iTop = captionRealFontHeight - font.HeightInPixels();
}
+
+ UpdateTextColor();
}
// We force a call to ( private ) SizeChanged to resize the components.
@@ -1873,7 +1879,6 @@
iTrailer->SetMopParent(this); // Absolutely necessary
iTrailer->MakeVisible(IsVisible());
iTrailer->SetDimmed(IsDimmed());
- SetEmphasis(ENoDrawNow);
iTrailer->ActivateL();
}
@@ -1890,6 +1895,8 @@
{
iTrailer->iMargin.iTop = captionRealFontHeight - font.HeightInPixels();
}
+
+ UpdateTextColor();
}
// We force a call to ( private ) SizeChanged to resize the components.