internetradio2.0/uiinc/irstationinfocontainer.h
changeset 3 ee64f059b8e1
parent 2 2e1adbfc62af
child 4 3f2d53f144fe
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
     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:  Header for CIRStationInfoContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /* ---------------------------------------------------------------------------
       
    20 *  Version history:
       
    21 *  Template version:
       
    22 *  <ccm_history>
       
    23 *
       
    24 *  Version: 3, Thu Jul 3 16:30:00 2008 by Rohit
       
    25 *  Ref:
       
    26 *  Codescanner fixes
       
    27 *
       
    28 *  Version: 2, Thu May 22 19:20:00 2008 by Rohit
       
    29 *  Ref:
       
    30 *  Implemented StationInfo landscape view. Adjusted line spacings per UI spec.
       
    31 *
       
    32 *  Version: 1, Wed Apr 30 16:15:00 2008 by Rohit
       
    33 *  Ref:
       
    34 *  Created. Implemented StationInfo potrait view
       
    35 *
       
    36 *  </ccm_history>
       
    37 * ============================================================================
       
    38 */
       
    39 
       
    40 #ifndef CIRSTATIONINFOCONTAINER_H
       
    41 #define CIRSTATIONINFOCONTAINER_H
       
    42 
       
    43 //  INCLUDES
       
    44 #include <coecntrl.h>                       // CCoeControl
       
    45 #include <txtfrmat.h>                       // TCharFormat, TCharFormatMask
       
    46 #include <ImageConversion.h>
       
    47 
       
    48 #include "IRStationInfoView.h"
       
    49 #include "irimageconverterobserver.h"
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 class CAknsBasicBackgroundControlContext;
       
    53 class CEikRichTextEditor;
       
    54 class CFbsBitmap;
       
    55 class CIRImageConverter;
       
    56 
       
    57 /**
       
    58  * Container for Station information View.
       
    59  */
       
    60 class CIRStationInfoContainer : public CCoeControl, public MIRImageConverterObserver
       
    61 {
       
    62 public:  // Constructors and destructor
       
    63 
       
    64 	static CIRStationInfoContainer* NewL( const TRect& aRect, CIRStationInfoView* aView );
       
    65 
       
    66 	/**
       
    67 	* Destructor.
       
    68 	*/
       
    69 	virtual ~CIRStationInfoContainer();
       
    70 
       
    71 public: // Functions from base classes
       
    72 
       
    73 	/**
       
    74 	* From CoeControl, returns the number of control contained by this class.
       
    75 	* @return Number of controls contained
       
    76 	*/
       
    77 	TInt CountComponentControls() const;
       
    78 
       
    79 	/**
       
    80 	* From CCoeControl, returns handle to control pointed by aIndex
       
    81 	* @param aIndex Wanted control's index [0..n]
       
    82 	* @return Handle to wanted control
       
    83 	*/
       
    84 	CCoeControl* ComponentControl( TInt aIndex ) const;
       
    85 
       
    86 	/**
       
    87 	* From CCoeControl, Handles key events
       
    88 	* @param aKeyEvent The key event
       
    89 	* @param aType The type of key event (key, key up or key down)
       
    90 	* @return Indicates whether or not the key event was used by this control.
       
    91 	*/
       
    92 	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    93 
       
    94 	/**
       
    95      * MIRImageConverterObserver::HandleImageConversionEventL()
       
    96      * @param   aEvent  The event that occurred.
       
    97      * @param   aId     Identifier for the conversion.
       
    98      * @param   aError  One of the standard system error codes.
       
    99 	 */
       
   100 	void HandleImageConversionEventL( MIRImageConverterObserver::TIRImageConversionEvent aEvent, 
       
   101 									  TInt aId, TInt aError );
       
   102 
       
   103 	/**
       
   104 	* Issues logo scaling request
       
   105 	*/
       
   106 	void StartConvertStationLogoL();
       
   107 
       
   108 	/**
       
   109 	* Renders the logo and text in the view as per the current resolution
       
   110 	*/
       
   111 	void ReloadStationInformationL();
       
   112 
       
   113 protected: // Functions from base classes
       
   114 
       
   115 	/**
       
   116 	* From CCoeControl, used for skins
       
   117 	* @param aId An encapsulated object type id
       
   118 	* @return Pointer to the object provided.
       
   119 	*/
       
   120 	TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   121 
       
   122 	/**
       
   123 	* From CoeControl
       
   124 	* Called by the framework when container size changes
       
   125 	*/
       
   126 	void SizeChanged();
       
   127 
       
   128 	/**
       
   129 	* From CoeControl
       
   130 	* Handles a change to the control's resources
       
   131 	* @param aType A message UID value
       
   132 	*/
       
   133 	void HandleResourceChange( TInt aType );
       
   134 
       
   135 private:   // Functions
       
   136 
       
   137 	/**
       
   138 	* C++ default constructor.
       
   139 	*/
       
   140 	CIRStationInfoContainer( CIRStationInfoView* aView);
       
   141 
       
   142 	/**
       
   143 	* By default Symbian 2nd phase constructor is private.
       
   144 	*/
       
   145 	void ConstructL( const TRect& aRect );
       
   146 
       
   147 	/**
       
   148 	* Overridden from CCoeControl.
       
   149 	* @param aRect Rectangle which needs drawing
       
   150 	*/
       
   151 	void Draw( const TRect &aRect ) const;
       
   152 
       
   153 	/**
       
   154 	* Initializes the rich text with font, color, anti-aliasing
       
   155 	*/
       
   156     void CreateRichTextDataL();
       
   157 
       
   158 	/**
       
   159 	* Instantiates RichTextEditor
       
   160 	* @return Initialized RichTextEditor
       
   161 	*/
       
   162 	CEikRichTextEditor* CreateEditorL();
       
   163 
       
   164 	/**
       
   165 	* Renders the logo in the view as per the current resolution
       
   166 	* @param aEditor 		RichTextEditor ref
       
   167 	* @param aIsLandscape	True if orientation is landscape, else False
       
   168 	*/
       
   169 	void DisplayStationLogoL( CEikRichTextEditor* aEditor, TBool aIsLandscape = EFalse);
       
   170 
       
   171 	/**
       
   172 	* Reads station info from preset and renders the text in the view
       
   173 	* @param aIsLandscape	True if orientation is landscape, else False
       
   174 	*/
       
   175 	void DisplayStationInfoL( TBool aIsLandscape = EFalse );
       
   176 
       
   177 	/**
       
   178 	* @return true if station logo available, else false.
       
   179 	*/
       
   180 	TBool IsStationSupportsLogo();
       
   181 
       
   182 
       
   183 	/**
       
   184 	* @return true if station is from ISDS, false if user-defined.
       
   185 	*/
       
   186 	TBool IsISDSStation();
       
   187 
       
   188 private:    // Data
       
   189 
       
   190 	// Skin background context.
       
   191 	CAknsBasicBackgroundControlContext* iBgContext;
       
   192 
       
   193 	// RichTextEditor to show logo in landscape orientation
       
   194 	CEikRichTextEditor* iEditorLogo;
       
   195 	
       
   196 	// RichTextEditor to show logo/text in potrait orientation, 
       
   197 	// text in landscape orientation
       
   198 	CEikRichTextEditor* iEditor;
       
   199 
       
   200     // the scaled bitmap
       
   201 	CFbsBitmap* iBitmap;
       
   202 
       
   203     // the scaled bitmap mask
       
   204 	CFbsBitmap* iBitmapMask;
       
   205 
       
   206 	// view reference
       
   207 	CIRStationInfoView *iStationInfoView;
       
   208 
       
   209 	// API wrapper to convert and scale image
       
   210 	CIRImageConverter* iConverter;
       
   211 
       
   212 	// parent rect
       
   213 	TRect	iClientRect;
       
   214 	
       
   215 	// Set When Any error during Image Conversion
       
   216 	TInt iError;
       
   217 
       
   218 	TBool iImageDrawn;
       
   219 
       
   220     };
       
   221 
       
   222 #endif      // EVEDETAILCONTAINER_H
       
   223 
       
   224 // End of File