uifw/AvKon/inc/akndigitalclock.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Digital clock control for status pane.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AKNDIGITALCLOCK_H
       
    20 #define C_AKNDIGITALCLOCK_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <AknControl.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CAknDigitalClockChangeHandler;
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 * Clock control that displays simple digital clock without skinning.
       
    32 *
       
    33 * This class is not intended for further derivation.
       
    34 *
       
    35 * @since 3.1
       
    36 *
       
    37 * @internal
       
    38 */
       
    39 NONSHARABLE_CLASS( CAknDigitalClock ) : public CAknControl
       
    40     {
       
    41 public: // Constructors and destructor
       
    42 
       
    43     /**
       
    44     * Two-phased constructor.
       
    45     *
       
    46     * @param  aContainerWindow  Container window for the clock component.
       
    47     *
       
    48     * @param  aInStatusPane     Specifies whether or not this control
       
    49     *                           is used in the status pane's clock pane.
       
    50     *
       
    51     * @return Newly constructed object.
       
    52     */
       
    53     static CAknDigitalClock* NewL( CCoeControl* aContainerWindow,
       
    54                                    TBool aInStatusPane = EFalse );
       
    55 
       
    56     /**
       
    57     * Destructor.
       
    58     */
       
    59     virtual ~CAknDigitalClock();
       
    60 
       
    61 public: // New functions
       
    62 
       
    63     /**
       
    64      * Sets color.
       
    65      */
       
    66     void SetColor( TRgb aColor );
       
    67 
       
    68     /**
       
    69      * Sets layout for the time. This method automatically
       
    70      * overrides given font, align and rects. Color is not overridden.
       
    71      */
       
    72     void SetTimeLayout( TAknTextLineLayout aTimeLayout );
       
    73 
       
    74     /**
       
    75      * Clears given layout.
       
    76      */
       
    77     void ClearTimeLayout();
       
    78 
       
    79     /**
       
    80      * Starts the clock timer.
       
    81      * Used when the clock becomes visible.
       
    82      */
       
    83     void StartTimer();
       
    84 
       
    85     /**
       
    86      * Stops the clock timer.
       
    87      * Used when the clock becomes non-visible.
       
    88      */
       
    89     void StopTimer();
       
    90     
       
    91     /**
       
    92      * Adjusts the clock position in status pane in certain status pane
       
    93      * layouts when time format is changed.
       
    94      */
       
    95     void AdjustPositionL();
       
    96 
       
    97 private: // New functions
       
    98 
       
    99     /**
       
   100      * Timer callback for clock updates
       
   101      *
       
   102      * @param aThis Pointer to the skinnable clock instance.
       
   103      *
       
   104      * @return Always returns @c KErrNone.
       
   105      */
       
   106     static TInt TimerCallback( TAny* aThis );
       
   107 
       
   108 public: // Functions from CCoeControl
       
   109 
       
   110     /**
       
   111      * Handles the resource change.
       
   112      *
       
   113      * @param  aType  Resource change type.
       
   114      */
       
   115     void HandleResourceChange( TInt aType );
       
   116 
       
   117 private: // Functions from @c CCoeControl
       
   118 
       
   119     /**
       
   120      * Draws the clock.
       
   121      *
       
   122      * @param aRect Not used.
       
   123      */
       
   124     void Draw( const TRect& aRect ) const;
       
   125 
       
   126 private:
       
   127 
       
   128     /**
       
   129      * C++ default constructor.
       
   130      */
       
   131     CAknDigitalClock( TBool aInStatusPane );
       
   132 
       
   133     /**
       
   134      * By default Symbian 2nd phase constructor is private.
       
   135      */
       
   136     void ConstructL();
       
   137 
       
   138 public:
       
   139     /**
       
   140      * From @c CCoeControl.
       
   141      *
       
   142      * Handles pointer events by changing clock between digital/analog.
       
   143      *
       
   144      * @param  aPointerEvent  Pointer event to be handled.
       
   145      */
       
   146     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   147 
       
   148 private: // Member data
       
   149 
       
   150     CPeriodic*                      iTimer;
       
   151     CAknDigitalClockChangeHandler*  iHandler;
       
   152     TRgb                            iColor;
       
   153     TAknTextLineLayout              iTimeLayout;
       
   154     TBool                           iTimeLayoutInUse;
       
   155     TInt                            iTimeFormat;
       
   156     TInt                            iFlags;
       
   157     };
       
   158 
       
   159 #endif // C_AKNDIGITALCLOCK_H
       
   160 
       
   161 // End of File