javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtdateeditor.cpp
branchRCL_3
changeset 19 71c436fe3ce0
parent 18 9ac0a0a7da70
child 21 4376525cdefb
equal deleted inserted replaced
18:9ac0a0a7da70 19:71c436fe3ce0
    15 #include <AknsControlContext.h>
    15 #include <AknsControlContext.h>
    16 #include <AknsDrawUtils.h>
    16 #include <AknsDrawUtils.h>
    17 #include <avkon.rsg>
    17 #include <avkon.rsg>
    18 #include <AknUtils.h>
    18 #include <AknUtils.h>
    19 #include <AknDef.h>
    19 #include <AknDef.h>
       
    20 #ifdef RD_JAVA_S60_RELEASE_9_2
       
    21 #include <AknPriv.hrh>
       
    22 #endif
    20 #include <swtlaffacade.h>
    23 #include <swtlaffacade.h>
    21 #if defined( RD_SCALABLE_UI_V2 )
    24 #if defined( RD_SCALABLE_UI_V2 )
    22 #include <swtbuttonproxy.h>
    25 #include <swtbuttonproxy.h>
    23 #include <aknconsts.h>
    26 #include <aknconsts.h>
    24 #include <avkon.mbg>
    27 #include <avkon.mbg>
   200 // ---------------------------------------------------------------------------------------------
   203 // ---------------------------------------------------------------------------------------------
   201 // CSwtDateEditor::FocusChanged
   204 // CSwtDateEditor::FocusChanged
   202 // ---------------------------------------------------------------------------------------------
   205 // ---------------------------------------------------------------------------------------------
   203 //
   206 //
   204 void CSwtDateEditor::FocusChanged(TDrawNow aDrawNow)
   207 void CSwtDateEditor::FocusChanged(TDrawNow aDrawNow)
   205 {    
   208 {
   206     if (iEditor)
   209     if (iEditor)
   207     {
   210     {
   208         TRAP_IGNORE(PrepareForFocusChangeL());
   211         TRAP_IGNORE(PrepareForFocusChangeL());
   209         
       
   210         // Aparenlty this is the only way of forcing the VKB to close.
       
   211         if (iEditor->IsFocused() && !IsFocused())
       
   212         {
       
   213             iDisplay.CoeEnv()->Fep()->HandleDestructionOfFocusedItem();
       
   214         }
       
   215         
       
   216         iEditor->SetFocus(IsFocused());
   212         iEditor->SetFocus(IsFocused());
   217     }
   213     }
   218 
   214 
   219     HandleFocusChanged(aDrawNow);
   215     HandleFocusChanged(aDrawNow);
   220 }
   216 }
   223 // CSwtDateEditor::MakeVisible
   219 // CSwtDateEditor::MakeVisible
   224 // ---------------------------------------------------------------------------------------------
   220 // ---------------------------------------------------------------------------------------------
   225 //
   221 //
   226 void CSwtDateEditor::MakeVisible(TBool aVisible)
   222 void CSwtDateEditor::MakeVisible(TBool aVisible)
   227 {
   223 {
       
   224     // Close VKB. Do it here instead of FocusChange to avoid split input flicker.
       
   225     if (iEditor->IsFocused() && !aVisible)
       
   226     {
       
   227         CCoeFep* fep = iDisplay.CoeEnv()->Fep();
       
   228         if (fep)
       
   229         {
       
   230             fep->HandleDestructionOfFocusedItem();
       
   231         }
       
   232     }
   228     CCoeControl::MakeVisible(aVisible);
   233     CCoeControl::MakeVisible(aVisible);
   229     FocusabilityChanged();
   234     FocusabilityChanged();
   230 }
   235 }
   231 
   236 
   232 // ---------------------------------------------------------------------------------------------
   237 // ---------------------------------------------------------------------------------------------
   532 // ---------------------------------------------------------------------------------------------
   537 // ---------------------------------------------------------------------------------------------
   533 //
   538 //
   534 void CSwtDateEditor::SetDimmed(TBool aDimmed)
   539 void CSwtDateEditor::SetDimmed(TBool aDimmed)
   535 {
   540 {
   536     ASSERT(iEditor);
   541     ASSERT(iEditor);
       
   542 
       
   543     // Close VKB. Do it here instead of FocusChange to avoid split input flicker.
       
   544     if (iEditor->IsFocused() && aDimmed)
       
   545     {
       
   546         CCoeFep* fep = iDisplay.CoeEnv()->Fep();
       
   547         if (fep)
       
   548         {
       
   549             fep->HandleDestructionOfFocusedItem();
       
   550         }
       
   551     }
       
   552 
   537     CCoeControl::SetDimmed(aDimmed);
   553     CCoeControl::SetDimmed(aDimmed);
   538     iEditor->SetDimmed(aDimmed);
   554     iEditor->SetDimmed(aDimmed);
   539 
       
   540     FocusabilityChanged();
   555     FocusabilityChanged();
   541 }
   556 }
   542 
   557 
   543 // ---------------------------------------------------------------------------------------------
   558 // ---------------------------------------------------------------------------------------------
   544 // CSwtDateEditor::HandleResourceChange
   559 // CSwtDateEditor::HandleResourceChange
   568         {
   583         {
   569             ProcessFontUpdate();
   584             ProcessFontUpdate();
   570         }
   585         }
   571         SizeChanged();
   586         SizeChanged();
   572     }
   587     }
       
   588 #ifdef RD_JAVA_S60_RELEASE_9_2
       
   589     else if (aType == KAknSplitInputEnabled)
       
   590     {
       
   591         const MSwtShell* activeShell = iDisplay.UiUtils().GetActiveShell();
       
   592         if (activeShell && activeShell->FocusControl() == this)
       
   593         {
       
   594             iDisplay.UiUtils().SetSplitInputEditor(this);
       
   595         }
       
   596     }
       
   597 #endif
   573 }
   598 }
   574 
   599 
   575 // ---------------------------------------------------------------------------------------------
   600 // ---------------------------------------------------------------------------------------------
   576 // CSwtDateEditor::SizeChanged
   601 // CSwtDateEditor::SizeChanged
   577 // ---------------------------------------------------------------------------------------------
   602 // ---------------------------------------------------------------------------------------------
   659 // ---------------------------------------------------------------------------------------------
   684 // ---------------------------------------------------------------------------------------------
   660 //
   685 //
   661 void CSwtDateEditor::PositionChanged()
   686 void CSwtDateEditor::PositionChanged()
   662 {
   687 {
   663     HandlePositionChanged();
   688     HandlePositionChanged();
       
   689     // Notify change to UiUtils if this is an editor open for split view editing.
       
   690     MSwtUiUtils& utils = iDisplay.UiUtils();
       
   691     if (utils.SplitInputView() == this)
       
   692     {
       
   693         utils.AdjustSplitInputShellPos();
       
   694     }
   664 }
   695 }
   665 
   696 
   666 // ---------------------------------------------------------------------------------------------
   697 // ---------------------------------------------------------------------------------------------
   667 // CSwtDateEditor::MopSupplyObject
   698 // CSwtDateEditor::MopSupplyObject
   668 // ---------------------------------------------------------------------------------------------
   699 // ---------------------------------------------------------------------------------------------
   981         iEditor->MakeVisible(IsVisible());
  1012         iEditor->MakeVisible(IsVisible());
   982         iEditor->SetFocus(IsFocused());
  1013         iEditor->SetFocus(IsFocused());
   983         iEditor->SetDimmed(IsDimmed());
  1014         iEditor->SetDimmed(IsDimmed());
   984         RetrieveDefaultFontL();
  1015         RetrieveDefaultFontL();
   985         iEditor->SetSkinTextColorL(EAknsCIQsnTextColorsCG6);
  1016         iEditor->SetSkinTextColorL(EAknsCIQsnTextColorsCG6);
       
  1017 
       
  1018 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1019         if (iEditor->SupportsFeature(CEikMfne::EPartialScreenInput))
       
  1020         {
       
  1021             iEditor->SetFeature(CEikMfne::EPartialScreenInput, ETrue);
       
  1022         }
       
  1023 #endif
   986     }
  1024     }
   987     ActivateL();
  1025     ActivateL();
   988 }
  1026 }
   989 
  1027 
   990 // ---------------------------------------------------------------------------------------------
  1028 // ---------------------------------------------------------------------------------------------
  1104         return ETrue;
  1142         return ETrue;
  1105     }
  1143     }
  1106     return EFalse;
  1144     return EFalse;
  1107 }
  1145 }
  1108 
  1146 
       
  1147 
       
  1148 void CSwtDateEditor::SetBounds(const TRect& aRect)
       
  1149 {
       
  1150     // Divert the job to UiUtils if this is an editor open for split view editing.
       
  1151     MSwtUiUtils& utils = iDisplay.UiUtils();
       
  1152     if (utils.SplitInputView() == this)
       
  1153     {
       
  1154         utils.SetSplitInputViewSize(aRect.Size());
       
  1155         SetLocation(aRect.iTl);
       
  1156     }
       
  1157     else
       
  1158     {
       
  1159         ASwtControlBase::SetBounds(aRect);
       
  1160     }
       
  1161 }
       
  1162 
       
  1163 void CSwtDateEditor::SetWidgetSize(const TSize& aSize)
       
  1164 {
       
  1165     // Divert the job to UiUtils if this is an editor open for split view editing.
       
  1166     MSwtUiUtils& utils = iDisplay.UiUtils();
       
  1167     if (utils.SplitInputView() == this)
       
  1168     {
       
  1169         utils.SetSplitInputViewSize(aSize);
       
  1170     }
       
  1171     else
       
  1172     {
       
  1173         ASwtControlBase::SetWidgetSize(aSize);
       
  1174     }
       
  1175 }
       
  1176 
       
  1177 TSwtPeer CSwtDateEditor::Dispose()
       
  1178 {
       
  1179     // Close VKB.
       
  1180     if (iEditor->IsFocused())
       
  1181     {
       
  1182         CCoeFep* fep = iDisplay.CoeEnv()->Fep();
       
  1183         if (fep)
       
  1184         {
       
  1185             fep->HandleDestructionOfFocusedItem();
       
  1186         }
       
  1187     }
       
  1188     return ASwtControlBase::Dispose();
       
  1189 }
       
  1190 
       
  1191 
  1109 // ---------------------------------------------------------------------------------------------
  1192 // ---------------------------------------------------------------------------------------------
  1110 // CSwtDateEditor::HandlePointerEventL
  1193 // CSwtDateEditor::HandlePointerEventL
  1111 // ---------------------------------------------------------------------------------------------
  1194 // ---------------------------------------------------------------------------------------------
  1112 //
  1195 //
  1113 #if defined( RD_SCALABLE_UI_V2 )
  1196 #if defined( RD_SCALABLE_UI_V2 )
  1114 void CSwtDateEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent)
  1197 void CSwtDateEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent)
  1115 {
  1198 {
  1116     TBool hit = ETrue;
  1199     TBool hit = ETrue;
  1117 
  1200 
  1118 #ifdef RD_JAVA_S60_RELEASE_9_2
  1201 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1202     TBool isActiveSplitEditor = iDisplay.UiUtils().SplitInputEditor() == this;
  1119     TBool pressed = iPressed;
  1203     TBool pressed = iPressed;
  1120     hit = Rect().Contains(aPointerEvent.iPosition);
  1204     hit = Rect().Contains(aPointerEvent.iPosition);
  1121 
  1205 
  1122     if (aPointerEvent.iType == TPointerEvent::EButton1Down)
  1206     if (aPointerEvent.iType == TPointerEvent::EButton1Down)
  1123         iPressed = ETrue;
  1207         iPressed = !isActiveSplitEditor;
  1124     else if (aPointerEvent.iType == TPointerEvent::EButton1Up)
  1208     else if (aPointerEvent.iType == TPointerEvent::EButton1Up)
  1125         iPressed = EFalse;
  1209         iPressed = EFalse;
  1126     else if (aPointerEvent.iType == TPointerEvent::EDrag)
  1210     else if (aPointerEvent.iType == TPointerEvent::EDrag)
  1127         iPressed = hit;
  1211         iPressed = hit && !isActiveSplitEditor;
  1128 #endif
  1212 #endif
  1129 
  1213 
  1130     if (!(aPointerEvent.iType == TPointerEvent::EButton1Up
  1214     if (!(aPointerEvent.iType == TPointerEvent::EButton1Up
  1131             && (iDisplay.RevertPointerEvent() || !hit)))
  1215             && (iDisplay.RevertPointerEvent() || !hit)))
  1132     {
  1216     {
  1151 
  1235 
  1152 #ifdef RD_JAVA_S60_RELEASE_9_2
  1236 #ifdef RD_JAVA_S60_RELEASE_9_2
  1153     if (pressed != iPressed)
  1237     if (pressed != iPressed)
  1154         Redraw();
  1238         Redraw();
  1155 #endif
  1239 #endif
       
  1240 
       
  1241     PostMouseEventL(aPointerEvent);
  1156 }
  1242 }
  1157 
  1243 
  1158 // ---------------------------------------------------------------------------------------------
  1244 // ---------------------------------------------------------------------------------------------
  1159 // CSwtDateEditor::HandleControlEventL
  1245 // CSwtDateEditor::HandleControlEventL
  1160 // ---------------------------------------------------------------------------------------------
  1246 // ---------------------------------------------------------------------------------------------