inc/screensaverctrlmovingtext.h
branchRCL_3
changeset 26 e8d784ac1a4b
equal deleted inserted replaced
25:aaeeca1f15af 26: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:   Definitions screensaver moving text display class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifdef USE_DATE_AND_TEXT
       
    19 
       
    20 #ifndef C_SCREENSAVERCTRLMOVINGTEXT_H
       
    21 #define C_SCREENSAVERCTRLMOVINGTEXT_H
       
    22 
       
    23 #include <AknPictographInterface.h>
       
    24 
       
    25 #include "screensaverbase.h"
       
    26 
       
    27 const TInt KScreensaverDataReconnectingDelay = 50000;
       
    28 const TInt KScreensaverBarHeight = 24;
       
    29 
       
    30 //
       
    31 // class CScreensaverCtrlMovingText
       
    32 //
       
    33 class CScreensaverCtrlMovingText : public CScreensaverBase
       
    34     {
       
    35 public:
       
    36     /**
       
    37     * Two-phased constructor
       
    38     * 
       
    39     * @param aType the type of display object  
       
    40     * @return CScreensaverCtrlMovingText the pointer of CScreensaverCtrlMovingText 
       
    41     * object
       
    42     */
       
    43     static CScreensaverCtrlMovingText* NewL( TDisplayObjectType aType );
       
    44 
       
    45      /**
       
    46      * Destructor.
       
    47      */
       
    48     ~CScreensaverCtrlMovingText();
       
    49 
       
    50 public:
       
    51     // From CCoeControl
       
    52     
       
    53     /** 
       
    54     * Resource change handling  
       
    55     */
       
    56     virtual void HandleResourceChange( TInt aType );
       
    57     
       
    58     
       
    59     /**
       
    60     * Responds to changes to the size and position of the contents 
       
    61     * of this control.  
       
    62     */
       
    63     virtual void SizeChanged();
       
    64 
       
    65     /**
       
    66     * Drawing (override this to draw)
       
    67     */
       
    68     virtual void Draw( const TRect& aRect ) const;
       
    69 
       
    70 public:
       
    71     // Implemented here instead of shareddatainterface
       
    72 
       
    73     /**
       
    74     * Set moving bar on / off
       
    75     * 
       
    76     * @param aMove a bool type to decide if it can move or not
       
    77     */
       
    78     void SetMoving( TBool aMove = ETrue );
       
    79 
       
    80     /**
       
    81     * Start the control needed timer
       
    82     */
       
    83     void StartTimer();
       
    84     
       
    85     /**
       
    86     * Cancels the timer
       
    87     */
       
    88     void CancelTimer();
       
    89     
       
    90     /**
       
    91     * Clear the screen
       
    92     */
       
    93     void ClearScreen();
       
    94     
       
    95     /*
       
    96     * Refresh the display 
       
    97     */
       
    98     void Refresh();
       
    99     
       
   100 protected:
       
   101         
       
   102     /**
       
   103     * Constructor
       
   104     * 
       
   105     * @param aType the type of the display object.  
       
   106     */
       
   107     CScreensaverCtrlMovingText( TDisplayObjectType aType );
       
   108     
       
   109     /**
       
   110     * Two-phased constructor  
       
   111     */
       
   112     void ConstructL();
       
   113     
       
   114     /**
       
   115     * Draw the object on the screen of this type  
       
   116     * 
       
   117     * @param aGc the CWindowGc object 
       
   118     * @param aRect
       
   119     */
       
   120     virtual void DrawNew( CWindowGc& aGc, const TRect& aRect ) const;
       
   121     
       
   122     /**
       
   123     * Draw the date on the bar
       
   124     */
       
   125     virtual void DrawText( CWindowGc& aGc ) const;
       
   126 
       
   127     /**
       
   128     * Draws text with pictographs  
       
   129     */
       
   130     void DrawPictoText( CWindowGc &aGc ) const;
       
   131 
       
   132     /**
       
   133     * Get the current time  
       
   134     */
       
   135     void UpdateCurrentTimeL();
       
   136     
       
   137     /**
       
   138     * Generate the screensaver bar
       
   139     */
       
   140     void GenerateDisplayAttributesForScreensaverBar();
       
   141 
       
   142 private:
       
   143     /**
       
   144     * Get the random top value  
       
   145     * 
       
   146     * @return TInt the random value
       
   147     */
       
   148     void GetRandomTopValue( TInt aBarHight );
       
   149     
       
   150     /**
       
   151     * Get the random seed
       
   152     */
       
   153     TInt RandomSeed();
       
   154     
       
   155     /**
       
   156     * Get the text and background color
       
   157     */
       
   158     void GetTextAndBgColor();
       
   159     
       
   160     /**
       
   161     * Format the display text
       
   162     */
       
   163     void FormatTextL( TDes& aText, const TDesC& aFormat );
       
   164 
       
   165     /**
       
   166     * Set AmPm text payload to indicator
       
   167     */
       
   168     void SetAmPmIndicatorPayloadL();
       
   169     
       
   170     /**
       
   171     * Format the data and time text
       
   172     */
       
   173     void FormatTextFromResourceL( TDes &aDes, TInt aResourceId );
       
   174     
       
   175     /**
       
   176     * Get the clock area and text layout
       
   177     */
       
   178     void GetClockLayout( const TRect& aRect );
       
   179     
       
   180     /**
       
   181     * Get the date area and text layout
       
   182     */
       
   183     void GetDateLayout( const TRect& aRect );
       
   184     
       
   185     /**
       
   186     * Get the indicator area and text layout
       
   187     */
       
   188     void GetIndicatorAreaLayout( const TRect& aRect );
       
   189     
       
   190     /**
       
   191     * Start the indicator bar refresh timer
       
   192     */
       
   193     void StartBarRefreshTimer();
       
   194 
       
   195     
       
   196 protected://data
       
   197     
       
   198     /**
       
   199     * The layout date and text  
       
   200     */
       
   201     TAknLayoutText iLayoutDateText;
       
   202 private://data
       
   203     /**
       
   204     * The top position of the bar 
       
   205     */
       
   206     TInt iTop;
       
   207     
       
   208     /**
       
   209     * The random seed to get the random value   
       
   210     */
       
   211     TInt64 iRandSeed;
       
   212 
       
   213     // For new layout    
       
   214     /**
       
   215     * The time string that will be displayed on the bar  
       
   216     */
       
   217     TBuf<15> iTextTime;    
       
   218     
       
   219     /**
       
   220     * The date string that will be displayed on the bar  
       
   221     * or he text will be display the on the bar
       
   222     */
       
   223     TBuf<25> iText;
       
   224     
       
   225     /**
       
   226     * The type of the display text  
       
   227     */
       
   228     TDisplayObjectType iType;
       
   229 
       
   230     //Lay out
       
   231     TAknLayoutRect iLayoutBar;
       
   232     TAknLayoutRect iLayoutClock;
       
   233     TAknLayoutRect iLayoutDate; // missing
       
   234     TAknLayoutText iLayoutClockText;
       
   235     TAknLayoutText iLayoutAmPmText;
       
   236     
       
   237     // Moving bar on / off
       
   238     TBool iMoveBar;
       
   239     
       
   240     /**
       
   241     * The color for background and text
       
   242     */
       
   243     TInt iBgColor;
       
   244     TInt iTextColor;
       
   245     TInt iTextBgColor;
       
   246     
       
   247     /**
       
   248     * The indicator bar refresh timer
       
   249     */
       
   250     CPeriodic* iBarRefreshTimer;
       
   251 
       
   252     /**
       
   253     * Pictograph drawing interface 
       
   254     */
       
   255     CAknPictographInterface* iPictoI;
       
   256     };
       
   257 
       
   258 #endif // C_SCREENSAVERCTRLMOVINGTEXT_H
       
   259 
       
   260 #endif // USE_DATE_AND_TEXT
       
   261 // End of file.