javauis/lcdui_akn/lcdui/src/CMIDControlItem.cpp
branchRCL_3
changeset 23 e5618cc85d74
parent 19 71c436fe3ce0
child 24 6c158198356e
equal deleted inserted replaced
21:4376525cdefb 23:e5618cc85d74
    50 ///////////////////////////////////////////////////////////////////////////////////////////////////
    50 ///////////////////////////////////////////////////////////////////////////////////////////////////
    51 // class CMIDControlItem
    51 // class CMIDControlItem
    52 ///////////////////////////////////////////////////////////////////////////////////////////////////
    52 ///////////////////////////////////////////////////////////////////////////////////////////////////
    53 
    53 
    54 CMIDControlItem::CMIDControlItem(MMIDItem::TLayout aLayout, CMIDUIManager* aUIManager)
    54 CMIDControlItem::CMIDControlItem(MMIDItem::TLayout aLayout, CMIDUIManager* aUIManager)
    55         : CMIDItem(aLayout, aUIManager),
    55         : CMIDItem(aLayout, aUIManager)
    56         iCoeEnv(CCoeEnv::Static())
    56         , iCoeEnv(CCoeEnv::Static())
       
    57         , iHighlighted(EFalse)
    57 {
    58 {
    58 }
    59 }
    59 
    60 
    60 CMIDControlItem::~CMIDControlItem()
    61 CMIDControlItem::~CMIDControlItem()
    61 {
    62 {
   215 
   216 
   216 TTypeUid::Ptr CMIDControlItem::MopSupplyObject(TTypeUid aId)
   217 TTypeUid::Ptr CMIDControlItem::MopSupplyObject(TTypeUid aId)
   217 {
   218 {
   218     if (aId.iUid == MAknsControlContext::ETypeId && iForm)
   219     if (aId.iUid == MAknsControlContext::ETypeId && iForm)
   219     {
   220     {
   220         return IsFocused() ?
   221         if (iHighlighted)
   221                MAknsControlContext::SupplyMopObject(aId, iForm->GetHighlightBackgroundCc()) :
   222         {
   222                MAknsControlContext::SupplyMopObject(aId,
   223             // Highlighted background control context must be returned
   223                                                     iForm->CurrentDisplayable().BackGroundControlContext());
   224             // no matter if item is focused or not. Only then highlighted item
       
   225             // will be displayed correctly, if Form is faded
       
   226             // (e.g. Menu is shown).
       
   227             return MAknsControlContext::SupplyMopObject(aId,
       
   228                     iForm->GetHighlightBackgroundCc());
       
   229         }
       
   230         else
       
   231         {
       
   232             return MAknsControlContext::SupplyMopObject(aId,
       
   233                     iForm->CurrentDisplayable().BackGroundControlContext());
       
   234         }
   224     }
   235     }
   225     return SupplyMopObject(aId, iMenuHandler->Cba(), iMenuHandler->MenuBar());
   236     return SupplyMopObject(aId, iMenuHandler->Cba(), iMenuHandler->MenuBar());
   226 }
   237 }
   227 
   238 
   228 void CMIDControlItem::GetCaptionForFep(TDes& aCaption) const
   239 void CMIDControlItem::GetCaptionForFep(TDes& aCaption) const
   247 }
   258 }
   248 
   259 
   249 void CMIDControlItem::SetLabelColor(CMIDItemLabel* aLabelControl)
   260 void CMIDControlItem::SetLabelColor(CMIDItemLabel* aLabelControl)
   250 {
   261 {
   251     TRgb color;
   262     TRgb color;
   252         
   263 
   253     TInt labelColor = (IsFocused() && 
   264     // Set color for label text according to item highlight
   254                        Type() != MMIDComponent::ECustomItem &&
   265     // (logical color constants are defined in lcdui.h)
   255                        Type() != MMIDComponent::EImageItem) ? EAknsCIQsnTextColorsCG8 : EAknsCIQsnTextColorsCG6;
   266     TInt labelColor = (iHighlighted
       
   267                        && Type() != MMIDComponent::ECustomItem
       
   268                        && Type() != MMIDComponent::EImageItem)
       
   269                       ? KHighlightedItemTextColor : KNonHighlightedItemTextColor;
   256 
   270 
   257     // Get color from skin
   271     // Get color from skin
   258     if ((AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color,
   272     if ((AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color,
   259                                    KAknsIIDQsnTextColors, labelColor) == KErrNone) && iLabelControl)
   273                                    KAknsIIDQsnTextColors, labelColor) == KErrNone) && iLabelControl)
   260     {//data entry text color
   274     {//data entry text color