idlehomescreen/xmluirendering/renderingplugins/xnclockfactory/inc/xnclockcontrol.h
branchRCL_3
changeset 83 5456b4e8b3a8
child 88 3321d3e205b6
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:  Clock control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _XNCLOCKCONTROL_H
       
    20 #define _XNCLOCKCONTROL_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 
       
    25 // User includes
       
    26 
       
    27 // Forward declarations
       
    28 class CWindowGc;
       
    29 class CXnClockAdapter;
       
    30 class CXnClockFace;
       
    31 
       
    32 // Class declaration
       
    33 /**
       
    34 *  @ingroup group_xnclockfactory
       
    35 *  @lib xnclockfactory.lib
       
    36 *  @since S60 5.0
       
    37 */
       
    38 NONSHARABLE_CLASS( CXnClockControl ) : public CBase
       
    39     {
       
    40 public: // Constructors and destructor
       
    41 
       
    42     /**
       
    43     * Two-phased constructor.
       
    44     *
       
    45     * @since S60 5.1
       
    46     *
       
    47     * @param  aContainerWindow   Container window for the clock component.
       
    48     *
       
    49     * @param  aFormatFromLocale  Boolean flag to indicate whether the clock
       
    50     *                            format should be updated from the locale.
       
    51     *
       
    52     * @param  aContextPaneClock  Boolean flag that indicates whether the
       
    53     *                            clock is in the context pane.
       
    54     *
       
    55     * @return Newly constructed object.
       
    56     */
       
    57     static CXnClockControl* NewL( CXnClockAdapter* aAdapter,
       
    58                                   const TBool aFormatFromLocale,
       
    59                                   const TClockFormat aFormat );
       
    60                                               
       
    61 
       
    62     /**
       
    63     * Destructor.
       
    64     */
       
    65     virtual ~CXnClockControl();
       
    66 
       
    67 public: // New functions
       
    68 
       
    69     /**
       
    70     * Updates the double buffer and redraws the clock.
       
    71     */
       
    72     void UpdateDisplay();
       
    73 
       
    74     /**
       
    75     * Sets the format of the clock.
       
    76     *
       
    77     * @param  aFormatFromLocale  Wheter clock is getting format from locale
       
    78     * @param  aFormat  New clock format.
       
    79     */
       
    80     void SetFormatL( const TBool aFormatFromLocale, 
       
    81                      const TClockFormat aFormat );
       
    82 
       
    83     /**
       
    84     * Gets the clock format 
       
    85     *    
       
    86     * @return Clock format.
       
    87     */    
       
    88     TClockFormat Format() const;
       
    89         
       
    90     /**
       
    91     * Draws the clock
       
    92     *
       
    93     * @param aGc Context where to draw
       
    94     * @param aRect Rect Clock rect 
       
    95     */
       
    96     void Draw( CWindowGc& aGc, const TRect& aRect );
       
    97     
       
    98     /**
       
    99     * Starts the clock timer.
       
   100     * Used when the clock gains visibility.
       
   101     */
       
   102     void StartTimer();
       
   103 
       
   104     /**
       
   105     * Stops the clock timer.
       
   106     * Used when the clock loses visibility.
       
   107     */
       
   108     void StopTimer();
       
   109 
       
   110 private: // New functions
       
   111 
       
   112     /**
       
   113     * Timer callback for clock updates
       
   114     *
       
   115     * @param  aThis  Pointer to the skinnable clock instance.
       
   116     *
       
   117     * @return Always returns @c KErrNone.
       
   118     */
       
   119     static TInt TimerCallback( TAny* aThis );
       
   120 
       
   121 private:
       
   122 
       
   123     /**
       
   124     * C++ default constructor.
       
   125     */
       
   126     CXnClockControl( CXnClockAdapter* aAdapter,
       
   127                      const TBool aFormatFromLocale,
       
   128                      const TClockFormat aFormat );
       
   129                         
       
   130     /**
       
   131     * By default Symbian 2nd phase constructor is private.
       
   132     */
       
   133     void ConstructL();
       
   134 
       
   135 private: // data
       
   136 
       
   137     // Timer, owned
       
   138     CPeriodic*              iTimer;
       
   139     // Clock face, owned
       
   140     CXnClockFace*           iFace;
       
   141     // Clock adapter, not owned
       
   142     CXnClockAdapter*        iAdapter;            
       
   143     // Clock format
       
   144     TClockFormat            iClockFormat;    
       
   145     // Flag indicating whetger format clock from locale
       
   146     TBool                   iFormatFromLocale;    
       
   147     };
       
   148 
       
   149 #endif // _XNCLOCKCONTROL_H
       
   150 
       
   151 // End of File