scrsaver/scrsaverplugins/BmpAnimScrPlugin/inc/CBmpAnimModel.h
branchRCL_3
changeset 23 e8d784ac1a4b
parent 0 040fcad49f44
equal deleted inserted replaced
22:aaeeca1f15af 23:e8d784ac1a4b
       
     1 /*
       
     2 * Copyright (c) 2003 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:   Takes care of storing and serving the bitmaps
       
    15 *               to be animated along with their properties
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_CBMPANIMMODEL_H
       
    22 #define C_CBMPANIMMODEL_H
       
    23 
       
    24 #include "CBmpAnimItem.h"
       
    25 #include "CBmpAnimSettings.h"
       
    26 
       
    27 // 5 seems like a reasonable granularity
       
    28 const TInt KBmpAnimItemArrayGranularity = 5;
       
    29 
       
    30 // BmpAnim model. Contains BmpAnim items, serves the items to BmpAnim plugin
       
    31 class CBmpAnimModel : public CBase
       
    32     {
       
    33 public:
       
    34     // Default constructor & destructor
       
    35     CBmpAnimModel();
       
    36     virtual ~CBmpAnimModel();
       
    37 
       
    38 public:
       
    39     // Two-phase constructor, initialises member arrays and stuff
       
    40     virtual void ConstructL(CBmpAnimSettings* aSettings);
       
    41 
       
    42 public: // Access functions
       
    43     // Number of items query
       
    44     TInt NumberOfItems() const;
       
    45 
       
    46     // Add an item to the end of the array
       
    47     void AppendItemL(CBmpAnimItem* aItem);
       
    48 
       
    49     // Insert an item at <aIndex>. Space must be reserved.
       
    50     void InsertItemL(TInt aIndex, CBmpAnimItem* aItem);
       
    51 
       
    52     // Delete item at <anIndex>.
       
    53     void DeleteItemL(TInt aIndex);
       
    54 
       
    55     // Delete all items
       
    56     void DeleteAll();
       
    57 
       
    58     // Get item at position <aIndex>
       
    59     CBmpAnimItem* ItemAt(TInt aIndex) const;
       
    60 
       
    61     // Get current item index
       
    62     inline TInt CurrentItemIndex() const;
       
    63 
       
    64     // Set current item index
       
    65     inline void SetCurrentItemIndex(TInt aIndex);
       
    66 
       
    67     // Get next item in animation sequence. aWrapped is ETrue, if the
       
    68     // next item caused a wrap to the beginning of sequence
       
    69     CBmpAnimItem* NextItem(TBool& aWrapped);
       
    70     
       
    71     // Reserve space for <aCount> items
       
    72     void SetReserveL(TInt aCount);
       
    73 
       
    74     // Get settings
       
    75     inline CBmpAnimSettings* Settings() const;
       
    76     
       
    77 private:  // Utility functions
       
    78 
       
    79 private:
       
    80     // Item array
       
    81     CArrayPtrFlat<CBmpAnimItem>* iItems;
       
    82 
       
    83     // Current item index
       
    84     TInt iCurrentItem;
       
    85 
       
    86     CBmpAnimSettings* iSettings;
       
    87     };
       
    88 
       
    89 
       
    90 // --- inlines ---
       
    91 
       
    92 // Get current item index
       
    93 inline TInt CBmpAnimModel::CurrentItemIndex() const
       
    94     { return iCurrentItem; }
       
    95 
       
    96 
       
    97 // Set current item index
       
    98 inline void CBmpAnimModel::SetCurrentItemIndex(TInt aIndex)
       
    99     {
       
   100     iCurrentItem = aIndex;
       
   101     }
       
   102 
       
   103 // Get settings
       
   104 inline CBmpAnimSettings* CBmpAnimModel::Settings() const
       
   105    { return iSettings; }
       
   106 
       
   107 #endif   // C_CBMPANIMMODEL_H
       
   108 
       
   109 // End of file