javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp
branchRCL_3
changeset 21 4376525cdefb
parent 19 71c436fe3ce0
child 23 e5618cc85d74
equal deleted inserted replaced
19:71c436fe3ce0 21:4376525cdefb
    46 #include <javastorageentry.h>
    46 #include <javastorageentry.h>
    47 #include <javastorage.h>
    47 #include <javastorage.h>
    48 #include <javastoragenames.h>
    48 #include <javastoragenames.h>
    49 #include <javauid.h>
    49 #include <javauid.h>
    50 #include <javasymbianoslayer.h>
    50 #include <javasymbianoslayer.h>
       
    51 #ifdef RD_JAVA_S60_RELEASE_9_2
       
    52 // Used with partial VKB
       
    53 #include <aknpriv.hrh>
       
    54 #endif // RD_JAVA_S60_RELEASE_9_2
    51 
    55 
    52 #include "javaoslayer.h"
    56 #include "javaoslayer.h"
    53 
    57 
    54 // Using constants for S60 LCDUI Plugin internal keys.
    58 // Using constants for S60 LCDUI Plugin internal keys.
    55 #include "S60LCDUIInternalCRKeys.h"
    59 #include "S60LCDUIInternalCRKeys.h"
   558             // Not a full screen mode, return so that the CBA gets the event.
   562             // Not a full screen mode, return so that the CBA gets the event.
   559             DEBUG("- CMIDCanvas::OfferKeyEventL = key was not consumed");
   563             DEBUG("- CMIDCanvas::OfferKeyEventL = key was not consumed");
   560             return EKeyWasNotConsumed;
   564             return EKeyWasNotConsumed;
   561         }
   565         }
   562 
   566 
   563         if (iDisplayable && iDisplayable->IsFullScreenMode()  &&
   567         if (iDisplayable && iDisplayable->IsFullScreenMode() &&
   564                 iDisplayable->IsCommandListenerSet() &&
   568                 iDisplayable->IsCommandListenerSet() &&
   565                 iDisplayable->CommandCount() > 0)
   569                 iDisplayable->CommandCount() > 0)
   566         {
   570         {
   567             CMIDMenuHandler* menuHandler = iDisplayable->MenuHandler();
   571             CMIDMenuHandler* menuHandler = iDisplayable->MenuHandler();
   568 
   572 
  1072     iEnv.ToLcduiObserver().RegisterControl(*this);
  1076     iEnv.ToLcduiObserver().RegisterControl(*this);
  1073 #endif // RD_JAVA_NGA_ENABLED
  1077 #endif // RD_JAVA_NGA_ENABLED
  1074 
  1078 
  1075 #ifdef RD_JAVA_NGA_ENABLED
  1079 #ifdef RD_JAVA_NGA_ENABLED
  1076     if (iFirstPaintState != EFirstPaintOccurred &&
  1080     if (iFirstPaintState != EFirstPaintOccurred &&
  1077         iDirectContents.Count() == 1)
  1081             iDirectContents.Count() == 1)
  1078     {
  1082     {
  1079         // The first canvas paint using NGA might be interrupted
  1083         // The first canvas paint using NGA might be interrupted
  1080         // by addition of the direct content.
  1084         // by addition of the direct content.
  1081         // Invoking repaint event to restore the first paint.
  1085         // Invoking repaint event to restore the first paint.
  1082         TInt posPacked  = (iViewRect.iTl.iX << 16) | (iViewRect.iTl.iY);
  1086         TInt posPacked  = (iViewRect.iTl.iX << 16) | (iViewRect.iTl.iY);
  1083         TSize size = iViewRect.Size();
  1087         TSize size = iViewRect.Size();
  1084         TInt sizePacked = (size.iWidth << 16) | (size.iHeight);
  1088         TInt sizePacked = (size.iWidth << 16) | (size.iHeight);
  1085         
  1089 
  1086         PostEvent(EPaint, posPacked, sizePacked);
  1090         PostEvent(EPaint, posPacked, sizePacked);
  1087     }
  1091     }
  1088 #endif // RD_JAVA_NGA_ENABLED
  1092 #endif // RD_JAVA_NGA_ENABLED
  1089 }
  1093 }
  1090 
  1094 
  1444 TBool CMIDCanvas::IsFullScreen() const
  1448 TBool CMIDCanvas::IsFullScreen() const
  1445 {
  1449 {
  1446     return iFullScreen;
  1450     return iFullScreen;
  1447 }
  1451 }
  1448 
  1452 
       
  1453 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  1454 // ---------------------------------------------------------------------------
       
  1455 // CMIDCanvas::GetDisplayable
       
  1456 // (other items are commented in the header file)
       
  1457 // ---------------------------------------------------------------------------
       
  1458 //
       
  1459 CMIDDisplayable* CMIDCanvas::GetDisplayable() const
       
  1460 {
       
  1461     return iDisplayable;
       
  1462 }
       
  1463 #endif // RD_JAVA_S60_RELEASE_9_2
  1449 // ---------------------------------------------------------------------------
  1464 // ---------------------------------------------------------------------------
  1450 // CMIDCanvas::SetComponentIndexL
  1465 // CMIDCanvas::SetComponentIndexL
  1451 // Changes the index of the specified custom component.
  1466 // Changes the index of the specified custom component.
  1452 // (other items are commented in the header file)
  1467 // (other items are commented in the header file)
  1453 // ---------------------------------------------------------------------------
  1468 // ---------------------------------------------------------------------------
  1576             DrawNow(aRect);
  1591             DrawNow(aRect);
  1577         }
  1592         }
  1578 #ifdef RD_JAVA_NGA_ENABLED
  1593 #ifdef RD_JAVA_NGA_ENABLED
  1579         iCoeEnv->WsSession().Finish();
  1594         iCoeEnv->WsSession().Finish();
  1580 #endif
  1595 #endif
  1581         
  1596 
  1582         if (iFirstPaintState == EFirstPaintInitiated ||
  1597         if (iFirstPaintState == EFirstPaintInitiated ||
  1583             iFirstPaintState == EFirstPaintPrepared)
  1598                 iFirstPaintState == EFirstPaintPrepared)
  1584         {
  1599         {
  1585             // NGA is not used, StartScreen can be informed now
  1600             // NGA is not used, StartScreen can be informed now
  1586             if (iForeground)
  1601             if (iForeground)
  1587             {
  1602             {
  1588                 // The canvas is current, therefore we can flush
  1603                 // The canvas is current, therefore we can flush
  2079 // Resource change handling.
  2094 // Resource change handling.
  2080 // ---------------------------------------------------------------------------
  2095 // ---------------------------------------------------------------------------
  2081 //
  2096 //
  2082 void CMIDCanvas::HandleResourceChange(TInt aType)
  2097 void CMIDCanvas::HandleResourceChange(TInt aType)
  2083 {
  2098 {
       
  2099 #ifdef RD_JAVA_S60_RELEASE_9_2
       
  2100     if ((aType == KEikInputLanguageChange) |
       
  2101             (aType == KAknSplitInputEnabled) |
       
  2102             (aType == KAknSplitInputDisabled))
       
  2103 #else
  2084     if (aType == KEikInputLanguageChange)
  2104     if (aType == KEikInputLanguageChange)
       
  2105 #endif // RD_JAVA_S60_RELEASE_9_2
  2085     {
  2106     {
  2086         if ((iFocusedComponent != KComponentFocusedNone) &&
  2107         if ((iFocusedComponent != KComponentFocusedNone) &&
  2087                 (iFocusedComponent < iCustomComponents.Count()))
  2108         (iFocusedComponent < iCustomComponents.Count()))
  2088         {
  2109         {
  2089             iCustomComponents[iFocusedComponent]->
  2110             iCustomComponents[iFocusedComponent]->
  2090             CustomComponentControl(KComponentMainControl)->
  2111             CustomComponentControl(KComponentMainControl)->
  2091             HandleResourceChange(aType);
  2112             HandleResourceChange(aType);
  2092         }
  2113         }
  2265             //
  2286             //
  2266             // iViewRect.iTl                -> (0, 0)
  2287             // iViewRect.iTl                -> (0, 0)
  2267             // iViewRect.iBr - TSize(1, 1)  -> (iContentSize.iWidth - 1,
  2288             // iViewRect.iBr - TSize(1, 1)  -> (iContentSize.iWidth - 1,
  2268             //                                  iContentSize.iHeight - 1)
  2289             //                                  iContentSize.iHeight - 1)
  2269             point -= iViewRect.iTl;
  2290             point -= iViewRect.iTl;
       
  2291             
       
  2292 #ifdef RD_JAVA_NGA_ENABLED
       
  2293             if (iFullScreen && iScalingOn)
       
  2294             {
       
  2295                 // Fix coordinates
       
  2296                 point += iPositionRelativeToScreen;
       
  2297             }
       
  2298 #endif // RD_JAVA_NGA_ENABLED
  2270 
  2299 
  2271             if (javaMaxCoords != nativeMaxCoords)
  2300             if (javaMaxCoords != nativeMaxCoords)
  2272             {
  2301             {
  2273                 point.iX = (point.iX * javaMaxCoords.iWidth) /
  2302                 point.iX = (point.iX * javaMaxCoords.iWidth) /
  2274                            nativeMaxCoords.iWidth;
  2303                            nativeMaxCoords.iWidth;
  3400 // Check if the network indicator should be shown in Canvas.
  3429 // Check if the network indicator should be shown in Canvas.
  3401 // ---------------------------------------------------------------------------
  3430 // ---------------------------------------------------------------------------
  3402 //
  3431 //
  3403 TBool CMIDCanvas::IsNetworkIndicatorEnabledL() const
  3432 TBool CMIDCanvas::IsNetworkIndicatorEnabledL() const
  3404 {
  3433 {
       
  3434 #ifndef RD_JAVA_S60_RELEASE_9_2
  3405     if (RProcess().SecureId().iId != 0x102033E6)
  3435     if (RProcess().SecureId().iId != 0x102033E6)
  3406     {
  3436     {
  3407         // For standalone type apps we don't show indicator.
  3437         // For standalone type apps we don't show indicator.
  3408         return EFalse;
  3438         return EFalse;
  3409     }
  3439     }
  3459         delete repository;
  3489         delete repository;
  3460         repository = NULL;
  3490         repository = NULL;
  3461     }
  3491     }
  3462 
  3492 
  3463     return enabled;
  3493     return enabled;
       
  3494 #else
       
  3495 // Network and Call indicator is disabled for 9_2
       
  3496     return EFalse;
       
  3497 #endif //RD_JAVA_S60_RELEASE_9_2
  3464 }
  3498 }
  3465 
  3499 
  3466 // ---------------------------------------------------------------------------
  3500 // ---------------------------------------------------------------------------
  3467 // CMIDCanvas::HandleForeground
  3501 // CMIDCanvas::HandleForeground
  3468 // Relases resources in graphics HW (=pixel source or EGL resources)
  3502 // Relases resources in graphics HW (=pixel source or EGL resources)