uifw/ganes/inc/HgScrollBufferManager.h
changeset 47 2f0c06423c72
parent 46 0e1e0022bd03
child 53 3c67ea82fafc
equal deleted inserted replaced
46:0e1e0022bd03 47:2f0c06423c72
     1 /*
       
     2 * Copyright (c) 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:     
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HGSCROLLBUFFERMANAGER_H_
       
    20 #define HGSCROLLBUFFERMANAGER_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 class MHgScrollBufferObserver;
       
    24 class MHgBufferOwner;
       
    25 
       
    26 NONSHARABLE_CLASS( CHgScrollBufferManager ) : public CActive
       
    27     {
       
    28 public:
       
    29 
       
    30     static CHgScrollBufferManager* NewL( 
       
    31             MHgScrollBufferObserver& aObserver, 
       
    32             TInt aBufferSize,
       
    33             TInt aBufferTreshold,
       
    34             TInt aInitialPosition,
       
    35             TInt aTotalCount );
       
    36     
       
    37     virtual ~CHgScrollBufferManager();
       
    38     
       
    39 protected: // From CActive
       
    40 
       
    41     void RunL();
       
    42     void DoCancel();
       
    43     TInt RunError( TInt aError );
       
    44 
       
    45 public:
       
    46     void SetPosition( TInt aIndex );
       
    47 
       
    48     void ItemCountChanged( TInt aIndex, TBool aRemoved, TInt aNewTotalCount );
       
    49     
       
    50     void SetTotalCount( TInt aTotalCount );
       
    51     
       
    52     void SetBufferOwner( MHgBufferOwner& aOwner );
       
    53     
       
    54     void ResetBuffer( TInt aPosition, TInt aTotalCount);
       
    55 
       
    56 protected:
       
    57     CHgScrollBufferManager(
       
    58             MHgScrollBufferObserver& aObserver, 
       
    59             TInt aBufferSize,
       
    60             TInt aBufferTreshold,
       
    61             TInt aInitialPosition,
       
    62             TInt aTotalCount );
       
    63     
       
    64     void ConstructL();
       
    65 
       
    66 private:
       
    67     void NotifyObserver();
       
    68     
       
    69 private:
       
    70     MHgScrollBufferObserver& iObserver; 
       
    71     MHgBufferOwner* iOwner;
       
    72     
       
    73     TInt iBufferSize;
       
    74     TInt iBufferTreshold;
       
    75     TInt iBufferPosition;
       
    76     TInt iDiff;
       
    77     TInt iTotalCount;
       
    78     
       
    79     TBool iResetOrdered;
       
    80     
       
    81     TInt iRequestStart;
       
    82     TInt iRequestCount;
       
    83     TInt iReleaseStart;
       
    84     TInt iReleaseCount;
       
    85     };
       
    86 
       
    87 #endif /*HGSCROLLBUFFERMANAGER_H_*/