uifw/AvKon/src/aknnavi.cpp
branchRCL_3
changeset 55 aecbbf00d063
parent 38 c52421ed5f07
child 56 d48ab3b357f1
equal deleted inserted replaced
51:fcdfafb36fe7 55:aecbbf00d063
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    55 #include "akntitle.h"
    55 #include "akntitle.h"
    56 #include "AknTitlePaneLabel.h"
    56 #include "AknTitlePaneLabel.h"
    57 #include "AknDebug.h"
    57 #include "AknDebug.h"
    58 
    58 
    59 const TInt KAknNaviPaneStackGranularity = 2;
    59 const TInt KAknNaviPaneStackGranularity = 2;
    60 
       
    61 #define Min( x , y ) ((( x ) < ( y )) ? ( x ) : ( y ))
       
    62 /**
    60 /**
    63 * Extension class for CAknNavigationControlContainer.
    61 * Extension class for CAknNavigationControlContainer.
    64 */
    62 */
    65 class CAknNavigationControlContainerExtension : public CBase
    63 class CAknNavigationControlContainerExtension : public CBase
    66     {
    64     {
    67 public:
    65 public:
    68     CAknNavigationControlContainerExtension(){};
    66     CAknNavigationControlContainerExtension(){};
    69     ~CAknNavigationControlContainerExtension(){};
    67     ~CAknNavigationControlContainerExtension(){};
    70 
    68 
    71 public:
    69 public:
       
    70     TInt                        iCurrentColorScheme;
    72     CAknNaviForegroundObserver* iForegroundObserver;
    71     CAknNaviForegroundObserver* iForegroundObserver;
    73     TBool                       iDestructionOngoing;
    72     TBool                       iDestructionOngoing;
    74     CFbsBitmap*                 iNaviColorBitmap;
    73     CFbsBitmap*                 iNaviColorBitmap;
    75     TInt                        iPreferredNaviDecoratorLayoutStyle;
    74     TInt                        iPreferredNaviDecoratorLayoutStyle;
    76     CEikStatusPaneBase*         iStatusPane;
    75     TBool                       iIsActiveIdle;
    77     };
    76     };
    78 
    77 
    79 
    78 
    80 
    79 
    81 // ----------------------------------------------------------------------------
    80 // ----------------------------------------------------------------------------
   141     {
   140     {
   142     if ( !iExtension )
   141     if ( !iExtension )
   143         {
   142         {
   144         iExtension =
   143         iExtension =
   145             new (ELeave) CAknNavigationControlContainerExtension();
   144             new (ELeave) CAknNavigationControlContainerExtension();
       
   145         iExtension->iCurrentColorScheme = ColorScheme();
   146         iExtension->iForegroundObserver =
   146         iExtension->iForegroundObserver =
   147             CAknNaviForegroundObserver::NewL( this );
   147             CAknNaviForegroundObserver::NewL( this );
   148         iExtension->iStatusPane = CEikStatusPaneBase::Current();
   148         iExtension->iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
   149         }
   149         }
   150 
   150 
   151     if ( !iNaviPaneControls )
   151     if ( !iNaviPaneControls )
   152         {
   152         {
   153         iNaviPaneControls =
   153         iNaviPaneControls =
  1394                  CAknNavigationDecorator::ENaviVolume )
  1394                  CAknNavigationDecorator::ENaviVolume )
  1395             {
  1395             {
  1396             // Volume popup's position must be set here.
  1396             // Volume popup's position must be set here.
  1397             iNaviPaneControls->At( last )->iDecoratedControl->SetRect(
  1397             iNaviPaneControls->At( last )->iDecoratedControl->SetRect(
  1398                 VolumePopupRect() );
  1398                 VolumePopupRect() );
  1399             if( last - 1 >= 0 && iNaviPaneControls->At( last - 1 ) )
  1399             if( last - 1 >= 0 )
  1400             	{
  1400             	{
  1401             		iNaviPaneControls->At( last - 1 )->SetRect( rect );
  1401             		iNaviPaneControls->At( last - 1 )->SetRect( rect );
  1402             	}
  1402             	}
  1403             }
  1403             }
  1404         else
  1404         else
  1452     else
  1452     else
  1453         {
  1453         {
  1454         CCoeControl::HandleResourceChange( aType ) ;
  1454         CCoeControl::HandleResourceChange( aType ) ;
  1455         }
  1455         }
  1456 
  1456 
  1457     if ( aType == KEikDynamicLayoutVariantSwitch ||
  1457     if ( aType == KEikColorResourceChange ||
       
  1458          aType == KEikDynamicLayoutVariantSwitch ||
  1458          aType == KAknsMessageSkinChange )
  1459          aType == KAknsMessageSkinChange )
  1459         {
  1460         {
  1460         if ( aType == KEikDynamicLayoutVariantSwitch ||
  1461         TInt colorScheme = ColorScheme();
       
  1462         if ( colorScheme != iExtension->iCurrentColorScheme ||
       
  1463              aType == KEikDynamicLayoutVariantSwitch ||
  1461              aType == KAknsMessageSkinChange )
  1464              aType == KAknsMessageSkinChange )
  1462             {
  1465             {
       
  1466             iExtension->iCurrentColorScheme = colorScheme;
       
  1467 
  1463             // updating color bitmap
  1468             // updating color bitmap
  1464             TRAP_IGNORE( LoadNaviColorBitmapL() );
  1469             TRAP_IGNORE( LoadNaviColorBitmapL() );
  1465             }
  1470             }
  1466         DrawDeferred();
  1471         DrawDeferred();
  1467         }
  1472         }
  1570 // ---------------------------------------------------------------------------
  1575 // ---------------------------------------------------------------------------
  1571 // CAknNavigationControlContainer::Draw
  1576 // CAknNavigationControlContainer::Draw
  1572 // ---------------------------------------------------------------------------
  1577 // ---------------------------------------------------------------------------
  1573 //
  1578 //
  1574 EXPORT_C void CAknNavigationControlContainer::Draw(
  1579 EXPORT_C void CAknNavigationControlContainer::Draw(
  1575     const TRect& aRect ) const
  1580     const TRect& /*aRect*/ ) const
  1576     {
  1581     {
  1577     if ( iExtension->iStatusPane && 
  1582     if ( iExtension->iIsActiveIdle )
  1578          iExtension->iStatusPane->IsTransparent() )
  1583         {
  1579         {
       
  1580         CWindowGc& gc = SystemGc();
       
  1581         TRgb rgb(TRgb::Color16MA(0));
       
  1582         gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
       
  1583         gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1584         gc.SetBrushColor(rgb);
       
  1585         gc.Clear(aRect);
       
  1586         return;
  1584         return;
  1587         }
       
  1588 
       
  1589     // Don't allow normal background drawing if
       
  1590     // background is already drawn with a background drawer.
       
  1591     TBool drawBackground( ETrue );
       
  1592     const MCoeControlBackground* backgroundDrawer = FindBackground();
       
  1593     if ( backgroundDrawer )
       
  1594         {
       
  1595         drawBackground = EFalse;
       
  1596         }
  1585         }
  1597 
  1586 
  1598     CWindowGc& gc = SystemGc();
  1587     CWindowGc& gc = SystemGc();
  1599 
  1588 
  1600     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  1589     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  1616         {
  1605         {
  1617         //
  1606         //
  1618         // - Navi wipe is never used
  1607         // - Navi wipe is never used
  1619         // - No offset in right, left or top
  1608         // - No offset in right, left or top
  1620         //
  1609         //
  1621         if ( drawBackground &&
  1610         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  1622              !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
  1623             {
  1611             {
  1624             gc.SetPenStyle( CGraphicsContext::ENullPen );
  1612             gc.SetPenStyle( CGraphicsContext::ENullPen );
  1625             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  1613             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  1626             gc.SetBrushColor(
  1614             gc.SetBrushColor(
  1627                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
  1615                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
  1643         gc.SetPenStyle( CGraphicsContext::ENullPen );
  1631         gc.SetPenStyle( CGraphicsContext::ENullPen );
  1644         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  1632         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  1645         gc.SetBrushColor(
  1633         gc.SetBrushColor(
  1646             AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
  1634             AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
  1647 
  1635 
  1648         if ( drawBackground &&
  1636         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  1649              !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
  1650             {
  1637             {
  1651             gc.DrawRect( rect );
  1638             gc.DrawRect( rect );
  1652             }
  1639             }
  1653         return;
  1640         return;
  1654         }
  1641         }
  1659         {
  1646         {
  1660         //
  1647         //
  1661         // - Navi wipe is never used
  1648         // - Navi wipe is never used
  1662         // - No offset in right, left or top
  1649         // - No offset in right, left or top
  1663         //
  1650         //
  1664         if ( drawBackground &&
  1651         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  1665              !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
  1666             {
  1652             {
  1667             gc.SetPenStyle( CGraphicsContext::ENullPen );
  1653             gc.SetPenStyle( CGraphicsContext::ENullPen );
  1668             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  1654             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  1669             gc.SetBrushColor(
  1655             gc.SetBrushColor(
  1670                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
  1656                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
  1760     //
  1746     //
  1761     // Navi pane is located in NORMAL STATUSPANE
  1747     // Navi pane is located in NORMAL STATUSPANE
  1762     //
  1748     //
  1763     else
  1749     else
  1764         {
  1750         {
  1765         if ( drawBackground )
  1751         TBool naviWipeUsed = NaviWipeUsed();
  1766             {
  1752 
  1767             TBool naviWipeUsed = NaviWipeUsed();
  1753         TBool skinnedNaviWipeDrawn  = EFalse;
  1768 
  1754         TBool skinnedNaviSolidDrawn = EFalse;
  1769             TBool skinnedNaviWipeDrawn  = EFalse;
  1755         TBool defaultNaviWipeDrawn  = EFalse;
  1770             TBool skinnedNaviSolidDrawn = EFalse;
  1756         TBool defaultNaviSolidDrawn = EFalse;
  1771             TBool defaultNaviWipeDrawn  = EFalse;
  1757 
  1772             TBool defaultNaviSolidDrawn = EFalse;
  1758         // If naviwipe is to be used, try first skinned draw...
  1773 
  1759         if ( naviWipeUsed )
  1774             // If naviwipe is to be used, try first skinned draw...
  1760             {
  1775             if ( naviWipeUsed )
  1761             skinnedNaviWipeDrawn = DrawSkinnedNaviWipe( gc, rect, skin, cc );
  1776                 {
  1762             }
  1777                 skinnedNaviWipeDrawn = DrawSkinnedNaviWipe( gc, rect, skin, cc );
  1763 
  1778                 }
  1764         // If naviwipe is to be used and skinned draw failed,
  1779 
  1765         // draw default wipe draw...
  1780             // If naviwipe is to be used and skinned draw failed,
  1766         if ( naviWipeUsed && !skinnedNaviWipeDrawn )
  1781             // draw default wipe draw...
  1767             {
  1782             if ( naviWipeUsed && !skinnedNaviWipeDrawn )
  1768             defaultNaviWipeDrawn = DrawDefaultNaviWipe( gc, rect );
  1783                 {
  1769             }
  1784                 defaultNaviWipeDrawn = DrawDefaultNaviWipe( gc, rect );
  1770 
  1785                 }
  1771         // If naviwipe is not to be drawn or the nawiwipe draws has failed for
  1786 
  1772         // some reason then draw solid. Try skinned solid draw first...
  1787             // If naviwipe is not to be drawn or the nawiwipe draws has failed for
  1773         if ( !skinnedNaviWipeDrawn && !defaultNaviWipeDrawn )
  1788             // some reason then draw solid. Try skinned solid draw first...
  1774             {
  1789             if ( !skinnedNaviWipeDrawn && !defaultNaviWipeDrawn )
  1775             skinnedNaviSolidDrawn = DrawSkinnedNaviSolid( gc, rect, skin, cc );
  1790                 {
  1776             }
  1791                 skinnedNaviSolidDrawn = DrawSkinnedNaviSolid( gc, rect, skin, cc );
  1777 
  1792                 }
  1778         // If not any above is the case, then draw the default solid here.
  1793 
  1779         if ( !skinnedNaviWipeDrawn &&
  1794             // If not any above is the case, then draw the default solid here.
  1780              !defaultNaviWipeDrawn &&
  1795             if ( !skinnedNaviWipeDrawn &&
  1781              !skinnedNaviSolidDrawn &&
  1796                  !defaultNaviWipeDrawn &&
  1782              !defaultNaviSolidDrawn )
  1797                  !skinnedNaviSolidDrawn &&
  1783             {
  1798                  !defaultNaviSolidDrawn )
  1784             defaultNaviSolidDrawn = DrawDefaultNaviSolid( gc, rect );
  1799                 {
       
  1800                 defaultNaviSolidDrawn = DrawDefaultNaviSolid( gc, rect );
       
  1801                 }
       
  1802             }
  1785             }
  1803         }
  1786         }
  1804     }
  1787     }
  1805 
  1788 
  1806 
  1789 
  1863 // CAknNavigationControlContainer::NotifyNaviWipeStatusL
  1846 // CAknNavigationControlContainer::NotifyNaviWipeStatusL
  1864 // ---------------------------------------------------------------------------
  1847 // ---------------------------------------------------------------------------
  1865 //
  1848 //
  1866 void CAknNavigationControlContainer::NotifyNaviWipeStatusL()
  1849 void CAknNavigationControlContainer::NotifyNaviWipeStatusL()
  1867     {
  1850     {
  1868     if ( !iExtension || iExtension->iDestructionOngoing )
  1851     if ( iExtension && iExtension->iDestructionOngoing )
  1869         {
  1852         {
  1870         return;
  1853         return;
  1871         }
  1854         }
  1872 
  1855 
  1873     // If flat statuspane is active, then we don't have navi wipe on/off,
  1856     // If flat statuspane is active, then we don't have navi wipe on/off,
  1924                     emptywindow = static_cast <RWindow*> ( drawableWindow );
  1907                     emptywindow = static_cast <RWindow*> ( drawableWindow );
  1925                     }
  1908                     }
  1926                 }
  1909                 }
  1927             }
  1910             }
  1928 
  1911 
  1929        TInt minOrd = -1;
       
  1930        
       
  1931        if ( titlewindow )
       
  1932            {
       
  1933            minOrd = titlewindow->OrdinalPosition();
       
  1934            }
       
  1935        
       
  1936         if( naviwindow )
       
  1937            {
       
  1938            minOrd = Min( minOrd, naviwindow->OrdinalPosition() );
       
  1939            }
       
  1940 
       
  1941        if ( emptywindow )
       
  1942            {
       
  1943            minOrd = Min( minOrd, emptywindow->OrdinalPosition() );
       
  1944            }
       
  1945 
       
  1946      
       
  1947         const TInt last = iNaviPaneControls->Count() - 1;
  1912         const TInt last = iNaviPaneControls->Count() - 1;
  1948         if ( ( last < 0 || !( iNaviPaneControls->At( last ) ) ) ||
  1913         if ( ( last < 0 || !( iNaviPaneControls->At( last ) ) ) ||
  1949              ( last >= 0 &&
  1914              ( last >= 0 &&
  1950                iNaviPaneControls->At( last ) && 
  1915                iNaviPaneControls->At( last ) && 
  1951                iNaviPaneControls->At( last )->ControlType() ==
  1916                iNaviPaneControls->At( last )->ControlType() ==
  1953             {
  1918             {
  1954             // If not controls in navi stack, send navipane behind of titlepane
  1919             // If not controls in navi stack, send navipane behind of titlepane
  1955             // Minus ordinal ordinal position number always means set
  1920             // Minus ordinal ordinal position number always means set
  1956             // the window to be the last one of the windows with the same
  1921             // the window to be the last one of the windows with the same
  1957             // ordinal priority
  1922             // ordinal priority
  1958             
  1923             if ( iExtension->iIsActiveIdle )//Added for active idle's transparent
       
  1924             	{
  1959             if ( titlewindow )
  1925             if ( titlewindow )
  1960                 {
  1926                 {
  1961                 titlewindow->SetOrdinalPosition( minOrd );
  1927                 titlewindow->SetOrdinalPosition( 4 );
  1962                 }
  1928                 }
  1963             if ( naviwindow )
  1929             if ( naviwindow )
  1964                 {
  1930                 {
  1965                 naviwindow->SetOrdinalPosition( minOrd + 1  );
  1931                 naviwindow->SetOrdinalPosition( 5 );
  1966                 }
  1932                 }
  1967             if ( emptywindow )
  1933             if ( emptywindow )
  1968                 {
  1934                 {
  1969                 emptywindow->SetOrdinalPosition( minOrd + 2 );
  1935                 emptywindow->SetOrdinalPosition( 6 );
  1970                 }
  1936                 }
  1971              
  1937               }
       
  1938            else
       
  1939              {
       
  1940              if ( titlewindow )
       
  1941                 {
       
  1942                 titlewindow->SetOrdinalPosition( -1 );
       
  1943                 }
       
  1944             if ( naviwindow )
       
  1945                 {
       
  1946                 naviwindow->SetOrdinalPosition( -1 );
       
  1947                 }
       
  1948             if ( emptywindow )
       
  1949                 {
       
  1950                 emptywindow->SetOrdinalPosition( -1 );
       
  1951                 }
       
  1952              }
  1972             }
  1953             }
  1973         else
  1954         else
  1974             {
  1955             {
  1975             // If  controls in navi stack, send titlepane behind the navipane.
  1956             // If  controls in navi stack, send titlepane behind the navipane.
  1976             // Minus ordinal ordinal position number always means set
  1957             // Minus ordinal ordinal position number always means set
  1977             // the window to be the last one of the windows with the same
  1958             // the window to be the last one of the windows with the same
  1978             // ordinal priority
  1959             // ordinal priority
  1979            
  1960             if ( iExtension->iIsActiveIdle )//Added for active idle's transparent
       
  1961             	{
  1980             if ( naviwindow )
  1962             if ( naviwindow )
  1981                 {
  1963                 {
  1982                 naviwindow->SetOrdinalPosition( minOrd );
  1964                 naviwindow->SetOrdinalPosition( 4 );
  1983                 }
  1965                 }
  1984             if ( titlewindow )
  1966             if ( titlewindow )
  1985                 {
  1967                 {
  1986                 titlewindow->SetOrdinalPosition( minOrd + 1 );
  1968                 titlewindow->SetOrdinalPosition( 5 );
  1987                 }
  1969                 }
  1988             if ( emptywindow )
  1970             if ( emptywindow )
  1989                 {
  1971                 {
  1990                 emptywindow->SetOrdinalPosition( minOrd + 2 );
  1972                 emptywindow->SetOrdinalPosition( 6 );
  1991                 }              	
  1973                 }
       
  1974               }
       
  1975               else
       
  1976               	{
       
  1977              if ( naviwindow )
       
  1978                 {
       
  1979                 naviwindow->SetOrdinalPosition( -1 );
       
  1980                 }
       
  1981             if ( titlewindow )
       
  1982                 {
       
  1983                 titlewindow->SetOrdinalPosition( -1 );
       
  1984                 }
       
  1985             if ( emptywindow )
       
  1986                 {
       
  1987                 emptywindow->SetOrdinalPosition( -1 );
       
  1988                 }
       
  1989               	}
  1992             }
  1990             }
  1993 
  1991 
  1994         // Finally request titlepane to refresh itself.
  1992         // Finally request titlepane to refresh itself.
  1995         if( titlecontrol )
  1993         if( titlecontrol )
  1996             {
  1994             {
  2343 
  2341 
  2344     // screen
  2342     // screen
  2345     TRect screenRect;
  2343     TRect screenRect;
  2346     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
  2344     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
  2347 
  2345 
  2348     // statuspane, skip application window because it's the same as screen.
  2346     // app window
       
  2347     TAknLayoutRect applicationWindowLayoutRect;
       
  2348     applicationWindowLayoutRect.LayoutRect(
       
  2349         screenRect,
       
  2350         AknLayoutScalable_Avkon::application_window( 0 ) );
       
  2351     TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
       
  2352 
       
  2353     // statuspane
  2349     TAknLayoutRect statusPaneLayoutRect;
  2354     TAknLayoutRect statusPaneLayoutRect;
  2350     statusPaneLayoutRect.LayoutRect( screenRect,
  2355     statusPaneLayoutRect.LayoutRect( applicationWindowRect,
  2351                                      AknLayoutScalable_Avkon::status_pane( 0 ) );
  2356                                      AknLayoutScalable_Avkon::status_pane( 0 ) );
  2352     TRect statusPaneRect( statusPaneLayoutRect.Rect() );
  2357     TRect statusPaneRect( statusPaneLayoutRect.Rect() );
  2353 
  2358 
  2354     // navi pane
  2359     // navi pane
  2355     TAknLayoutRect naviPaneLayoutRect;
  2360     TAknLayoutRect naviPaneLayoutRect;