uifw/AknGlobalUI/AknCapServer/src/AknFastswapWindowGrid.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Grid handling the list functionality in fast application swap.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <aknlayoutscalable_avkon.cdl.h>
       
    20 #include <AknLayout2ScalableDef.h>
       
    21 #include "AknFastswapWindowGrid.h"
       
    22 #include "AknFastswapWindowControl.h"
       
    23 #include "aknlists.h"
       
    24 #include "AknsUtils.h"
       
    25 #include "akntrace.h"
       
    26 
       
    27 // ---------------------------------------------------------
       
    28 // CAknFastSwapWindowGrid::SizeChanged
       
    29 // ---------------------------------------------------------
       
    30 //
       
    31 void CAknFastSwapWindowGrid::SizeChanged()
       
    32     {
       
    33     _AKNTRACE_FUNC_ENTER;
       
    34     CAknGrid::SizeChanged();
       
    35 
       
    36     // this code assumes that Rect() returns the correct rect
       
    37     TAknLayoutRect layoutRect;
       
    38     layoutRect.LayoutRect( Rect(), AknLayoutScalable_Avkon::cell_fast2_pane( 0, 0).LayoutLine() );
       
    39     
       
    40     TRect cellRect( layoutRect.Rect() );
       
    41 
       
    42     View()->ItemDrawer()->SetItemCellSize( cellRect.Size() );
       
    43     TRAP_IGNORE( SetItemHeightL( cellRect.Height() ) );
       
    44 
       
    45     TPoint empty( ELayoutEmpty, ELayoutEmpty );
       
    46 
       
    47     // icon
       
    48     //CEikFormattedCellListBox &listBox = *this;
       
    49     AknListBoxLayouts::SetupFormGfxCell( 
       
    50         *this, 
       
    51         ItemDrawer(), 
       
    52         0,
       
    53         AknLayoutScalable_Avkon::cell_fast2_pane_g3().LayoutLine(),
       
    54         empty, 
       
    55         empty );   
       
    56     _AKNTRACE_FUNC_EXIT;
       
    57     }
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // Updates the scrollbar of the fast swap window.
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 void CAknFastSwapWindowGrid::UpdateScrollBarsL()
       
    65     {
       
    66     _AKNTRACE_FUNC_ENTER;
       
    67     // Overriding CAknGrid::UpdateScrollBarsL()
       
    68 
       
    69     // Use TAknDoubleSpanScrollBarModel instead of TEikScrollBarModel.
       
    70     TAknDoubleSpanScrollBarModel vSbarModel;
       
    71 
       
    72     TInt logicalRow;
       
    73     TInt logicalColumn;
       
    74     CAknGridView* gridView = GridView();
       
    75     gridView->LogicalPosFromListBoxIndex( CurrentDataIndex(),
       
    76                                             logicalRow,
       
    77                                             logicalColumn );
       
    78     logicalRow *= gridView->ItemHeight();
       
    79     logicalRow -= gridView->ItemOffsetInPixels();
       
    80     
       
    81     // Direct manipulation with the variables is not allowed in
       
    82     // TAknDoubleSpanScrollBarModel.
       
    83     vSbarModel.SetScrollSpan(
       
    84         gridView->GridCellDimensions().iHeight * gridView->ItemHeight() );
       
    85     vSbarModel.SetWindowSize( gridView->ViewRect().Height() );
       
    86     vSbarModel.SetFocusPosition( logicalRow );
       
    87     
       
    88     ScrollBarFrame()->Tile( &vSbarModel );    
       
    89     _AKNTRACE_FUNC_EXIT;
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------
       
    94 // CAknFastSwapWindowGrid::HandlePointerEventL
       
    95 // parent CAknGrid handle changing highlight item and open app when tap a highlight item
       
    96 // and handle draging scroll bar
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 void CAknFastSwapWindowGrid::HandlePointerEventL(const TPointerEvent &aPointerEvent)
       
   100     {
       
   101     CAknGrid::HandlePointerEventL(aPointerEvent);
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // CAknFastSwapWindowGrid::CreateItemDrawerL
       
   106 // Item drawer construction
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CAknFastSwapWindowGrid::CreateItemDrawerL()
       
   110     {
       
   111     _AKNTRACE_FUNC_ENTER;
       
   112     CAknGrid::CreateItemDrawerL();
       
   113     // Let the FSW background context control the grid skinning
       
   114     ItemDrawer()->FormattedCellData()->SetSkinEnabledL( EFalse );
       
   115     _AKNTRACE_FUNC_EXIT;
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------
       
   119 // CAknFastSwapWindowGrid::SetupStandardGrid
       
   120 // Itemdrawer border and color setup
       
   121 //
       
   122 // ---------------------------------------------------------
       
   123 //
       
   124 void CAknFastSwapWindowGrid::SetupStandardGrid()
       
   125     {
       
   126     _AKNTRACE_FUNC_ENTER;
       
   127     // text colors according LAF (without skin)
       
   128     TAknLayoutText layoutText;
       
   129     layoutText.LayoutText( 
       
   130         Rect(), 
       
   131         AknLayoutScalable_Avkon::cell_app_pane_cp2_t1( 0 ).LayoutLine() );
       
   132 
       
   133     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   134     TRgb textColor;
       
   135     TRgb textColorHighlight;
       
   136 
       
   137     // sets the color according the skin LAF
       
   138     TInt error = AknsUtils::GetCachedColor( 
       
   139         skin, 
       
   140         textColor, 
       
   141         KAknsIIDQsnTextColors, 
       
   142         EAknsCIQsnTextColorsCG9 );
       
   143 
       
   144     if ( error != KErrNone )
       
   145         {
       
   146         textColor = layoutText.Color();
       
   147         }
       
   148 
       
   149     error = AknsUtils::GetCachedColor( 
       
   150         skin, 
       
   151         textColorHighlight, 
       
   152         KAknsIIDQsnTextColors, 
       
   153         EAknsCIQsnTextColorsCG11 );
       
   154 
       
   155     if ( error != KErrNone )
       
   156         {
       
   157         textColorHighlight = layoutText.Color();
       
   158         }
       
   159 
       
   160     SetBorder( TGulBorder::ENone );
       
   161     ItemDrawer()->SetTextColor( textColor );
       
   162     ItemDrawer()->SetBackColor( AKN_LAF_COLOR( 0 ) );
       
   163 
       
   164     ItemDrawer()->SetHighlightedTextColor( textColorHighlight );
       
   165     ItemDrawer()->SetHighlightedBackColor( AKN_LAF_COLOR( 0 ) );
       
   166     _AKNTRACE_FUNC_EXIT;
       
   167     }
       
   168 
       
   169 EXPORT_C void CAknFastSwapWindowGrid::CEikListBox_Reserved()
       
   170     {
       
   171     }
       
   172 
       
   173 //  End of File