internetradio2.0/uicontrolsinc/irstationinformationdisplay.h
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
     1 /*
       
     2 * Copyright (c) 2007-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:  Control that displays current station information
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CIRSTATIONINFORMATIONDISPLAY_H
       
    20 #define C_CIRSTATIONINFORMATIONDISPLAY_H
       
    21 
       
    22 #include <alf/alfcontrol.h>
       
    23 
       
    24 #include "irmarqueeclet.h"
       
    25 #include "irstationinformationdata.h"
       
    26 
       
    27 class CAlfLayout;
       
    28 class CAlfDeckLayout;
       
    29 class CAlfGridLayout;
       
    30 class CIRStationInformationData;
       
    31 
       
    32 /**
       
    33  * Control that displays current station information.
       
    34  * 
       
    35  * Responsible for handling fade effects and transitions for the station information.
       
    36  */
       
    37 class CIRStationInformationDisplay : public CAlfControl
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      * 
       
    45      * The object's ownership is implicitly transferred to the supplied control group.
       
    46      * 
       
    47      * @param   aEnv                Alfred environment to use.
       
    48      * @param   aControlGroupId     Control group into which this control is added.
       
    49      * @param   aParentLayout       Parent layout to use.
       
    50      *
       
    51      * @return  The constructed object. Does not transfer ownership to the caller.
       
    52      */
       
    53     static CIRStationInformationDisplay* NewL( CAlfEnv& aEnv, TInt aControlGroupId,
       
    54     											CAlfLayout* aParentLayout = NULL );
       
    55 
       
    56     // <TUNING TEMP>
       
    57     ~CIRStationInformationDisplay();
       
    58    
       
    59     // </TUNING TEMP>
       
    60     
       
    61     /**
       
    62      * Sets the displayed data.
       
    63      * 
       
    64      * This causes an animation to take place that is determined by the supplied data's transition argument.
       
    65      * 
       
    66      * @param   aData   The data to set.
       
    67      */
       
    68     void SetDisplayedDataL( const CIRStationInformationData& aData );
       
    69 
       
    70     /**
       
    71      * Sets the RDS PS name.
       
    72      * 
       
    73      * Does not do anything if there is no data being displayed currently.
       
    74      *
       
    75      * @param   aRdsPsName      RDS PS name to set.
       
    76      */
       
    77     void RdsDataReceivedL( const TDesC& aRdsData );
       
    78     
       
    79     /**
       
    80      * Called when orienattion of the display has changed.
       
    81      * 
       
    82      * @param   aRdsDataDisplay   RDS data display.
       
    83      */
       
    84     void SetDisplayOrientation( TBool aLandscape ); 
       
    85     
       
    86     /**
       
    87      * Returns current fade style.
       
    88      * 
       
    89      * @return Fade style.
       
    90      */
       
    91     TIRFadeStyle FadeStyle(); 
       
    92  
       
    93 // from base class CAlfControl
       
    94 
       
    95     void VisualLayoutUpdated( CAlfVisual& aVisual );
       
    96     TBool OfferEventL( const TAlfEvent& aEvent );
       
    97     
       
    98 private:
       
    99 
       
   100     /**
       
   101      * Supported custom events.
       
   102      */
       
   103     enum TIRDisplayCustomEvents
       
   104         {
       
   105         EIRCustomEventDisplayFadeInCompleted,     /**< Event that is executed when a display has faded in. */
       
   106         EIRCustomEventDisplayFadeOutCompleted,    /**< Event that is executed when a display has faded out. */
       
   107         EIRCustomEventVisualFadeOutCompleted   /**< Event that is executed when a display has faded out. */
       
   108         };
       
   109     
       
   110 private:
       
   111 
       
   112     /**
       
   113      * Constructor.
       
   114      */
       
   115     CIRStationInformationDisplay( CAlfLayout& aParentLayout );
       
   116 
       
   117     /**
       
   118      * Second-phase constructor.
       
   119      * 
       
   120      * @param   aEnv                Alfred environment to use.
       
   121      * @param   aControlGroupId     Control group into which this control is added.
       
   122      * @param   aParentLayout       Parent layout to use.
       
   123      */
       
   124     void ConstructL( CAlfEnv& aEnv, TInt aControlGroupId,CAlfLayout* aParentLayout );
       
   125 
       
   126     /**
       
   127      * Creates a new display that is used to show the supplied data.
       
   128      * 
       
   129      * @param   aData       Station information data to display.
       
   130      */
       
   131     void CreateDisplayL( const CIRStationInformationData& aData );
       
   132 
       
   133     /**
       
   134      * Fades out the current display.
       
   135      */
       
   136     void FadeOutDisplay( const CIRStationInformationData& aData );
       
   137 
       
   138     /**
       
   139      * Fades in the current display.
       
   140      */
       
   141     void FadeInDisplay( const CIRStationInformationData& aData );
       
   142     
       
   143     /**
       
   144      * Fades a single visual.
       
   145      * 
       
   146      * If the supplied visual is a text visual, its shadow opacity is also modified.
       
   147      * 
       
   148      * @param   aVisual     Visual to fade.
       
   149      * @param   aOpacity    Target opacity.
       
   150      */
       
   151     void FadeVisual( CAlfVisual& aVisual, const TAlfTimedValue& aOpacity );
       
   152 
       
   153     /**
       
   154      * Fades all visuals contained within the supplied layout.
       
   155      * 
       
   156      * If the layout contains other layouts, also their child visuals will be modified.
       
   157      * 
       
   158      * @param   aLayout     Layout whose visuals to fade.
       
   159      * @param   aOpacity    Target opacity.
       
   160      */
       
   161     void FadeLayout( CAlfLayout& aLayout, const TAlfTimedValue& aOpacity );
       
   162 
       
   163     /**
       
   164      * Starts to display RDS data.
       
   165      */
       
   166     void DisplayRdsDataL();
       
   167 private:
       
   168     /**
       
   169      * Parent anchor layout.
       
   170      * Needed when creating own separate display for RDS data.
       
   171      */
       
   172     CAlfLayout& iParentAnchorLayout;
       
   173 
       
   174     /**
       
   175      * Base layout for the visuals.
       
   176      * Not owned.
       
   177      */
       
   178     CAlfDeckLayout* iBaseLayout;
       
   179 
       
   180     /**
       
   181      * Layout that is currently being displayed.
       
   182      * Contains all the visuals necessary to display any kind of station information data.
       
   183      * Not owned.
       
   184      */
       
   185     CAlfGridLayout* iLayout;
       
   186 
       
   187     /**
       
   188      * Layout for the name and index number.
       
   189      * Not owned.
       
   190      */
       
   191     CAlfGridLayout* iNameIndexLayout;
       
   192 
       
   193     /**
       
   194      * Layout for the RDS data.
       
   195      * Not owned.
       
   196      */
       
   197     CAlfGridLayout* iRdsDataLayout;
       
   198 
       
   199     /**
       
   200      * Text visual for the station name.
       
   201      * Not owned.
       
   202      */
       
   203     CAlfTextVisual* iName;
       
   204 
       
   205     /**
       
   206      * Text visual for the index number.
       
   207      * Not owned.
       
   208      */
       
   209     CAlfTextVisual* iIndex;
       
   210 
       
   211     /**
       
   212      * Text visual for the RDS PS name.
       
   213      * Not owned.
       
   214      */
       
   215     CAlfTextVisual* iRdsData;
       
   216 
       
   217     /**
       
   218      * Marquee controlet for the name.
       
   219      */
       
   220     TIRMarqueeClet iNameMarqueeClet;
       
   221     
       
   222     /**
       
   223      * Marquee controlet for the PS name (and Radio Text).
       
   224      */
       
   225     TIRMarqueeClet iRdsDataMarqueeClet;
       
   226     
       
   227     
       
   228     /**
       
   229      * RDS data text.
       
   230      * Owned.
       
   231      */
       
   232     RBuf iRdsDataText;
       
   233 
       
   234     /**
       
   235      * ETrue if orientation is landscape, otherwise EFalse.
       
   236      */
       
   237     TBool iLandscape;
       
   238 
       
   239     /**
       
   240      * Style of the logo fading.
       
   241      */
       
   242     TIRFadeStyle iFadeStyle;
       
   243 
       
   244     TBool iLandScapSetFalg;
       
   245     // </TUNING TEMP>
       
   246     
       
   247     };
       
   248 
       
   249 #endif // C_CIRSTATIONINFORMATIONDISPLAY_H