idlehomescreen/xmluirendering/renderingplugins/xnclockfactory/inc/xnclockadapter.h
branchRCL_3
changeset 34 5456b4e8b3a8
child 35 3321d3e205b6
equal deleted inserted replaced
33:5f0182e07bfb 34:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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 rendering plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _XNCLOCKADAPTER_H
       
    21 #define _XNCLOCKADAPTER_H
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 #include <hwrmlight.h>
       
    26 
       
    27 // User includes
       
    28 #include "xncontroladapter.h"
       
    29 
       
    30 // Forward declarations
       
    31 class CXnNodePluginIf;
       
    32 class CXnClockControl;
       
    33 class CAknLayoutFont;
       
    34 class CFont;
       
    35 class TRgb;
       
    36 
       
    37 // Class declaration
       
    38 /**
       
    39 *  @ingroup group_xnclockfactory
       
    40 *  @lib xnclockfactory.lib
       
    41 *  @since S60 5.0
       
    42 */
       
    43 NONSHARABLE_CLASS( CXnClockAdapter ) : public CXnControlAdapter, 
       
    44     public MCoeMessageMonitorObserver, public MHWRMLightObserver
       
    45     {
       
    46 public:
       
    47     enum TClockFont
       
    48         {
       
    49         EDigitalFont,
       
    50         EAmPmFont,
       
    51         EDateFont
       
    52         };
       
    53     
       
    54 public: 
       
    55     // constructor and destructor
       
    56     
       
    57 	/**
       
    58 	 * 2 phase construction.
       
    59 	 */
       
    60 	static CXnClockAdapter* NewL( CXnControlAdapter* aParent, CXnNodePluginIf& aNode );
       
    61 
       
    62 	/**
       
    63 	 * Destructor.
       
    64 	 */
       
    65 	~CXnClockAdapter();
       
    66 
       
    67 public: 
       
    68 	// New functions
       
    69 
       
    70     /** 
       
    71     * Gets font based on type
       
    72     * 
       
    73     * @return Font based on aType, NULL if not found
       
    74     */    
       
    75     const CAknLayoutFont* FontL( const TInt aType );
       
    76         
       
    77     /**
       
    78     * Gets text color
       
    79     * 
       
    80     * @return Text color
       
    81     */
       
    82     const TRgb& TextColorL();
       
    83 
       
    84     /**
       
    85     * Gets date information
       
    86     * 
       
    87     * @return A node which holds date information
       
    88     */    
       
    89     CXnNodePluginIf* Date() const;
       
    90 
       
    91     /**
       
    92     * Gets day information
       
    93     * 
       
    94     * @return A node which holds day information
       
    95     */    
       
    96     CXnNodePluginIf* Day() const;
       
    97 
       
    98     /**
       
    99     * Calls DrawNow, if node is laidout
       
   100     */        
       
   101     void UpdateDisplay() const;
       
   102 
       
   103 public: 
       
   104     // from base classes
       
   105 
       
   106     /**
       
   107     * @see CXnControlAdapter documentation
       
   108     */    	
       
   109     void DoHandlePropertyChangeL( CXnProperty* aProperty = NULL ); 
       
   110 
       
   111     /*
       
   112      * @see CXnControlAdapter documentation
       
   113      */  
       
   114     void SkinChanged();
       
   115 
       
   116     /*     
       
   117      * @see CXnControlAdapter documentation
       
   118      */  
       
   119     void HandleScreenDeviceChangedL();
       
   120 
       
   121     /*     
       
   122      * @see CCoeControl documentation
       
   123      */      
       
   124     void SizeChanged();
       
   125     
       
   126     /**
       
   127     * @see CCoeControl documentation
       
   128     */    	            
       
   129     void Draw( const TRect& aRect ) const;
       
   130 
       
   131     /**
       
   132     * @see CCoeControl documentation
       
   133     */    	            
       
   134     void MakeVisible( TBool aVisible );
       
   135 
       
   136 private: 
       
   137     // from MCoeMessageMonitorObserver
       
   138     
       
   139     /**
       
   140     * @see MCoeMessageMonitorObserver documentation
       
   141     */
       
   142     void MonitorWsMessage( const TWsEvent& aEvent );
       
   143     
       
   144 private:
       
   145     // from MHWRMLightObserver
       
   146     
       
   147     /**
       
   148      * @see MHWRMLightObserver     
       
   149      */    
       
   150     void LightStatusChanged( TInt aTarget, 
       
   151         CHWRMLight::TLightStatus aStatus );
       
   152     
       
   153 private: 
       
   154     // constructors
       
   155 
       
   156     /**
       
   157     * C++ default constructor.
       
   158     */
       
   159 	CXnClockAdapter( CXnControlAdapter* aParent, CXnNodePluginIf& aNode );
       
   160 
       
   161     /**
       
   162     * By default Symbian 2nd phase constructor is private.
       
   163     */	
       
   164 	void ConstructL();
       
   165 
       
   166 private: // New functions
       
   167 
       
   168     /*
       
   169      * Create font
       
   170      */    
       
   171     void CreateFontL( const TInt aType );
       
   172 
       
   173     /*
       
   174      * Create color
       
   175      */        
       
   176     void CreateColorL();
       
   177         
       
   178     /**
       
   179      * Starts clock
       
   180      */
       
   181     void StartClock();
       
   182     
       
   183     /**
       
   184      * Stops clock
       
   185      */
       
   186     void StopClock();
       
   187     
       
   188 private:
       
   189     // Parent control, not owned
       
   190     CXnControlAdapter*  		iParent;        
       
   191     // UI node, not owned
       
   192     CXnNodePluginIf&    		iNode;
       
   193     // Digital clock date information, not owned
       
   194     CXnNodePluginIf*            iDate;
       
   195     // Analog clock day information, not owned
       
   196     CXnNodePluginIf*            iDay;
       
   197     // Light observer, owned
       
   198     CHWRMLight*                 iLightObserver;
       
   199     // Clock control, owned    
       
   200     CXnClockControl*            iClockControl;  
       
   201     // Digital clock font, not owned
       
   202     CFont*                      iDigitalFont;   
       
   203     // AmPm font, not owned
       
   204     CFont*                      iAmPmFont;      
       
   205     // Date font, not owned
       
   206     CFont*                      iDateFont;      
       
   207     // Font color
       
   208     TRgb                        iColor;
       
   209     // Flag for initializing font color
       
   210     TBool                       iColorSet;
       
   211     // Flag indicating foreground state
       
   212     TBool                       iForeground;
       
   213     // Flag indicating lights status
       
   214     TBool                       iLightsOn;
       
   215     };
       
   216 
       
   217 #endif      // _XNCLOCKADAPTER_H
       
   218             
       
   219 // End of File