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