inc/screensaverindicatorarray.h
changeset 14 8a173132b0aa
parent 2 058b1fc1663a
equal deleted inserted replaced
2:058b1fc1663a 14:8a173132b0aa
     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:   CScreensaverIndicatorArray declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_SCREENSAVERINDICATORARRAY_H
       
    21 #define C_SCREENSAVERINDICATORARRAY_H
       
    22 
       
    23 #include "screensaverindicator.h"
       
    24 
       
    25 /*
       
    26 *   Indicator array class.
       
    27 */
       
    28 class CScreensaverIndicatorArray : public CBase
       
    29     {
       
    30     public:
       
    31         
       
    32         /**
       
    33     * Two-phased constructor
       
    34     * 
       
    35     * @param aOldLayout if construct the old layout or the new layout
       
    36     * @param aColorInversionUsed if use the inverted color or the 
       
    37     * normal color
       
    38     */
       
    39     static CScreensaverIndicatorArray* NewL( TBool aColorInversionUsed );
       
    40 
       
    41     /**
       
    42     * Destructor
       
    43     */
       
    44     ~CScreensaverIndicatorArray();
       
    45 
       
    46     /**
       
    47     * Two-phased constructor
       
    48     */
       
    49     void ConstructL( TBool aColorInversionUsed);
       
    50 
       
    51     /**
       
    52     * Creates indicator of given type and pushes it to
       
    53     * cleanup stack.
       
    54     *
       
    55     * @param aId  Indicator to be created.
       
    56     */
       
    57     CScreensaverIndicator *NewIndicatorLC(TScreensaverIndicatorType aType);
       
    58 
       
    59     /**
       
    60     * Draws indicator array to given graphics context. Setup function
       
    61     * must be called before calling Draw function.
       
    62     *
       
    63     * @param aGc  Graphics context for drawing indicator array.
       
    64     */
       
    65     void Draw(CWindowGc& aGc) const;
       
    66 
       
    67     /**
       
    68     * Sets up indicator array for drawing. Sets positions for
       
    69     * indicators.
       
    70     */
       
    71     void Setup(TAknLayoutRect& aLayoutRect, TAknLayoutText& aLayoutText,
       
    72                TAknLayoutRect& aLayoutInds);
       
    73     
       
    74     /*
       
    75     * Set the attributes of the indicator 
       
    76     */
       
    77     void SetIndicatorsAttribute( 
       
    78         TInt& Ind, 
       
    79         TAknLayoutText& aLayoutText, 
       
    80         TAknLayoutRect& aLayoutInds, 
       
    81         TInt& aCurrentX );
       
    82 
       
    83     /**
       
    84     * Checks if there is dependency flag set for given indicator.
       
    85     *
       
    86     * @param
       
    87     * @return ETrue  if there is dependency conflict.
       
    88     *         EFalse if not.
       
    89     */
       
    90     TBool CheckDependencyConflict(TScreensaverIndicatorId aId) const;
       
    91 
       
    92     /*
       
    93     * Sets dependency flag to given indicator to given value.
       
    94     * If dependency flag is set then the indicator is not drawn
       
    95     * even when it would be otherwise visible.
       
    96     */
       
    97     void SetDependencyStatus(TScreensaverIndicatorId aId, TBool aValue);
       
    98 
       
    99     /**
       
   100     * Queries payload for given indicator.
       
   101     *
       
   102     * @param aId ID of the indicator
       
   103     * @param aPayload Indicator payload to receive the information
       
   104     * @return  KErrNone if payload was set successfully.
       
   105     */
       
   106     TInt GetIndicatorPayload(
       
   107         TScreensaverIndicatorId aId,
       
   108         TIndicatorPayload& aPayload) const;
       
   109 
       
   110     /**
       
   111     * Sets payload for given indicator.
       
   112     * NOTE that icon and displayed indication cannot be set
       
   113     *
       
   114     * @param aType
       
   115     * @param aPayload
       
   116     * @return KErrNone if payload was set successfully.
       
   117     */
       
   118     TInt SetIndicatorPayload(
       
   119         TScreensaverIndicatorId aId,
       
   120         const TIndicatorPayload& aPayload);
       
   121 
       
   122     /**
       
   123     * Returns value indicating which drawing mode screensaver should select
       
   124     * based on indicator payloads and dependecies. This function aswers to question
       
   125     * "What drawing mode should screensaver select if indicator payloads and
       
   126     * dependencies were the only determining factor?". This doesn't mean
       
   127     * that screensaver will be necessarily drawn in that mode if there is
       
   128     * plugin module present or something happens while setting up indicator array
       
   129     * for drawing. Screensaver needs this information when it prepares itself for
       
   130     * drawing.
       
   131     */
       
   132     TScreensaverDrawType PreferredDrawingMode() const;
       
   133 
       
   134     /**
       
   135     * Returns value indicating which drawing mode screensaver should select.
       
   136     * This function is basically same as 'PreferredDrawingMode', but it
       
   137     * returns the final state of indicator array after it has been
       
   138     * set up (which may be different from PreferredDrawingMode).
       
   139     * Screensaver queries this information just before it draws the screen.
       
   140     */
       
   141     TScreensaverDrawType ActualDrawingMode() const;
       
   142 
       
   143     /**
       
   144     * Returns the height of indicator.
       
   145     */
       
   146     TInt Height() const;
       
   147 
       
   148     /**
       
   149     * To set visibility value for indicators
       
   150     */
       
   151     void SetVisibilityForIndicators();
       
   152     
       
   153 private:
       
   154     
       
   155     /**
       
   156     * C++ default constructor
       
   157     */
       
   158     CScreensaverIndicatorArray();
       
   159     
       
   160     /**
       
   161     * Construct the Indicator from the resource file
       
   162     */
       
   163     void ConstructFromResourceL();
       
   164     
       
   165     /*
       
   166     * Constuct the screensaver param from the resource
       
   167     */
       
   168     void ConstructParamFromResourceL();
       
   169     
       
   170     /*
       
   171     * Construct indicator array from resource 
       
   172     */
       
   173     void ConstructIndArrayL();
       
   174     
       
   175     /*
       
   176     * Construct the indicators from resource 
       
   177     */
       
   178     void ConstructIndicatorsL( TInt aResourceId );
       
   179     
       
   180     /**
       
   181     * Returns the dependency record by the index
       
   182     */
       
   183     TBool Dependency(TInt aIndex) const;
       
   184 
       
   185 private:
       
   186     
       
   187     /**
       
   188     * The count of the indicator
       
   189     */
       
   190     TInt iCount;
       
   191     
       
   192     /**
       
   193     * How many pixels between indicators.
       
   194     */
       
   195     TInt iGap;
       
   196     
       
   197     /** 
       
   198     * Minimum indicator distance to left and right border.
       
   199     */
       
   200     TInt iMargin;
       
   201     
       
   202     /**
       
   203     * Distance from top border of indicator bar to top border of 
       
   204     * indicator icon.
       
   205     */
       
   206     TInt iTopMargin;
       
   207     
       
   208     /**
       
   209     * The level of the text
       
   210     */
       
   211     TInt iTextLevel;
       
   212     
       
   213     /**
       
   214     * The area of the indicator
       
   215     */
       
   216     TRect iRect;
       
   217     
       
   218     /**
       
   219     * The height of the indicator bar
       
   220     */
       
   221     TInt iHeight;
       
   222     
       
   223     /**
       
   224     * The array of indicators
       
   225     */
       
   226     CArrayPtrFlat<CScreensaverIndicator>* iIndicators;
       
   227     
       
   228     /**
       
   229     * The array of dependency record
       
   230     */
       
   231     CArrayFixFlat<TBool>* iDependencyRecord;
       
   232     
       
   233     /**
       
   234     * The flag decised if use the old layout or not.
       
   235     */
       
   236     TBool iOldLayout;
       
   237     
       
   238     /**
       
   239     * Colors to be used for indicator layout
       
   240     */
       
   241     TUint32 iBgColor;
       
   242     TUint32 iTextColor;  
       
   243 };
       
   244 
       
   245 #endif // C_SCREENSAVERINDICATORARRAY_H