idlehomescreen/xmluirendering/renderingplugins/xnclockfactory/inc/xnclockface.h
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
    22 // INCLUDES
    22 // INCLUDES
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 
    24 
    25 // FORWARD DECLARATIONS
    25 // FORWARD DECLARATIONS
    26 class CXnClockAdapter;
    26 class CXnClockAdapter;
    27 class CXnNodePluginIf;
       
    28 class CWindowGc;
    27 class CWindowGc;
    29 
    28 
    30 // CLASS DECLARATIONS
    29 // CLASS DECLARATIONS
    31 /**
    30 /**
    32 *  @ingroup group_xnclockfactory
    31 *  @ingroup group_xnclockfactory
    48         * Draws the given time to the given buffer bitmap.
    47         * Draws the given time to the given buffer bitmap.
    49         *
    48         *
    50         * @since S60 5.1
    49         * @since S60 5.1
    51         *
    50         *
    52         * @param aAdapter Clock adapter
    51         * @param aAdapter Clock adapter
       
    52         *   
    53         * @param aGc Graphics context that can be used to draw to
    53         * @param aGc Graphics context that can be used to draw to
    54         *                     the clock
    54         *   the clock
    55         * @param aNode Node which contains drawing info
    55         *
       
    56         * @param aRect Rect where to scale the clock
       
    57         *                   
    56         * @param aTime Time to be used for drawing.
    58         * @param aTime Time to be used for drawing.
    57         * @param aAmpm Possible am\pm text to draw
       
    58         */
    59         */
    59         virtual void DrawL( CXnClockAdapter& aAdapter,
    60         virtual void DrawL( CXnClockAdapter& aAdapter,
    60                             CWindowGc& aGc, 
    61                             CWindowGc& aGc, 
    61                             CXnNodePluginIf& aNode, 
    62                             const TRect& aRect, 
    62                             const TTime& aTime,
    63                             const TTime& aTime ) = 0;                                    
    63                             CXnNodePluginIf* aAmpm ) = 0;
       
    64         
       
    65         /**
       
    66         * Reset font
       
    67         */
       
    68         virtual void ResetFont() = 0;
       
    69     };
    64     };
    70 
    65 
    71 class CXnClockFaceDigital : public CXnClockFace
    66 class CXnClockFaceDigital : public CXnClockFace
    72     {
    67     {
    73     public:
       
    74         /**
       
    75         * Type of font, digital or for am/pm text
       
    76         */
       
    77         enum TXnClockFontType {
       
    78                               EClock,
       
    79                               EAmpm
       
    80                               };
       
    81 
       
    82     public:  // Constructors and destructor
    68     public:  // Constructors and destructor
    83         
    69         
    84         /**
    70         /**
    85         * Two-phased constructor.
    71         * Two-phased constructor.
    86         */
    72         */
    96         /**
    82         /**
    97         * @see CXnClockFace::DrawL
    83         * @see CXnClockFace::DrawL
    98         */
    84         */
    99         void DrawL( CXnClockAdapter& aAdapter,
    85         void DrawL( CXnClockAdapter& aAdapter,
   100                     CWindowGc& aGc, 
    86                     CWindowGc& aGc, 
   101                     CXnNodePluginIf& aNode, 
    87                     const TRect& aRect, 
   102                     const TTime& aTime,
    88                     const TTime& aTime );
   103                     CXnNodePluginIf* aAmpm );
       
   104         
       
   105         /**
       
   106         * @see CXnClockFace::ResetFont
       
   107         */
       
   108         void ResetFont();
       
   109 
    89 
   110     private:
    90     private:
   111 
    91 
   112         /**
    92         /**
   113         * C++ default constructor.
    93         * C++ default constructor.
   116 
    96 
   117         /**
    97         /**
   118         * By default Symbian 2nd phase constructor is private.
    98         * By default Symbian 2nd phase constructor is private.
   119         */
    99         */
   120         void ConstructL();
   100         void ConstructL();
   121         
       
   122         /**
       
   123         * Draws am/pm text
       
   124         * 
       
   125         * @param aAdapter Clock adapter
       
   126         * @param aGc Graphics context that can be used to draw to
       
   127         *                     the clock
       
   128         * @param aTime Time to be used for drawing.
       
   129         * @param aAmpm Contains info for drawing
       
   130         */
       
   131         void DrawAmpmL( CXnClockAdapter& aAdapter,
       
   132                         CWindowGc& aGc,
       
   133                         const TTime& aTime,
       
   134                         CXnNodePluginIf& aAmpm );
       
   135         
       
   136         /**
       
   137         * Creates font
       
   138         * 
       
   139         * @param aAdapter Clock adapter
       
   140         * @param aNode Contains info to create font
       
   141         * @param aFontType Digital clock font or am/pm font
       
   142         * 
       
   143         * @return CAknLayoutFont
       
   144         */
       
   145         const CAknLayoutFont* CreateFontL( CXnClockAdapter& aAdapter,
       
   146                                            CXnNodePluginIf& aNode,
       
   147                                            TXnClockFontType aFontType );
       
   148         
       
   149         /**
       
   150         * Creates font color
       
   151         * 
       
   152         * @param aAdapter Clock adapter
       
   153         * @param aNode Contains info to create color
       
   154         * @param aFontType Digital clock font color or am/pm font color
       
   155         * 
       
   156         * @return Color
       
   157         */
       
   158         const TRgb& CreateColorL( CXnClockAdapter& aAdapter,
       
   159                                   CXnNodePluginIf& aNode,
       
   160                                   TXnClockFontType aFontType);
       
   161 
   101 
   162     private:    // Data
   102     private:    // Data
   163         // Date font, not owned
       
   164         CFont*  iClockFont;
       
   165         // Date font, not owned
       
   166         CFont*  iAmpmFont;
       
   167         // Digital clock font color
       
   168         TRgb    iFaceColor;
       
   169         // Indicates whether digital clock color should be created
       
   170         TBool   iIsFaceColorSet;
       
   171         // Am/pm text font color
       
   172         TRgb    iAmpmColor;
       
   173         // Indicates whether am/pm font color should be created
       
   174         TBool   iIsAmpmColorSet;
       
   175     };
   103     };
   176 
   104 
   177 class CXnClockFaceAnalog : public CXnClockFace
   105 class CXnClockFaceAnalog : public CXnClockFace
   178     {
   106     {
   179     public:  // Constructors and destructor
   107     public:  // Constructors and destructor
   193         /**
   121         /**
   194         * @see CXnClockFace::DrawL
   122         * @see CXnClockFace::DrawL
   195         */           
   123         */           
   196         void DrawL( CXnClockAdapter& aAdapter,
   124         void DrawL( CXnClockAdapter& aAdapter,
   197                     CWindowGc& aGc, 
   125                     CWindowGc& aGc, 
   198                     CXnNodePluginIf& aNode, 
   126                     const TRect& aRect, 
   199                     const TTime& aTime,
   127                     const TTime& aTime ); 
   200                     CXnNodePluginIf* aAmpm );
       
   201         
       
   202         /**
       
   203         * @see CXnClockFace::ResetFont
       
   204         */
       
   205         void ResetFont();
       
   206 
   128 
   207     private: // New functions
   129     private: // New functions
   208 
   130 
   209         /**
   131         /**
   210         * Draws the hands of the clock.
   132         * Draws the hands of the clock.
   211         *
   133         *
   212         * @param aGc Graphics context that can be used to draw to the
   134         * @param aGc Graphics context that can be used to draw to the
   213         *                     clock
   135         *   clock
       
   136         *
   214         * @param aRect Rectangle defining the size of the clock.
   137         * @param aRect Rectangle defining the size of the clock.
       
   138         *
   215         * @param aDateTime Time to be used for drawing.
   139         * @param aDateTime Time to be used for drawing.
   216         */                       
   140         */                       
   217         void DrawHandsL( CWindowGc& aGc, const TRect& aRect,
   141         void DrawHandsL( CWindowGc& aGc, const TRect& aRect,
   218                          const TDateTime& aDateTime );
   142                          const TDateTime& aDateTime );
   219         
       
   220         /**
       
   221         * Stores clock face adjustment value
       
   222         * @param aNode is current face.
       
   223         */ 
       
   224         TInt FaceAdjustmentValueL( CXnNodePluginIf& aNode );
       
   225 
   143 
   226     private:
   144     private:
   227 
   145 
   228         /**
   146         /**
   229         * C++ default constructor.
   147         * C++ default constructor.
   233         /**
   151         /**
   234         * By default Symbian 2nd phase constructor is private.
   152         * By default Symbian 2nd phase constructor is private.
   235         */
   153         */
   236         void ConstructL();
   154         void ConstructL();
   237 
   155 
   238     private:    // Data  
   156     private:    // Data                
   239         
       
   240         // Stores face adjustment value
       
   241         TInt iFaceAdjustmentValue;
       
   242     };
   157     };
   243 
   158 
   244 #endif      // _XNCLOCKFACE_H
   159 #endif      // _XNCLOCKFACE_H
   245             
   160             
   246 // End of File
   161 // End of File