voicerecorder/RecViewSrc/CVRStateInfoPanel.h
branchRCL_3
changeset 20 072a5fa0c63b
parent 19 2f5c9ee7098c
child 21 c6bafb5162d8
equal deleted inserted replaced
19:2f5c9ee7098c 20:072a5fa0c63b
     1 /*
       
     2 * Copyright (c) 2002 - 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: 
       
    15 *     A compound control class. It is responsible for drawing and updating
       
    16 *     a set of labels, and a progress bar.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __CVRSTATEINFOPANEL_H__
       
    22 #define __CVRSTATEINFOPANEL_H__
       
    23 
       
    24 // INCLUDES
       
    25 #include <coecntrl.h>
       
    26 #include <eikprogi.h>
       
    27 #include <AknUtils.h>
       
    28 
       
    29 #include "MVRObserver.h"
       
    30 #include "MVRStateInfoObserver.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CEikProgressInfo;
       
    34 class CVRLabel;
       
    35 class MVRStateInfoModel;
       
    36 
       
    37 
       
    38 // CLASS DEFINITION
       
    39 /**
       
    40 * A compound control class. It is responsible for drawing and updating
       
    41 * a set of labels, and a progress bar.
       
    42 */
       
    43 NONSHARABLE_CLASS( CVRStateInfoPanel )
       
    44 	: public CCoeControl, public MVRObserver, public MVRStateInfoObserver
       
    45 	{
       
    46 	public: // data types
       
    47 	    enum TVRLabels
       
    48 	        {
       
    49 	        ELabelName = 0,
       
    50 	        ELabelDate,
       
    51 	        ELabelQuality,
       
    52 	        ELabelMin,
       
    53 	        ELabelMax,
       
    54 	        ELabelStatus,
       
    55 	        ELabelQualityText
       
    56 	        };
       
    57 	
       
    58 	public: // constructors and destructor
       
    59 
       
    60 		/**
       
    61 		* Constructor.
       
    62 		* @param aModel Pointer to the state info model.
       
    63 		* Ownership is not transferred.
       
    64 		*/
       
    65 		CVRStateInfoPanel( MVRStateInfoModel* aModel );
       
    66 		
       
    67 		/**
       
    68 		* Constructor.
       
    69 		* @param aModel Pointer to the state info model.
       
    70 		* @param aParentViewUid Uid of CVRRecView for fast swap
       
    71 		* Ownership is not transferred.
       
    72 		*/
       
    73 		CVRStateInfoPanel( MVRStateInfoModel* aModel,
       
    74 						   TUid aParentViewUid );
       
    75 		/**
       
    76 		* Destructor
       
    77 		*/
       
    78 		virtual ~CVRStateInfoPanel();
       
    79 
       
    80 		/**
       
    81 		* 2nd phase constructor.
       
    82 		*/
       
    83 		void ConstructL();
       
    84 
       
    85 	private: // constructors
       
    86 
       
    87 		/**
       
    88 		* Default constructor. Not implemented.
       
    89 		*/
       
    90 		CVRStateInfoPanel();
       
    91 
       
    92 	public:
       
    93 		/**
       
    94 		* Handles a change to the application's resources
       
    95 		* @param aType The type of changed resource
       
    96 		*/		
       
    97 		void HandleResourceChangeL( TInt aType );
       
    98 
       
    99 	public: // from CCoeControl
       
   100 
       
   101 		/*
       
   102 		* From CCoeControl
       
   103 		* @see CCoeControl
       
   104 		*/
       
   105 		void SizeChanged();
       
   106 
       
   107 		/**
       
   108 		* Called by the framework to get the number of sub-components
       
   109 		* contained in this component. 
       
   110 		* @return The number of component controls contained by this control
       
   111 		*/
       
   112 		TInt CountComponentControls() const;
       
   113 
       
   114 		/**
       
   115 		* Called by the framework to get a specified sub-component
       
   116 		* of this component.
       
   117 		* @param aIndex The index of the component to get.
       
   118 		* @return The component control with an index of aIndex.
       
   119 		*/
       
   120 		CCoeControl* ComponentControl( TInt aIndex ) const;
       
   121 		
       
   122 		/**
       
   123 		* Gets called whenever a pointer event occurs.
       
   124 		* @param aPointerEvent The pointer event to handle.
       
   125 		*/					
       
   126 		void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   127 	
       
   128 	private: // From CCoeControl
       
   129 
       
   130 		void Draw( const TRect& aRect ) const;
       
   131 		
       
   132 	public: // from MVRObserver
       
   133 
       
   134 		/**
       
   135 		* Called to notify a change in the observed subject's state.
       
   136 		*/
       
   137 		void Update( TVRUpdateCommand aCommand );
       
   138 		
       
   139 	public: // from MVRStateInfoObserver	
       
   140 		
       
   141 		/**
       
   142 		* Returns the current progress bar position value
       
   143 		* @return Position value
       
   144 		*/
       
   145 		TInt ProgressBarPosition() const;
       
   146 		
       
   147 	private: // Helpers
       
   148 
       
   149 		CEikProgressInfo::SInfo ProgressInfo();
       
   150 
       
   151 		void UpdateLayoutL();
       
   152 
       
   153 		void CreateProgressBarL();
       
   154 		
       
   155 		/**
       
   156         * Updates the progress bar 
       
   157         */
       
   158 		void UpdateProgressBar();
       
   159 		
       
   160 		/**
       
   161 		* Handles progress bar touch events
       
   162 		* @param aPBRect Current progress bar rectangle 
       
   163 		* @param aPressedPoint The x coordinate value that was pressed
       
   164 		* 			inside the progress bar
       
   165 		*/
       
   166 		void HandleProgressBarTouchL( TRect aPBRect, TInt aPressedPoint );
       
   167 		
       
   168 		/**
       
   169 		* Rounds the parameter value to nearest second value
       
   170 		* @param aMicroSecs Time value in microseconds
       
   171 		* @return Rounded value in seconds
       
   172 		*/
       
   173 		TInt RoundMicroSecsToSecs( TTimeIntervalMicroSeconds aMicroSecs );
       
   174 
       
   175 
       
   176 	private: // Data
       
   177 
       
   178 		/**
       
   179 		* Pointer to the button panel model. Not owned.
       
   180 		*/
       
   181 		MVRStateInfoModel* iModel;
       
   182 
       
   183 		/**
       
   184 		* Pointer to an array of labels. Owned.
       
   185 		*/
       
   186 		CArrayPtrSeg< CVRLabel > iLabels;
       
   187 
       
   188 		/**
       
   189 		* Pointer to a progress bar control. Owned.
       
   190 		*/
       
   191 		CEikProgressInfo* iProgressBar;
       
   192 		
       
   193 		/**
       
   194 		* Uid of the parent view
       
   195 		*/
       
   196 		TUid iParentViewUid;
       
   197 		
       
   198 		/**
       
   199 		* Current progress bar position
       
   200 		*/
       
   201 		TInt iPBposition;
       
   202 		
       
   203 		// Skin instance. Not owned.
       
   204 		MAknsSkinInstance* iSkin;
       
   205 
       
   206 	};
       
   207 
       
   208 #endif // __CVRSTATEINFOPANEL_H__