javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtdateeditor.cpp
branchRCL_3
changeset 60 6c158198356e
parent 46 4376525cdefb
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    60                                TInt aStyle)
    60                                TInt aStyle)
    61         : ASwtControlBase(aDisplay, aPeer, &aParent, aStyle)
    61         : ASwtControlBase(aDisplay, aPeer, &aParent, aStyle)
    62         , iCurrentFieldLength(0)
    62         , iCurrentFieldLength(0)
    63         , iCurrentFieldDecimalPlacesCount(0)
    63         , iCurrentFieldDecimalPlacesCount(0)
    64         , iLastField(0)
    64         , iLastField(0)
       
    65         , iFgColorIsCustom(EFalse)
    65 {
    66 {
    66 }
    67 }
    67 
    68 
    68 // ---------------------------------------------------------------------------------------------
    69 // ---------------------------------------------------------------------------------------------
    69 // CSwtDateEditor::~CSwtDateEditor
    70 // CSwtDateEditor::~CSwtDateEditor
   279 //
   280 //
   280 void CSwtDateEditor::SetForegroundL(const MSwtColor* aColor)
   281 void CSwtDateEditor::SetForegroundL(const MSwtColor* aColor)
   281 {
   282 {
   282     ASwtControlBase::DoSetForegroundL(aColor);
   283     ASwtControlBase::DoSetForegroundL(aColor);
   283 
   284 
   284     TRgb color((aColor) ? aColor->RgbValue() : iEikonEnv->Color(EColorControlText));
   285     if (aColor)
   285     iEditor->OverrideColorL(EColorControlText, color);
   286     {
       
   287         iFgColorIsCustom = ETrue;
       
   288         iForegroundColor = aColor->RgbValue();
       
   289     }
       
   290     else
       
   291     {
       
   292         iFgColorIsCustom = EFalse;
       
   293         iForegroundColor = 0;
       
   294     }
   286 
   295 
   287     // If a back color has been set, cannot go back to skin colors yet.
   296     // If a back color has been set, cannot go back to skin colors yet.
   288     if (!iBgColorIsCustom)
   297     if (!iBgColorIsCustom)
   289     {
   298     {
   290         if (aColor)
   299         if (aColor)
   295         {
   304         {
   296             iEditor->SetUseOverrideColors(EFalse);
   305             iEditor->SetUseOverrideColors(EFalse);
   297         }
   306         }
   298     }
   307     }
   299 
   308 
   300     if (aColor)
   309     UpdateTextColor();
   301     {
       
   302         iFgColorIsCustom = ETrue;
       
   303     }
       
   304     else
       
   305     {
       
   306         iFgColorIsCustom = EFalse;
       
   307     }
       
   308 
       
   309     Redraw();
   310     Redraw();
   310 }
   311 }
   311 
   312 
   312 // ---------------------------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------------------------
   313 // CSwtDateEditor::OfferKeyEventL
   314 // CSwtDateEditor::OfferKeyEventL
   582         else
   583         else
   583         {
   584         {
   584             ProcessFontUpdate();
   585             ProcessFontUpdate();
   585         }
   586         }
   586         SizeChanged();
   587         SizeChanged();
       
   588 
       
   589         if (aType == KAknsMessageSkinChange)
       
   590         {
       
   591             UpdateTextColor();
       
   592         }
   587     }
   593     }
   588 #ifdef RD_JAVA_S60_RELEASE_9_2
   594 #ifdef RD_JAVA_S60_RELEASE_9_2
   589     else if (aType == KAknSplitInputEnabled)
   595     else if (aType == KAknSplitInputEnabled)
   590     {
   596     {
   591         const MSwtShell* activeShell = iDisplay.UiUtils().GetActiveShell();
   597         const MSwtShell* activeShell = iDisplay.UiUtils().GetActiveShell();
  1011         iEditor->SetFocusing(ETrue);
  1017         iEditor->SetFocusing(ETrue);
  1012         iEditor->MakeVisible(IsVisible());
  1018         iEditor->MakeVisible(IsVisible());
  1013         iEditor->SetFocus(IsFocused());
  1019         iEditor->SetFocus(IsFocused());
  1014         iEditor->SetDimmed(IsDimmed());
  1020         iEditor->SetDimmed(IsDimmed());
  1015         RetrieveDefaultFontL();
  1021         RetrieveDefaultFontL();
  1016         iEditor->SetSkinTextColorL(EAknsCIQsnTextColorsCG6);
  1022         iEditor->SetSkinTextColorL(KNonHighlightedTextColor);
  1017 
  1023 
  1018 #ifdef RD_JAVA_S60_RELEASE_9_2
  1024 #ifdef RD_JAVA_S60_RELEASE_9_2
  1019         if (iEditor->SupportsFeature(CEikMfne::EPartialScreenInput))
  1025         if (iEditor->SupportsFeature(CEikMfne::EPartialScreenInput))
  1020         {
  1026         {
  1021             iEditor->SetFeature(CEikMfne::EPartialScreenInput, ETrue);
  1027             iEditor->SetFeature(CEikMfne::EPartialScreenInput, ETrue);
  1022         }
  1028         }
  1023 #endif
  1029 #endif
  1024     }
  1030     }
  1025     ActivateL();
  1031     ActivateL();
       
  1032 
       
  1033     // Because the creation of the contained editor is delayed
       
  1034     // we need to ensure that it redraws with correct size.
       
  1035     // Not doing this would result in empty list in CaptionedControl for instance.
       
  1036     SizeChanged();
  1026 }
  1037 }
  1027 
  1038 
  1028 // ---------------------------------------------------------------------------------------------
  1039 // ---------------------------------------------------------------------------------------------
  1029 // CSwtDateEditor::SetOffset
  1040 // CSwtDateEditor::SetOffset
  1030 // ---------------------------------------------------------------------------------------------
  1041 // ---------------------------------------------------------------------------------------------
  1186         }
  1197         }
  1187     }
  1198     }
  1188     return ASwtControlBase::Dispose();
  1199     return ASwtControlBase::Dispose();
  1189 }
  1200 }
  1190 
  1201 
       
  1202 void CSwtDateEditor::UpdateTextColor()
       
  1203 {
       
  1204     if (iEditor)
       
  1205     {
       
  1206         if (HasHighlight())
       
  1207         {
       
  1208             // Highlighted foreground color, overrides all others.
       
  1209             iEditor->SetUseOverrideColors(EFalse);
       
  1210             TRAP_IGNORE(iEditor->SetSkinTextColorL(KHighlightedTextColor));
       
  1211         }
       
  1212         else if (iFgColorIsCustom)
       
  1213         {
       
  1214             // Custom foreground color, overrides the default.
       
  1215             iEditor->SetUseOverrideColors(ETrue);
       
  1216             TRAP_IGNORE(iEditor->OverrideColorL(EColorControlText, iForegroundColor));
       
  1217         }
       
  1218         else
       
  1219         {
       
  1220             // Default foreground color.
       
  1221             iEditor->SetUseOverrideColors(EFalse);
       
  1222             TRAP_IGNORE(iEditor->SetSkinTextColorL(KNonHighlightedTextColor));
       
  1223         }
       
  1224     }
       
  1225 }
       
  1226 
       
  1227 TInt CSwtDateEditor::PressBackgroundPolicy() const
       
  1228 {
       
  1229     return EPressBackground;
       
  1230 }
       
  1231 
       
  1232 void CSwtDateEditor::HandleHighlightChange()
       
  1233 {
       
  1234     UpdateTextColor();
       
  1235 }
  1191 
  1236 
  1192 // ---------------------------------------------------------------------------------------------
  1237 // ---------------------------------------------------------------------------------------------
  1193 // CSwtDateEditor::HandlePointerEventL
  1238 // CSwtDateEditor::HandlePointerEventL
  1194 // ---------------------------------------------------------------------------------------------
  1239 // ---------------------------------------------------------------------------------------------
  1195 //
  1240 //
  1209         iPressed = EFalse;
  1254         iPressed = EFalse;
  1210     else if (aPointerEvent.iType == TPointerEvent::EDrag)
  1255     else if (aPointerEvent.iType == TPointerEvent::EDrag)
  1211         iPressed = hit && !isActiveSplitEditor;
  1256         iPressed = hit && !isActiveSplitEditor;
  1212 #endif
  1257 #endif
  1213 
  1258 
       
  1259     TBool forward(EFalse);
       
  1260 
  1214     if (!(aPointerEvent.iType == TPointerEvent::EButton1Up
  1261     if (!(aPointerEvent.iType == TPointerEvent::EButton1Up
  1215             && (iDisplay.RevertPointerEvent() || !hit)))
  1262             && (iDisplay.RevertPointerEvent() || !hit)))
       
  1263     {
       
  1264         forward = ETrue;
       
  1265     }
       
  1266 
       
  1267     //Selected field might changed
       
  1268     iCurrentFieldLength = 0;
       
  1269     iCurrentFieldDecimalPlacesCount = 0;
       
  1270     iLastField = iEditor->CurrentField();
       
  1271 
       
  1272 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1273     if (pressed != iPressed)
       
  1274     {
       
  1275         GetShell().UpdateHighlight(ETrue); // draw now
       
  1276     }
       
  1277 #endif
       
  1278 
       
  1279     // Forwarding this late due to splitview + pressed flicker issues.
       
  1280     if (forward)
  1216     {
  1281     {
  1217         iEditor->HandlePointerEventL(aPointerEvent);
  1282         iEditor->HandlePointerEventL(aPointerEvent);
  1218 
  1283 
  1219         //MSK label update may be needed.
  1284         //MSK label update may be needed.
  1220         if (AknLayoutUtils::MSKEnabled())
  1285         if (AknLayoutUtils::MSKEnabled())
  1226             }
  1291             }
  1227         }
  1292         }
  1228         // End MSK
  1293         // End MSK
  1229     }
  1294     }
  1230 
  1295 
  1231     //Selected field might changed
       
  1232     iCurrentFieldLength = 0;
       
  1233     iCurrentFieldDecimalPlacesCount = 0;
       
  1234     iLastField = iEditor->CurrentField();
       
  1235 
       
  1236 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1237     if (pressed != iPressed)
       
  1238         Redraw();
       
  1239 #endif
       
  1240 
       
  1241     PostMouseEventL(aPointerEvent);
  1296     PostMouseEventL(aPointerEvent);
  1242 }
  1297 }
  1243 
  1298 
  1244 // ---------------------------------------------------------------------------------------------
  1299 // ---------------------------------------------------------------------------------------------
  1245 // CSwtDateEditor::HandleControlEventL
  1300 // CSwtDateEditor::HandleControlEventL