idlehomescreen/xmluirendering/renderingplugins/xnclockfactory/inc/xndatecontrol.h
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
child 103 966d119a7e67
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     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:  Date control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _XNDATECONTROL_H
       
    20 #define _XNDATECONTROL_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 CXnNodePluginIf;
       
    31 class CEnvironmentChangeNotifier;
       
    32 
       
    33 enum TXnDateType {
       
    34                  EDate,
       
    35                  EDay
       
    36                  };
       
    37 
       
    38 // Class declaration
       
    39 /**
       
    40 *  @ingroup group_xnclockfactory
       
    41 *  @lib xnclockfactory.lib
       
    42 *  @since S60 5.0
       
    43 */
       
    44 NONSHARABLE_CLASS( CXnDateControl ) : public CBase
       
    45     {
       
    46 public: // Constructors and destructor
       
    47 
       
    48     /**
       
    49     * Two-phased constructor.
       
    50     *
       
    51     * @since S60 5.1
       
    52     *
       
    53     * @param aAdapter Clock adapter
       
    54     * @param aType Type of date. Could be date or day number
       
    55     *
       
    56     * @return Newly constructed object.
       
    57     */
       
    58     static CXnDateControl* NewL( CXnClockAdapter& aAdapter,
       
    59                                  TXnDateType aType );
       
    60                                               
       
    61 
       
    62     /**
       
    63     * Destructor.
       
    64     */
       
    65     virtual ~CXnDateControl();
       
    66 
       
    67 public: // New functions
       
    68         
       
    69     /**
       
    70     * Draws the clock
       
    71     *
       
    72     * @param aGc Context where to draw
       
    73     * @param aNode Contains drawing info 
       
    74     */
       
    75     void DrawL( CWindowGc& aGc, CXnNodePluginIf* aNode );
       
    76     
       
    77     /**
       
    78     * Resets font and color values
       
    79     */
       
    80     void ResetFont();
       
    81 
       
    82 private: // New functions
       
    83 
       
    84     /**
       
    85     * Constructs date string
       
    86     *
       
    87     * @return pointer to date string.
       
    88     */
       
    89     HBufC* ConstructDateStringL();
       
    90     
       
    91     /**
       
    92     * Constructs day number string
       
    93     *
       
    94     * @return pointer to day number string.
       
    95     */
       
    96     HBufC* ConstructDayStringL();
       
    97 
       
    98 private:
       
    99 
       
   100     /**
       
   101     * C++ default constructor.
       
   102     */
       
   103     CXnDateControl( CXnClockAdapter& aAdapter,
       
   104                     TXnDateType aType );
       
   105                         
       
   106     /**
       
   107     * By default Symbian 2nd phase constructor is private.
       
   108     */
       
   109     void ConstructL();
       
   110     
       
   111     /**
       
   112     * Creates font
       
   113     * 
       
   114     * @param aNode Contains info of font
       
   115     * 
       
   116     * @return CAknLayoutFont
       
   117     */
       
   118     const CAknLayoutFont* CreateFontL( CXnNodePluginIf& aNode );
       
   119     
       
   120     /**
       
   121     * Creates font color
       
   122     * 
       
   123     * @param aNode Contains info of color
       
   124     */
       
   125     const TRgb& CreateColorL( CXnNodePluginIf& aNode );
       
   126     
       
   127     /**
       
   128     * Callback when enviroment changed.
       
   129     * 
       
   130     * @param aPtr Pointer to self
       
   131     * 
       
   132     * @return KErrNone
       
   133     */
       
   134     static TInt HandleCallBackL( TAny *aPtr );
       
   135     
       
   136     /**
       
   137     * Updated date/day string
       
   138     */
       
   139     void RefreshDateL();
       
   140 
       
   141 private: // data
       
   142 
       
   143     // Holds date/day text, owned
       
   144     HBufC*	iDateText;
       
   145     // Clock adapter
       
   146     CXnClockAdapter& iAdapter;
       
   147     // Date font, not owned
       
   148     CFont*  iDateFont;
       
   149     // Font color
       
   150     TRgb    iDateColor;
       
   151     // Indicates whether color should be created
       
   152     TBool   iIsColorSet;
       
   153     // Environment notifier, owned
       
   154     CEnvironmentChangeNotifier* iEnvNotifier;
       
   155     // Type of date. Could be date or day number
       
   156     TXnDateType iDateType;
       
   157     };
       
   158 
       
   159 #endif // _XNDATECONTROL_H
       
   160 
       
   161 // End of File