uifw/ganes/inc/HgLayoutData.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 
       
    20 
       
    21 
       
    22 /*
       
    23  * HgLayoutData.h
       
    24  *
       
    25  *  Created on: Feb 6, 2009
       
    26  *      Author: anjokela
       
    27  */
       
    28 
       
    29 #ifndef HGLAYOUTDATA_H_
       
    30 #define HGLAYOUTDATA_H_
       
    31 
       
    32 #include <e32base.h>
       
    33 #include <AknLayout2ScalableDef.h>
       
    34 #include "HgConstants.h"
       
    35 
       
    36 NONSHARABLE_CLASS( CHgListLayoutData ) : public CBase
       
    37     {
       
    38 public:
       
    39     static CHgListLayoutData* NewL()
       
    40         {
       
    41         CHgListLayoutData* self = new (ELeave) CHgListLayoutData;
       
    42         CleanupStack::PushL(self);
       
    43         self->ConstructL( KMaxNumberOfTitleIndicators );
       
    44         CleanupStack::Pop(self);
       
    45         return self;
       
    46         }
       
    47     
       
    48     virtual ~CHgListLayoutData()
       
    49         {
       
    50         iTitleLayouts.Close();
       
    51         }
       
    52     
       
    53 public:
       
    54 
       
    55     inline void SetBaseLayout( const TAknWindowComponentLayout& aLayout )
       
    56         {
       
    57         iBaseLayout = aLayout;
       
    58         }
       
    59     
       
    60     inline const TAknWindowComponentLayout& BaseLayout()
       
    61         {
       
    62         return iBaseLayout;
       
    63         }
       
    64     
       
    65     inline void SetItemLayout( const TAknWindowComponentLayout& aLayout )
       
    66         {
       
    67         iItemLayout = aLayout;
       
    68         }
       
    69     
       
    70     inline const TAknWindowComponentLayout& ItemLayout()
       
    71         {
       
    72         return iItemLayout;
       
    73         }
       
    74     
       
    75     inline void SetIconLayout( const TAknWindowComponentLayout& aLayout )
       
    76         {
       
    77         iIconLayout = aLayout;
       
    78         }
       
    79     
       
    80     inline const TAknWindowComponentLayout& IconLayout()
       
    81         {
       
    82         return iIconLayout;
       
    83         }
       
    84     
       
    85     inline void SetTitleLayout( TInt aIndicators, const TAknTextComponentLayout& aLayout )
       
    86         {
       
    87         if(aIndicators >= 0 && aIndicators < iTitleLayouts.Count())
       
    88             {
       
    89             iTitleLayouts[aIndicators] = aLayout;
       
    90             }
       
    91         }
       
    92     
       
    93     inline const TAknTextComponentLayout& TitleLayout( TInt aIndicators )
       
    94         {
       
    95         return iTitleLayouts[aIndicators];
       
    96         }
       
    97     
       
    98     inline void SetTextLayout( const TAknTextComponentLayout& aLayout )
       
    99         {
       
   100         iTextLayout = aLayout;
       
   101         }
       
   102     
       
   103     inline const TAknTextComponentLayout& TextLayout()
       
   104         {
       
   105         return iTextLayout;
       
   106         }
       
   107     
       
   108     inline void SetFirstIndicatorLayout( const TAknWindowComponentLayout& aLayout )
       
   109         {
       
   110         iFirstIndicatorLayout = aLayout;
       
   111         }
       
   112     
       
   113     inline const TAknWindowComponentLayout& FirstIndicatorLayout()
       
   114         {
       
   115         return iFirstIndicatorLayout;
       
   116         }
       
   117     
       
   118     inline void SetSecondIndicatorLayout( const TAknWindowComponentLayout& aLayout )
       
   119         {
       
   120         iSecondIndicatorLayout = aLayout;
       
   121         }
       
   122 
       
   123     inline const TAknWindowComponentLayout& SecondIndicatorLayout()
       
   124         {
       
   125         return iSecondIndicatorLayout;
       
   126         }
       
   127 protected:
       
   128 
       
   129     void ConstructL( TInt aMaxIndicators )
       
   130         {
       
   131         for(TInt i = 0; i <= aMaxIndicators; ++i)
       
   132             {
       
   133             User::LeaveIfError(iTitleLayouts.Append(TAknTextComponentLayout()));
       
   134             }
       
   135         }
       
   136 
       
   137 protected: // data
       
   138 
       
   139     TAknWindowComponentLayout iBaseLayout;
       
   140     TAknWindowComponentLayout iItemLayout;
       
   141     TAknWindowComponentLayout iIconLayout;
       
   142     RArray<TAknTextComponentLayout> iTitleLayouts;
       
   143     TAknTextComponentLayout iTextLayout;
       
   144     TAknWindowComponentLayout iFirstIndicatorLayout;
       
   145     TAknWindowComponentLayout iSecondIndicatorLayout;
       
   146     
       
   147     };
       
   148 
       
   149 NONSHARABLE_CLASS( CHgGridLayoutData ) : public CHgListLayoutData
       
   150     {
       
   151 public:
       
   152     static CHgGridLayoutData* NewL(TInt aMaxColumnCount)
       
   153         {
       
   154         CHgGridLayoutData* self = new (ELeave) CHgGridLayoutData;
       
   155         CleanupStack::PushL(self);
       
   156         self->ConstructL( aMaxColumnCount );
       
   157         CleanupStack::Pop(self);
       
   158         return self;
       
   159         }
       
   160     
       
   161     virtual ~CHgGridLayoutData()
       
   162         {
       
   163         iColumnLayouts.Close();
       
   164         }
       
   165 public:        
       
   166     inline void SetColumnLayout( TInt aIndex, const TAknWindowComponentLayout& aLayout )
       
   167         {
       
   168         if(aIndex >= 0 && aIndex < iColumnLayouts.Count())
       
   169             {
       
   170             iColumnLayouts[aIndex] = aLayout;
       
   171             }
       
   172         }
       
   173     
       
   174     inline const TAknWindowComponentLayout& ColumnLayout(TInt aIndex)
       
   175         {
       
   176         return iColumnLayouts[aIndex];
       
   177         }
       
   178 
       
   179     void ChangeCols( TInt aCols )
       
   180         {
       
   181         if(aCols < 0) aCols = 0;
       
   182         
       
   183         while( iColumnLayouts.Count() < aCols )
       
   184             {
       
   185             iColumnLayouts.Append(TAknWindowComponentLayout());
       
   186             }
       
   187         while( iColumnLayouts.Count() > aCols )
       
   188             {
       
   189             iColumnLayouts.Remove(iColumnLayouts.Count() - 1);
       
   190             }
       
   191         }
       
   192 protected:
       
   193 
       
   194     void ConstructL( TInt aMaxColumnCount )
       
   195         {
       
   196         CHgListLayoutData::ConstructL(0);
       
   197         
       
   198         for(TInt i = 0; i < aMaxColumnCount; ++i)
       
   199             {
       
   200             User::LeaveIfError(iColumnLayouts.Append(TAknWindowComponentLayout()));
       
   201             }
       
   202         }
       
   203 protected:
       
   204     RArray<TAknWindowComponentLayout> iColumnLayouts;
       
   205     
       
   206     };
       
   207 
       
   208 #endif /* HGLAYOUTDATA_H_ */