videocollection/hgmyvideos/src/vcxhgmyvideoslistbase.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:      Base class for Hg based video list implementations.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <aknViewAppUi.h>
       
    22 #include <StringLoader.h>
       
    23 #include <utf.h>
       
    24 
       
    25 #include <ganes/HgScroller.h>
       
    26 
       
    27 #include <vcxhgmyvideos.rsg>
       
    28 #include "vcxhgmyvideoslistbase.h"
       
    29 #include "vcxhgmyvideosmainview.h"
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CVcxHgMyVideosListBase::CVcxHgMyVideosListBase()
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CVcxHgMyVideosListBase::CVcxHgMyVideosListBase( 
       
    38     CVcxHgMyVideosModel& aModel,
       
    39     CVcxHgMyVideosMainView& aView,
       
    40     CHgScroller& aScroller )
       
    41     : iModel( aModel ),
       
    42       iView( aView ),
       
    43       iScroller( &aScroller )
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CVcxHgMyVideosListBase::ConstructL()
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CVcxHgMyVideosListBase::ConstructL()
       
    52     {
       
    53     iScroller->MakeVisible( EFalse );
       
    54     iScroller->SetMopParent( &iView );
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CVcxHgMyVideosListBase::~CVcxHgMyVideosListBase()
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CVcxHgMyVideosListBase::~CVcxHgMyVideosListBase()
       
    62     {
       
    63     iView.AppUi()->RemoveFromStack( iScroller );
       
    64     delete iScroller;
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CVcxHgMyVideosListBase::DoListActivateL()
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void CVcxHgMyVideosListBase::DoListActivateL( TInt aIndex )
       
    72     {
       
    73     iView.AppUi()->AddToStackL( iScroller );
       
    74     iScroller->MakeVisible( ETrue );
       
    75     SetEmptyListTextL();
       
    76     SetTitleTextL( aIndex );
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CVcxHgMyVideosListBase::DoListDeactivate() 
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CVcxHgMyVideosListBase::DoListDeactivate()
       
    84     {
       
    85     iView.AppUi()->RemoveFromStack( iScroller );
       
    86     iScroller->MakeVisible( EFalse );
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CVcxHgMyVideosListBase::UpdateLayout()
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CVcxHgMyVideosListBase::UpdateLayout( TRect& aRect )
       
    94     {
       
    95     if ( aRect != iScroller->Rect() )
       
    96         {
       
    97         TRAP_IGNORE( iScroller->InitScreenL( aRect ) );
       
    98         }
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CVcxHgMyVideosListBase::SetEmptyListTextByResourceL()
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CVcxHgMyVideosListBase::SetEmptyListTextByResourceL( TInt aResourceId )
       
   106     {
       
   107     HBufC* textFromResourceFile = StringLoader::LoadLC( aResourceId );
       
   108     iScroller->SetEmptyTextL( *textFromResourceFile );
       
   109     CleanupStack::PopAndDestroy( textFromResourceFile );
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CVcxHgMyVideosListBase::SetTitleTextByResourceL()
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 void CVcxHgMyVideosListBase::SetTitleTextByResourceL( TInt aResourceId )
       
   117     {
       
   118     HBufC* title = StringLoader::LoadLC( aResourceId );
       
   119     iView.TitlePaneL()->SetTextL( *title );
       
   120     CleanupStack::PopAndDestroy( title );
       
   121     }