javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtshell.cpp
changeset 23 98ccebc37403
parent 21 2a9601315dfc
child 34 71c436fe3ce0
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtshell.cpp	Mon May 03 12:27:20 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtshell.cpp	Fri May 14 15:47:24 2010 +0300
@@ -146,38 +146,38 @@
         CCoeControl::SetPointerCapture(ETrue);
     }
 #endif //RD_SCALABLE_UI_V2
-    
+
 #ifdef RD_JAVA_S60_RELEASE_9_2
     GfxTransEffect::Enable();
-    GfxTransEffect::Register(this, 
-        iParent ? KGfxOptionsMenuControlUid : KGfxInformationNoteControlUid, EFalse);
+    GfxTransEffect::Register(this,
+                             iParent ? KGfxOptionsMenuControlUid : KGfxInformationNoteControlUid, EFalse);
 
     // Window transparency cannot be enabled as it breaks the async drawing.
-    // Since transparency cannot be enabled, set the initial background 
+    // Since transparency cannot be enabled, set the initial background
     // color to something closer to the theme's background.
     if (iParent)
     {
         TRgb bgColor = iDisplay.UiUtils().GetSystemColor(ESwtColorWidgetBackground);
-        
+
         TInt r = bgColor.Green();
         r -= KSwtRoundCornerBgColorDiff;
-        if (r < 0) 
+        if (r < 0)
             r = 0;
-        
+
         TInt g = bgColor.Green();
         g -= KSwtRoundCornerBgColorDiff;
-        if (g < 0) 
+        if (g < 0)
             g = 0;
-        
+
         TInt b = bgColor.Blue();
         b -= KSwtRoundCornerBgColorDiff;
-        if (b < 0) 
+        if (b < 0)
             b = 0;
-        
+
         bgColor.SetRed(b);
         bgColor.SetGreen(b);
         bgColor.SetBlue(b);
-        
+
         OverrideColorL(EColorControlBackground, bgColor);
     }
 #endif // RD_JAVA_S60_RELEASE_9_2
@@ -304,7 +304,7 @@
 #ifdef RD_JAVA_S60_RELEASE_9_2
     GfxTransEffect::Deregister(this);
 #endif // RD_JAVA_S60_RELEASE_9_2
-    
+
     CSwtUiUtils& uiUtils = UiUtils();
     if (uiUtils.GetActiveShell() == this)
     {
@@ -362,7 +362,7 @@
 // ---------------------------------------------------------------------------
 // CSwtShell::HandlePointerEventL
 // This is the entry point for all pointer events targeted at any of the children
-// of this Shell.
+// of this Shell except for Browser's case.
 // From CCoeControl
 // ---------------------------------------------------------------------------
 //
@@ -371,19 +371,10 @@
 {
     CSwtUiUtils& utils = UiUtils();
 
-    utils.SetNaviKeyInput(EFalse);
-
-    MSwtControl* capturingControl = utils.PointerCaptureControl();
-    if (capturingControl && capturingControl != this)
-    {
-        capturingControl->HandlePointerEventL(aPointerEvent);
-        capturingControl->PostMouseEventL(aPointerEvent);
-        iDisplay.TryDetectLongTapL(aPointerEvent);
-        return;
-    }
-
     if (aPointerEvent.iType == TPointerEvent::EButton1Down)
     {
+        utils.SetNaviKeyInput(EFalse);
+
         // Ignore pointer events outside modal Shells.
         MSwtShell *activeShell = utils.GetActiveShell();
         if (!activeShell || (activeShell && activeShell != this &&
@@ -394,6 +385,20 @@
         }
     }
 
+    MSwtControl* capturingControl = utils.PointerCaptureControl();
+    if (capturingControl && capturingControl != this)
+    {
+        if (aPointerEvent.iType == TPointerEvent::EButton1Down
+                && capturingControl->IsFocusable())
+        {
+            capturingControl->SetSwtFocus(KSwtFocusByPointer);
+        }
+        capturingControl->HandlePointerEventL(aPointerEvent);
+        capturingControl->PostMouseEventL(aPointerEvent);
+        iDisplay.TryDetectLongTapL(aPointerEvent);
+        return;
+    }
+
     MSwtControl* ctrl = NULL;
 
     if (aPointerEvent.iType == TPointerEvent::EButton1Up)
@@ -435,9 +440,9 @@
     {
         TRAP_IGNORE(CreateBackgroundL());
     }
-    
+
     CSwtUiUtils& utils = UiUtils();
-    
+
 #ifdef RD_JAVA_S60_RELEASE_9_2
     TBool doEffect = (IsVisible() != aVisible) && (iDisplay.IsUiReady() || iParent);
     if (doEffect)
@@ -455,9 +460,9 @@
         GfxTransEffect::End(this);
     }
 #endif // RD_JAVA_S60_RELEASE_9_2
-    
+
     utils.ShellActivabilityChanged(*this);
-    
+
     // Done already if the Shell became active
     if (aVisible && utils.GetActiveShell() != this)
     {
@@ -919,10 +924,10 @@
 // ---------------------------------------------------------------------------
 //
 void CSwtShell::SetVisible(TBool aVisible)
-{    
+{
     // A DrawNow() is absolutely mandatory if the ui is set to be ready.
     CSwtDecorations::SetVisible(aVisible);
-    
+
     TBool paintingUrgently = !AsyncPainting();
     if (aVisible && paintingUrgently && !iDisplay.IsUiReady())
     {
@@ -2053,6 +2058,38 @@
 }
 
 // ---------------------------------------------------------------------------
+// CSwtShell::SetTaskTip
+// From MSwtShell
+// ---------------------------------------------------------------------------
+//
+void CSwtShell::SetTaskTip()
+{
+    iIsTaskTip = ETrue;
+#ifdef RD_JAVA_S60_RELEASE_9_2
+    if (iParent && CAknEnv::Static()->TransparencyEnabled())
+    {
+        Window().SetRequiredDisplayMode(EColor16MA);
+        if (Window().SetTransparencyAlphaChannel() == KErrNone)
+        {
+            Window().SetBackgroundColor(~0);
+        }
+    }
+    GfxTransEffect::Deregister(this); // already registered in ConstructL
+    GfxTransEffect::Register(this, KGfxDiscreetPopupControlUid, EFalse);
+#endif
+}
+
+// ---------------------------------------------------------------------------
+// CSwtShell::IsTaskTip
+// From MSwtShell
+// ---------------------------------------------------------------------------
+//
+TBool CSwtShell::IsTaskTip() const
+{
+    return iIsTaskTip;
+}
+
+// ---------------------------------------------------------------------------
 // CSwtShell::HandleStatusPaneSizeChange
 // From MEikStatusPaneObserver
 // ---------------------------------------------------------------------------