javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtuiutils.cpp
branchRCL_3
changeset 60 6c158198356e
parent 34 71c436fe3ce0
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    22 #include <AknsUtils.h>
    22 #include <AknsUtils.h>
    23 #include <eswtcore.rsg>
    23 #include <eswtcore.rsg>
    24 #include <AknUtils.h>
    24 #include <AknUtils.h>
    25 #include <AknsDrawUtils.h>
    25 #include <AknsDrawUtils.h>
    26 #include <AknTextDecorationMetrics.h>
    26 #include <AknTextDecorationMetrics.h>
       
    27 #include <layoutmetadata.cdl.h>
    27 #ifdef RD_JAVA_S60_RELEASE_9_2
    28 #ifdef RD_JAVA_S60_RELEASE_9_2
    28 #include <AknPriv.hrh>
    29 #include <AknPriv.hrh>
    29 #include <aknappui.h>
    30 #include <aknappui.h>
    30 #endif
    31 #endif
    31 #include <coreuiavkoneswt.h>
    32 #include <coreuiavkoneswt.h>
   494         , iCurrentBrowserCount(0)
   495         , iCurrentBrowserCount(0)
   495         , iBrowserGarbage(NULL)
   496         , iBrowserGarbage(NULL)
   496         , iBrowserShellGarbage(NULL)
   497         , iBrowserShellGarbage(NULL)
   497         , iShellGarbageCollectionRequested(EFalse)
   498         , iShellGarbageCollectionRequested(EFalse)
   498         , iScrollBarBreadth(-1)
   499         , iScrollBarBreadth(-1)
       
   500         , iFixScreenOrientationApplicantsCount(0)
   499 {
   501 {
   500 }
   502 }
   501 
   503 
   502 // ---------------------------------------------------------------------------
   504 // ---------------------------------------------------------------------------
   503 // CSwtUiUtils::ConstructL
   505 // CSwtUiUtils::ConstructL
   811 //
   813 //
   812 void CSwtUiUtils::MoveToEndOfQueue(MSwtShell& aShell)
   814 void CSwtUiUtils::MoveToEndOfQueue(MSwtShell& aShell)
   813 {
   815 {
   814     TInt index = iShells.Find(&aShell);
   816     TInt index = iShells.Find(&aShell);
   815     ASSERT(index != KErrNotFound);
   817     ASSERT(index != KErrNotFound);
   816     iShells.Remove(index);
   818     TInt err = iShells.Append(&aShell);
   817     iShells.Append(&aShell);
   819     if (err == KErrNone)
       
   820     {
       
   821         iShells.Remove(index);
       
   822     }
   818 }
   823 }
   819 
   824 
   820 // ---------------------------------------------------------------------------
   825 // ---------------------------------------------------------------------------
   821 // CSwtUiUtils::InlineReferenceFont
   826 // CSwtUiUtils::InlineReferenceFont
   822 // ---------------------------------------------------------------------------
   827 // ---------------------------------------------------------------------------
   958                                   EAknsCIQsnOtherColorsCG11);
   963                                   EAknsCIQsnOtherColorsCG11);
   959         break;
   964         break;
   960     case ESwtColorWidgetForeground:
   965     case ESwtColorWidgetForeground:
   961     case ESwtColorListForeground:
   966     case ESwtColorListForeground:
   962         AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors,
   967         AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors,
   963                                   EAknsCIQsnTextColorsCG6);
   968                                   KNonHighlightedTextColor);
   964         break;
   969         break;
   965     case ESwtColorListSelectionText:
   970     case ESwtColorListSelectionText:
   966         AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors,
   971         AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors,
   967                                   EAknsCIQsnTextColorsCG10);
   972                                   EAknsCIQsnTextColorsCG10);
   968         break;
   973         break;
  1565     TSize maxImageSize(0, 0);
  1570     TSize maxImageSize(0, 0);
  1566     switch (aImageType)
  1571     switch (aImageType)
  1567     {
  1572     {
  1568     case ESwtListImage:
  1573     case ESwtListImage:
  1569         maxImageSize = CSwtLafFacade::GetLayoutRect(
  1574         maxImageSize = CSwtLafFacade::GetLayoutRect(
  1570                            CSwtLafFacade::EListSingleLargeGraphicPaneG1, TRect(), 0).Rect().Size();
  1575                            CSwtLafFacade::EListDoubleLargeGraphicPaneG1, TRect(), 0).Rect().Size();
  1571         break;
  1576         break;
  1572     case ESwtChoiceImage:
  1577     case ESwtChoiceImage:
  1573         maxImageSize = CSwtLafFacade::GetLayoutRect(
  1578         maxImageSize = CSwtLafFacade::GetLayoutRect(
  1574                            CSwtLafFacade::EListSingle2GraphicPaneG1Cp4, TRect()).Rect().Size();
  1579                            CSwtLafFacade::EListSingle2GraphicPaneG1Cp4, TRect()).Rect().Size();
  1575         break;
  1580         break;
  1576     case ESwtAlertImage:
  1581     case ESwtAlertImage:
  1577         maxImageSize = CSwtLafFacade::GetLayoutRect(
  1582         maxImageSize = CSwtLafFacade::GetLayoutRect(
  1578                            CSwtLafFacade::EPopupMidpNoteAlarmWindowG1, TRect(), 0).Rect().Size();
  1583                            CSwtLafFacade::EPopupMidpNoteAlarmWindowG1, TRect(), 0).Rect().Size();
  1579         break;
  1584         break;
  1580     default:
  1585     default:
       
  1586 
  1581         break;
  1587         break;
  1582     }
  1588     }
  1583     return maxImageSize;
  1589     return maxImageSize;
  1584 }
  1590 }
  1585 
  1591 
  1669     iNaviKeyInput = aStatus;
  1675     iNaviKeyInput = aStatus;
  1670     if (prevNaviKeyInput != iNaviKeyInput)
  1676     if (prevNaviKeyInput != iNaviKeyInput)
  1671     {
  1677     {
  1672         if (iActiveShell)
  1678         if (iActiveShell)
  1673         {
  1679         {
  1674             MSwtControl* ctrl = iActiveShell->FocusControl();
  1680             iActiveShell->UpdateHighlight();
  1675             if (ctrl)
       
  1676                 ctrl->Redraw();
       
  1677         }
  1681         }
  1678     }
  1682     }
  1679 }
  1683 }
  1680 
  1684 
  1681 // ---------------------------------------------------------------------------
  1685 // ---------------------------------------------------------------------------
  2090 TBool CSwtUiUtils::CanBeFaded(MSwtShell* aShell) const
  2094 TBool CSwtUiUtils::CanBeFaded(MSwtShell* aShell) const
  2091 {
  2095 {
  2092     return (aShell && aShell->GetParentShell() && IsApplicationModal(*aShell));
  2096     return (aShell && aShell->GetParentShell() && IsApplicationModal(*aShell));
  2093 }
  2097 }
  2094 
  2098 
       
  2099 // ---------------------------------------------------------------------------
       
  2100 // CSwtUiUtils::RegisterFixScreenOrientation
       
  2101 // ---------------------------------------------------------------------------
       
  2102 //
       
  2103 void CSwtUiUtils::RegisterFixScreenOrientation()
       
  2104 {
       
  2105     iFixScreenOrientationApplicantsCount++;
       
  2106 
       
  2107     // Store the old setting for the first applicant only
       
  2108     if (iFixScreenOrientationApplicantsCount == 1)
       
  2109     {
       
  2110         iOldUiOrientation = iAvkonAppUi->Orientation();
       
  2111         iRestoreOrientation =
       
  2112             (iOldUiOrientation == CAknAppUiBase::EAppUiOrientationUnspecified);
       
  2113 
       
  2114         // Fix the orientation when was set to unspecified only
       
  2115         if (iRestoreOrientation)
       
  2116         {
       
  2117             TRAP_IGNORE(iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape));
       
  2118         }
       
  2119     }
       
  2120 }
       
  2121 
       
  2122 void CSwtUiUtils::UnRegisterFixScreenOrientation()
       
  2123 {
       
  2124     if (iFixScreenOrientationApplicantsCount > 0)
       
  2125     {
       
  2126         iFixScreenOrientationApplicantsCount--;
       
  2127 
       
  2128         if (iFixScreenOrientationApplicantsCount == 0 && iRestoreOrientation)
       
  2129         {
       
  2130             TRAP_IGNORE(iAvkonAppUi->SetOrientationL(iOldUiOrientation));
       
  2131             iRestoreOrientation = EFalse;
       
  2132         }
       
  2133     }
       
  2134 }
       
  2135 
       
  2136 TBool CSwtUiUtils::IsScreenOrientationFixed() const
       
  2137 {
       
  2138     return iFixScreenOrientationApplicantsCount > 0;
       
  2139 }
       
  2140