commonuisupport/grid/inc/GRDMAP.H
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined(__GRDMAP_H__)
       
    17 #define __GRDMAP_H__
       
    18 
       
    19 #if !defined(__E32STD_H__)
       
    20 #include <e32std.h>
       
    21 #endif
       
    22 
       
    23 class RWriteStream;
       
    24 class RReadStream;
       
    25 
       
    26 class TSizeElement
       
    27 	{
       
    28 public:
       
    29     void ExternalizeL(RWriteStream &aStream) const;
       
    30 	void InternalizeL(RReadStream &aStream);
       
    31 public:
       
    32 	TInt iId;
       
    33 	TInt iValueInTwips;
       
    34 	TInt iValueInPixels;
       
    35 	};
       
    36 
       
    37 class CSparseMap : public CBase
       
    38 	{
       
    39 public:
       
    40 	static CSparseMap* NewL();
       
    41 	static CSparseMap* NewL(const CSparseMap* aSparseMap);
       
    42 	~CSparseMap();
       
    43 
       
    44 	TInt Count() const;
       
    45 	void SetL(TInt aId,TInt aValueInTwips,TInt aValueInPixels);
       
    46 	TInt DefaultValueInTwips() const;
       
    47 	TInt DefaultValueInPixels() const;
       
    48 	void SetDefaultValueInTwips(TInt aValueInTwips);
       
    49 	void SetDefaultValueInPixels(TInt aValueInPixels);
       
    50 	void ResetArray();
       
    51 	TInt ValueInTwips(TInt aId) const;
       
    52 	TInt ValueInPixels(TInt aId) const;
       
    53 	void OpenCloseGap(TInt aStartId,TInt aShiftOffset,TInt aMaxId);
       
    54 	void IdToDisplacement(TInt aId1,TInt aId2,TInt& aReturnDisp) const;
       
    55 	TBool DisplacementToId(TInt aId,TInt aDisp,TInt& aReturnId) const;
       
    56 	const TSizeElement& operator[](TInt aIndex) const;
       
    57 	TSizeElement& operator[](TInt aIndex);
       
    58 
       
    59 	void ExternalizeL(RWriteStream &aStream) const;
       
    60 	void InternalizeL(RReadStream &aStream);
       
    61 private:
       
    62 	CSparseMap();
       
    63 	void ConstructL();
       
    64 	void ConstructL(const CSparseMap* aSparseMap);
       
    65 	TInt FindId(TInt aId,TInt& aFindPos) const;
       
    66 private:
       
    67 	TInt iDefaultValueInTwips;
       
    68 	TInt iDefaultValueInPixels;
       
    69 	CArrayFixFlat<TSizeElement> *iArray;
       
    70 	};
       
    71 
       
    72 
       
    73 #endif