javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtshell.cpp
changeset 23 98ccebc37403
parent 21 2a9601315dfc
child 34 71c436fe3ce0
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
   144     {
   144     {
   145         CCoeControl::SetGloballyCapturing(ETrue);
   145         CCoeControl::SetGloballyCapturing(ETrue);
   146         CCoeControl::SetPointerCapture(ETrue);
   146         CCoeControl::SetPointerCapture(ETrue);
   147     }
   147     }
   148 #endif //RD_SCALABLE_UI_V2
   148 #endif //RD_SCALABLE_UI_V2
   149     
   149 
   150 #ifdef RD_JAVA_S60_RELEASE_9_2
   150 #ifdef RD_JAVA_S60_RELEASE_9_2
   151     GfxTransEffect::Enable();
   151     GfxTransEffect::Enable();
   152     GfxTransEffect::Register(this, 
   152     GfxTransEffect::Register(this,
   153         iParent ? KGfxOptionsMenuControlUid : KGfxInformationNoteControlUid, EFalse);
   153                              iParent ? KGfxOptionsMenuControlUid : KGfxInformationNoteControlUid, EFalse);
   154 
   154 
   155     // Window transparency cannot be enabled as it breaks the async drawing.
   155     // Window transparency cannot be enabled as it breaks the async drawing.
   156     // Since transparency cannot be enabled, set the initial background 
   156     // Since transparency cannot be enabled, set the initial background
   157     // color to something closer to the theme's background.
   157     // color to something closer to the theme's background.
   158     if (iParent)
   158     if (iParent)
   159     {
   159     {
   160         TRgb bgColor = iDisplay.UiUtils().GetSystemColor(ESwtColorWidgetBackground);
   160         TRgb bgColor = iDisplay.UiUtils().GetSystemColor(ESwtColorWidgetBackground);
   161         
   161 
   162         TInt r = bgColor.Green();
   162         TInt r = bgColor.Green();
   163         r -= KSwtRoundCornerBgColorDiff;
   163         r -= KSwtRoundCornerBgColorDiff;
   164         if (r < 0) 
   164         if (r < 0)
   165             r = 0;
   165             r = 0;
   166         
   166 
   167         TInt g = bgColor.Green();
   167         TInt g = bgColor.Green();
   168         g -= KSwtRoundCornerBgColorDiff;
   168         g -= KSwtRoundCornerBgColorDiff;
   169         if (g < 0) 
   169         if (g < 0)
   170             g = 0;
   170             g = 0;
   171         
   171 
   172         TInt b = bgColor.Blue();
   172         TInt b = bgColor.Blue();
   173         b -= KSwtRoundCornerBgColorDiff;
   173         b -= KSwtRoundCornerBgColorDiff;
   174         if (b < 0) 
   174         if (b < 0)
   175             b = 0;
   175             b = 0;
   176         
   176 
   177         bgColor.SetRed(b);
   177         bgColor.SetRed(b);
   178         bgColor.SetGreen(b);
   178         bgColor.SetGreen(b);
   179         bgColor.SetBlue(b);
   179         bgColor.SetBlue(b);
   180         
   180 
   181         OverrideColorL(EColorControlBackground, bgColor);
   181         OverrideColorL(EColorControlBackground, bgColor);
   182     }
   182     }
   183 #endif // RD_JAVA_S60_RELEASE_9_2
   183 #endif // RD_JAVA_S60_RELEASE_9_2
   184 }
   184 }
   185 
   185 
   302 void CSwtShell::DoDelete()
   302 void CSwtShell::DoDelete()
   303 {
   303 {
   304 #ifdef RD_JAVA_S60_RELEASE_9_2
   304 #ifdef RD_JAVA_S60_RELEASE_9_2
   305     GfxTransEffect::Deregister(this);
   305     GfxTransEffect::Deregister(this);
   306 #endif // RD_JAVA_S60_RELEASE_9_2
   306 #endif // RD_JAVA_S60_RELEASE_9_2
   307     
   307 
   308     CSwtUiUtils& uiUtils = UiUtils();
   308     CSwtUiUtils& uiUtils = UiUtils();
   309     if (uiUtils.GetActiveShell() == this)
   309     if (uiUtils.GetActiveShell() == this)
   310     {
   310     {
   311         iDisplay.MenuArranger().ActiveShellLost();
   311         iDisplay.MenuArranger().ActiveShellLost();
   312         // Notify Command arranger
   312         // Notify Command arranger
   360 }
   360 }
   361 
   361 
   362 // ---------------------------------------------------------------------------
   362 // ---------------------------------------------------------------------------
   363 // CSwtShell::HandlePointerEventL
   363 // CSwtShell::HandlePointerEventL
   364 // This is the entry point for all pointer events targeted at any of the children
   364 // This is the entry point for all pointer events targeted at any of the children
   365 // of this Shell.
   365 // of this Shell except for Browser's case.
   366 // From CCoeControl
   366 // From CCoeControl
   367 // ---------------------------------------------------------------------------
   367 // ---------------------------------------------------------------------------
   368 //
   368 //
   369 #ifdef RD_SCALABLE_UI_V2
   369 #ifdef RD_SCALABLE_UI_V2
   370 void CSwtShell::HandlePointerEventL(const TPointerEvent& aPointerEvent)
   370 void CSwtShell::HandlePointerEventL(const TPointerEvent& aPointerEvent)
   371 {
   371 {
   372     CSwtUiUtils& utils = UiUtils();
   372     CSwtUiUtils& utils = UiUtils();
   373 
   373 
   374     utils.SetNaviKeyInput(EFalse);
       
   375 
       
   376     MSwtControl* capturingControl = utils.PointerCaptureControl();
       
   377     if (capturingControl && capturingControl != this)
       
   378     {
       
   379         capturingControl->HandlePointerEventL(aPointerEvent);
       
   380         capturingControl->PostMouseEventL(aPointerEvent);
       
   381         iDisplay.TryDetectLongTapL(aPointerEvent);
       
   382         return;
       
   383     }
       
   384 
       
   385     if (aPointerEvent.iType == TPointerEvent::EButton1Down)
   374     if (aPointerEvent.iType == TPointerEvent::EButton1Down)
   386     {
   375     {
       
   376         utils.SetNaviKeyInput(EFalse);
       
   377 
   387         // Ignore pointer events outside modal Shells.
   378         // Ignore pointer events outside modal Shells.
   388         MSwtShell *activeShell = utils.GetActiveShell();
   379         MSwtShell *activeShell = utils.GetActiveShell();
   389         if (!activeShell || (activeShell && activeShell != this &&
   380         if (!activeShell || (activeShell && activeShell != this &&
   390                              !((activeShell->Control()->Style() & KSwtStylePrimaryModal) != 0
   381                              !((activeShell->Control()->Style() & KSwtStylePrimaryModal) != 0
   391                                && activeShell->Control()->IsDescentOf(*this))))
   382                                && activeShell->Control()->IsDescentOf(*this))))
   392         {
   383         {
   393             utils.SetActiveShell(*this, ETrue);
   384             utils.SetActiveShell(*this, ETrue);
   394         }
   385         }
   395     }
   386     }
   396 
   387 
       
   388     MSwtControl* capturingControl = utils.PointerCaptureControl();
       
   389     if (capturingControl && capturingControl != this)
       
   390     {
       
   391         if (aPointerEvent.iType == TPointerEvent::EButton1Down
       
   392                 && capturingControl->IsFocusable())
       
   393         {
       
   394             capturingControl->SetSwtFocus(KSwtFocusByPointer);
       
   395         }
       
   396         capturingControl->HandlePointerEventL(aPointerEvent);
       
   397         capturingControl->PostMouseEventL(aPointerEvent);
       
   398         iDisplay.TryDetectLongTapL(aPointerEvent);
       
   399         return;
       
   400     }
       
   401 
   397     MSwtControl* ctrl = NULL;
   402     MSwtControl* ctrl = NULL;
   398 
   403 
   399     if (aPointerEvent.iType == TPointerEvent::EButton1Up)
   404     if (aPointerEvent.iType == TPointerEvent::EButton1Up)
   400         ctrl = iDisplay.UiUtils().GetPointerGrabbingControl();
   405         ctrl = iDisplay.UiUtils().GetPointerGrabbingControl();
   401 
   406 
   433 
   438 
   434     if (aVisible && !iBgContext)
   439     if (aVisible && !iBgContext)
   435     {
   440     {
   436         TRAP_IGNORE(CreateBackgroundL());
   441         TRAP_IGNORE(CreateBackgroundL());
   437     }
   442     }
   438     
   443 
   439     CSwtUiUtils& utils = UiUtils();
   444     CSwtUiUtils& utils = UiUtils();
   440     
   445 
   441 #ifdef RD_JAVA_S60_RELEASE_9_2
   446 #ifdef RD_JAVA_S60_RELEASE_9_2
   442     TBool doEffect = (IsVisible() != aVisible) && (iDisplay.IsUiReady() || iParent);
   447     TBool doEffect = (IsVisible() != aVisible) && (iDisplay.IsUiReady() || iParent);
   443     if (doEffect)
   448     if (doEffect)
   444     {
   449     {
   445         GfxTransEffect::Begin(this, aVisible ? KGfxControlAppearAction : KGfxControlDisappearAction);
   450         GfxTransEffect::Begin(this, aVisible ? KGfxControlAppearAction : KGfxControlDisappearAction);
   453     if (doEffect)
   458     if (doEffect)
   454     {
   459     {
   455         GfxTransEffect::End(this);
   460         GfxTransEffect::End(this);
   456     }
   461     }
   457 #endif // RD_JAVA_S60_RELEASE_9_2
   462 #endif // RD_JAVA_S60_RELEASE_9_2
   458     
   463 
   459     utils.ShellActivabilityChanged(*this);
   464     utils.ShellActivabilityChanged(*this);
   460     
   465 
   461     // Done already if the Shell became active
   466     // Done already if the Shell became active
   462     if (aVisible && utils.GetActiveShell() != this)
   467     if (aVisible && utils.GetActiveShell() != this)
   463     {
   468     {
   464         if (!iFullScreen && HasCba())
   469         if (!iFullScreen && HasCba())
   465         {
   470         {
   917 // CSwtShell::SetVisible
   922 // CSwtShell::SetVisible
   918 // From MSwtControl
   923 // From MSwtControl
   919 // ---------------------------------------------------------------------------
   924 // ---------------------------------------------------------------------------
   920 //
   925 //
   921 void CSwtShell::SetVisible(TBool aVisible)
   926 void CSwtShell::SetVisible(TBool aVisible)
   922 {    
   927 {
   923     // A DrawNow() is absolutely mandatory if the ui is set to be ready.
   928     // A DrawNow() is absolutely mandatory if the ui is set to be ready.
   924     CSwtDecorations::SetVisible(aVisible);
   929     CSwtDecorations::SetVisible(aVisible);
   925     
   930 
   926     TBool paintingUrgently = !AsyncPainting();
   931     TBool paintingUrgently = !AsyncPainting();
   927     if (aVisible && paintingUrgently && !iDisplay.IsUiReady())
   932     if (aVisible && paintingUrgently && !iDisplay.IsUiReady())
   928     {
   933     {
   929         iDisplay.SetUiReady(iParent == NULL);
   934         iDisplay.SetUiReady(iParent == NULL);
   930     }
   935     }
  2051 {
  2056 {
  2052     return iHasCba;
  2057     return iHasCba;
  2053 }
  2058 }
  2054 
  2059 
  2055 // ---------------------------------------------------------------------------
  2060 // ---------------------------------------------------------------------------
       
  2061 // CSwtShell::SetTaskTip
       
  2062 // From MSwtShell
       
  2063 // ---------------------------------------------------------------------------
       
  2064 //
       
  2065 void CSwtShell::SetTaskTip()
       
  2066 {
       
  2067     iIsTaskTip = ETrue;
       
  2068 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  2069     if (iParent && CAknEnv::Static()->TransparencyEnabled())
       
  2070     {
       
  2071         Window().SetRequiredDisplayMode(EColor16MA);
       
  2072         if (Window().SetTransparencyAlphaChannel() == KErrNone)
       
  2073         {
       
  2074             Window().SetBackgroundColor(~0);
       
  2075         }
       
  2076     }
       
  2077     GfxTransEffect::Deregister(this); // already registered in ConstructL
       
  2078     GfxTransEffect::Register(this, KGfxDiscreetPopupControlUid, EFalse);
       
  2079 #endif
       
  2080 }
       
  2081 
       
  2082 // ---------------------------------------------------------------------------
       
  2083 // CSwtShell::IsTaskTip
       
  2084 // From MSwtShell
       
  2085 // ---------------------------------------------------------------------------
       
  2086 //
       
  2087 TBool CSwtShell::IsTaskTip() const
       
  2088 {
       
  2089     return iIsTaskTip;
       
  2090 }
       
  2091 
       
  2092 // ---------------------------------------------------------------------------
  2056 // CSwtShell::HandleStatusPaneSizeChange
  2093 // CSwtShell::HandleStatusPaneSizeChange
  2057 // From MEikStatusPaneObserver
  2094 // From MEikStatusPaneObserver
  2058 // ---------------------------------------------------------------------------
  2095 // ---------------------------------------------------------------------------
  2059 //
  2096 //
  2060 void CSwtShell::HandleStatusPaneSizeChange()
  2097 void CSwtShell::HandleStatusPaneSizeChange()