clock2/clockui/uilayer/clockmainview/inc/clockmaincontainer.h
changeset 0 f979ecb2b13e
child 30 d68a4b5d5885
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 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:   This is the header file for the CClockMainContainer class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CLOCK_CONTAINER_H__
       
    19 #define __CLOCK_CONTAINER_H__
       
    20 
       
    21 // System includes
       
    22 #include <coecntrl.h>
       
    23 #include <eiklbo.h>
       
    24 
       
    25 // User includes
       
    26 #include "clkcommon.h"
       
    27 
       
    28 // Forward declarations
       
    29 class CClockMainView;
       
    30 class CClockAlarmArray;
       
    31 class CAknsBasicBackgroundControlContext;
       
    32 class CAknSkinnableClock;
       
    33 class CClkUiAlarmModel;
       
    34 class CCoeEnv;
       
    35 //Single click integration
       
    36 class CAknDoubleStyleListBox;
       
    37 
       
    38 class CClockMarqueeLabel;
       
    39 
       
    40 // Constants
       
    41 const TInt KZeroAlarms( 1 );
       
    42 
       
    43 // Class declaration
       
    44 /**
       
    45 * @class CClockMainContainer
       
    46 * @brief The CCoeControl inheriting class.
       
    47 * @exe clock.exe
       
    48 */
       
    49 class CClockMainContainer : public CCoeControl,
       
    50                             public MEikListBoxObserver
       
    51 	{
       
    52 	public:			// Constructor and destructor
       
    53 			
       
    54 		/**
       
    55 		* @brief Create a CClockMainContainer object. Performs the first phase of 2-phase construction.
       
    56 		* @param aView The CClockMainView object.
       
    57 		* @param aRect The main rect.
       
    58 		* @param aAlarmArray The CClockAlarmArray object.
       
    59 		* @return CClockMainContainer* A pointer to the created instance of CClockMainContainer
       
    60 		*/
       
    61 		static CClockMainContainer* NewL( CClockMainView* aView, const TRect& aRect, CClockAlarmArray* aAlarmArray );
       
    62 		
       
    63 		/**
       
    64 		* @brief Destructor
       
    65 		*/
       
    66 		~CClockMainContainer();
       
    67 		
       
    68 	public: 		// Functions from base classes
       
    69 
       
    70         /**
       
    71 		* @brief From CCoeControl.
       
    72 		* @see CCoeControl
       
    73 		*/
       
    74         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
    75         							 TEventCode aType );
       
    76 
       
    77 		/**  
       
    78 		* @brief From CCoeControl. Draw this CClockMainContainer to the screen.
       
    79 		* @param aRect the rectangle of this view that needs updating
       
    80 		*/
       
    81     	void Draw( const TRect& aRect ) const;
       
    82     	
       
    83 		/**
       
    84 		* @brief From CCoeControl.
       
    85 		* @param aDrawNow.
       
    86 		* @see CCoeControl.
       
    87 		*/
       
    88 		void FocusChanged( TDrawNow aDrawNow );
       
    89     	
       
    90 		/**
       
    91 		* @brief From CCoeControl.
       
    92 		* @param aPointerEvent.
       
    93 		* @see CCoeControl.
       
    94 		*/
       
    95 		void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    96 		
       
    97 		/**
       
    98         * @brief Handles list box events.
       
    99         * This pure virtual function is invoked by CEikListBox to
       
   100         * notify the observer of list box events.
       
   101         * @param aListBox   The originating list box.
       
   102         * @param aEventType A code for the event. Further information 
       
   103         * may be obtained by accessing the list box itself.
       
   104         */
       
   105         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   106     	
       
   107 	public:         // New functions
       
   108 	    
       
   109 		/**
       
   110 		* @brief Updates the listbox with the newly added alarm.
       
   111 		* @param aAlarmInfo The new alarm info.
       
   112 		* @param aAlaramId The new alarm id.
       
   113 		*/
       
   114 		void UpdateAlarmListL( SClkAlarmInfo& aAlarmInfo, TAlarmId aAlarmId );
       
   115 	    
       
   116 		/**
       
   117 		* @brief Removes the alarm at aIndex.
       
   118 		* @param aIndex The index of the alarm list item.
       
   119 		*/
       
   120 		void RemoveAlarmL( TInt aIndex );
       
   121 	    
       
   122 		//Single click integration
       
   123         /**
       
   124         * @brief Returns a pointer to the listbox.
       
   125         * @return CAknDoubleStyleListBox* Pointer to the alarm listbox.
       
   126         */
       
   127         CAknDoubleStyleListBox* ListBox();
       
   128 
       
   129 	    
       
   130 		/**
       
   131 		* @brief Sets the information to the date and weekday displayed on the main view.
       
   132 		*/
       
   133 		void SetDayInfoL();
       
   134 	    
       
   135 		/**
       
   136 		* @brief Updates the variable iDSTOn based on whether DST in ON for the current timezone.
       
   137 		*/
       
   138 		void UpdateDSTStateL();
       
   139 	    
       
   140 		/**
       
   141 		* @brief Sets the zone information to be displayed in the main view.
       
   142 		*/
       
   143 		void SetZoneInfoL();
       
   144 		
       
   145 		/**
       
   146 		* @brief Reconstructs the marquee label and prepares it for marqueeing again.
       
   147 		*/
       
   148 		void ResetMarqueeLabelL();
       
   149     	
       
   150    	private:    	// Functions from base classes
       
   151 
       
   152     /**
       
   153     * From CCoeControl Gets help context
       
   154     * @param aContext Help context
       
   155     */
       
   156    	    void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   157    	    
       
   158     /**
       
   159     * brief checks automatic time update ON/OFF status.
       
   160     * @return TBool The automatic time update status.
       
   161     */
       
   162     		TBool GetAutoTimeUpdateState() const;
       
   163         
       
   164     
       
   165     /**
       
   166 		* @brief From CCoeControl. Handles a chage of client area size.
       
   167 		*/
       
   168         void SizeChanged();
       
   169         
       
   170     /**
       
   171 		* @brief From CCoeControl. Returns the number of components.
       
   172 		* @return TInt The number of component controls.
       
   173 		*/
       
   174         TInt CountComponentControls() const;
       
   175 
       
   176         /**
       
   177 		* @brief From CCoeControl. Returns a pointer of component.
       
   178 		* @return CCoeControl* Component control.
       
   179 		*/
       
   180         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   181         
       
   182         /**  
       
   183 		* @brief From CCoeControl. Returns the TTypeUid::Ptr, used to set the background context.
       
   184 		* @param aId
       
   185 		* @return TTypeUid::Ptr
       
   186 		* @see CCoeControl
       
   187 		*/
       
   188         TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   189         
       
   190 		/**
       
   191 		* @brief From CCoeControl. Handles the chane in the control's resource.
       
   192 		* @param aType The type of change.
       
   193 		* @see CCoeControl.
       
   194 		*/
       
   195 		void HandleResourceChange( TInt aType );
       
   196         
       
   197 	private:		// New functions     
       
   198         
       
   199         /**
       
   200 		* @brief By default Symbian OS constructor is private.
       
   201 		* @param aView The CClockMainView object.
       
   202 		* @param aRect of this container.
       
   203 		* @param aAlarmArray The CClockAlarmArray object.
       
   204 		*/
       
   205         void ConstructL( CClockMainView* aView, const TRect& aRect, CClockAlarmArray* aAlarmArray );
       
   206         
       
   207         /**
       
   208 		* @brief C++ default constructor.
       
   209 		*/
       
   210         CClockMainContainer();
       
   211         
       
   212 		/**
       
   213 		* @brief Draws the Date and day texts on the main view.
       
   214 		* @param aWindowGc The graphics context.
       
   215 		*/
       
   216 		void DrawMainViewText( CWindowGc& aWindowGc ) const;
       
   217         
       
   218 		/**
       
   219 		* @brief Tells if DST is on for the specified timezone ID.
       
   220 		* @param aTimeZoneId The timezone ID which we are interested in.
       
   221 		* @return TBool ETrue if the DST is on, EFalse otherwise.
       
   222 		*/
       
   223 		TBool IsDstOnL( TInt aTimeZoneId );
       
   224 		
       
   225 		/**
       
   226 		* @brief Gets the offset with DST for the given timezone id.
       
   227 		* @param aDstOffset This will contain the DST offset obtained from the rules.
       
   228 		* @param aTzId The timezone id of zone for which we need the DST offset.
       
   229 		*/
       
   230 		void GetOffSetWithDstL( TInt32& aDstOffset, const CTzId& aTzId );
       
   231         
       
   232 	private:       // Data
       
   233 	    
       
   234 	    /**
       
   235 		* @var iView
       
   236 		* @brief The CClockMainView object.
       
   237 		*/
       
   238 	    CClockMainView*							iView;
       
   239 	    
       
   240 		/**
       
   241 		* @brief iAlarmArray
       
   242 		* @brief The CClockAlarmArray object. Not owned.
       
   243 		*/
       
   244 		CClockAlarmArray*						iAlarmArray;
       
   245 	    
       
   246 	    /**
       
   247 		* @var iBgContext
       
   248 		* @brief The basic skin bg control context.
       
   249 		*/
       
   250 	    CAknsBasicBackgroundControlContext*		iBgContext;
       
   251 		
       
   252 		/**
       
   253 		* @var iSkinnableClock
       
   254 		* @brief The skinnable clock control.
       
   255 		*/
       
   256 		CAknSkinnableClock*						iSkinnableClock;
       
   257 		
       
   258 		/**
       
   259 		* @var iListBox
       
   260 		* @brief To display the alarms list.
       
   261 		*/
       
   262 		//Single click integration
       
   263         CAknDoubleStyleListBox*                 iListBox;
       
   264 
       
   265 		
       
   266 		/**
       
   267 		* @var iDayNameString
       
   268 		* @brief The string holder for the day name.
       
   269 		*/
       
   270 		HBufC*									iDayNameString;
       
   271 
       
   272 		/**
       
   273 		* @var iTouchFlag
       
   274 		* @brief Will be ETrue if a control has been tapped.
       
   275 		*/
       
   276 		TBool									iTouchFlag;
       
   277 		
       
   278 		/**
       
   279 		* @var iDstIndicator
       
   280 		* @brief The DST indicator icon.
       
   281 		*/
       
   282 		CFbsBitmap*								iDstIndicator;
       
   283 		
       
   284 		/**
       
   285 		* @var iDstIndicatorMask
       
   286 		* @brief The DST indicator icon mask.
       
   287 		*/
       
   288 		CFbsBitmap*								iDstIndicatorMask;
       
   289 		
       
   290 		/**
       
   291 		* @var iDSTOn
       
   292 		* @brief Set to ETrue if DST is ON for the current timezone, EFalse otherwise.
       
   293 		*/
       
   294 		TBool									iDSTOn;
       
   295 		
       
   296 		/**
       
   297 		* @var iLocationString
       
   298 		* @brief The string holder for displaying the current zone details.
       
   299 		*/
       
   300 		HBufC*									iLocationString;
       
   301 		
       
   302 		/**
       
   303 		* @var iLocationLabel
       
   304 		* @brief The label for displaying the location details.
       
   305 		*/
       
   306 		CClockMarqueeLabel*						iLocationLabel;
       
   307 
       
   308 		/**
       
   309 		* @var iTimeZoneString
       
   310 		* @brief Holds the timezone string in the form GMT +/-<offset>
       
   311 		*/
       
   312 		HBufC*									iTimeZoneString;
       
   313 		
       
   314 		/**
       
   315 		* @var iDateString
       
   316 		* @brief Holds the date.
       
   317 		*/
       
   318 		HBufC*									iDateString;
       
   319 
       
   320 	};
       
   321 
       
   322 #endif 		// __CLOCK_CONTAINER_H__
       
   323 
       
   324 // End of file